Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3323 in orxonox.OLD for orxonox/branches/parenting/src/world.cc


Ignore:
Timestamp:
Jan 3, 2005, 2:21:34 PM (19 years ago)
Author:
patrick
Message:

oroxnox/branches/parenting: turned coordinate system, now using the normal opengl orientation: x: forth, y: up, z: right. tried to turn the landscape, but didnt work. will be remade later

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/world.cc

    r3321 r3323  
    272272
    273273  int sizeX = 100;
    274   int sizeY = 80;
     274  int sizeZ = 80;
    275275  float length = 1000;
    276276  float width = 200;
    277277  float widthX = float (length /sizeX);
    278   float widthY = float (width /sizeY);
    279  
    280   float height [sizeX][sizeY];
    281   Vector normal_vectors[sizeX][sizeY];
     278  float widthZ = float (width /sizeZ);
     279 
     280  float height [sizeX][sizeZ];
     281  Vector normal_vectors[sizeX][sizeZ];
    282282 
    283283 
    284284  for ( int i = 0; i<sizeX-1; i+=1)
    285     for (int j = 0; j<sizeY-1;j+=1)
     285    for (int j = 0; j<sizeZ-1;j+=1)
    286286      //height[i][j] = rand()/20046 + (j-25)*(j-25)/30;
    287287#ifdef __WIN32__
     
    291291#endif
    292292
    293   //Die Hügel ein wenig glätten
     293  //Die Huegel ein wenig glaetten
    294294  for (int h=1; h<2;h++)
    295295    for (int i=1;i<sizeX-2 ;i+=1 )
    296       for(int j=1;j<sizeY-2;j+=1)
     296      for(int j=1;j<sizeZ-2;j+=1)
    297297        height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4;
    298298 
    299299  //Berechnung von normalen Vektoren
    300  
    301300  for(int i=1;i<sizeX-2;i+=1)
    302     for(int j=1;j<sizeY-2 ;j+=1)
     301    for(int j=1;j<sizeZ-2 ;j+=1)
    303302      {
    304         Vector v1 = Vector (widthX*(1),      widthY*(j)  ,      height[i][j]);
    305         Vector v2 = Vector (widthX*(i-1),    widthY*(j)  ,      height[i-1][j]);
    306         Vector v3 = Vector (widthX*(i),      widthY*(j+1),      height[i][j+1]);
    307         Vector v4 = Vector (widthX*(i+1),    widthY*(j),        height[i+1][j]);
    308         Vector v5 = Vector (widthX*(i),      widthY*(j-1),      height[i][j-1]);
     303        Vector v1 = Vector (widthX*(1),      height[i][j],      widthZ*(j) );
     304        Vector v2 = Vector (widthX*(i-1),    height[i-1][j],    widthZ*(j));
     305        Vector v3 = Vector (widthX*(i),      height[i][j+1],    widthZ*(j+1));
     306        Vector v4 = Vector (widthX*(i+1),    height[i+1][j],    widthZ*(j));
     307        Vector v5 = Vector (widthX*(i),      height[i][j-1],    widthZ*(j-1));
    309308       
    310309        Vector c1 = v2 - v1;
     
    319318  int snowheight=3;
    320319  for ( int i = 0; i<sizeX; i+=1)
    321     for (int j = 0; j<sizeY;j+=1)
     320    for (int j = 0; j<sizeZ;j+=1)
    322321      {   
    323         Vector v1 = Vector (widthX*(i),      widthY*(j)  -width/2,      height[i][j]-20 );
    324         Vector v2 = Vector (widthX*(i+1),    widthY*(j)  -width/2,      height[i+1][j]-20);
    325         Vector v3 = Vector (widthX*(i+1),    widthY*(j+1)-width/2,    height[i+1][j+1]-20);
    326         Vector v4 = Vector (widthX*(i),      widthY*(j+1)-width/2,    height[i][j+1]-20);
     322        Vector v1 = Vector (widthX*(i),      height[i][j]-20,       widthZ*(j)  -width/2);
     323        Vector v2 = Vector (widthX*(i+1),    height[i+1][j]-20,     widthZ*(j)  -width/2);
     324        Vector v3 = Vector (widthX*(i+1),    height[i+1][j+1]-20,   widthZ*(j+1)-width/2);
     325        Vector v4 = Vector (widthX*(i),      height[i][j+1]-20,     widthZ*(j+1)-width/2);
    327326        float a[3];
    328327        if(height[i][j]<snowheight){
Note: See TracChangeset for help on using the changeset viewer.