Index: orxonox/trunk/src/world.cc
===================================================================
--- orxonox/trunk/src/world.cc	(revision 3199)
+++ orxonox/trunk/src/world.cc	(revision 3200)
@@ -190,68 +190,67 @@
   glColor3f(1.0,0,0);
   glBegin(GL_QUADS);
-  float height [500][100];
-  Vector normal_vectors[500][100];
-  float size = 2;
-  
-  
-  for ( int i = 0; i<400; i+=1)
-    {
-      for (int j = 0; j<100;j+=1)
-	{
-	    //height[i][j] = rand()/20046 + (j-25)*(j-25)/30;
+
+  int sizeX = 100;
+  int sizeY = 80;
+  float length = 1000;
+  float width = 200;
+  float widthX = float (length /sizeX);
+  float widthY = float (width /sizeY);
+  
+  float height [sizeX][sizeY];
+  Vector normal_vectors[sizeX][sizeY];
+  
+  
+  for ( int i = 0; i<sizeX-1; i+=1)
+    for (int j = 0; j<sizeY-1;j+=1)
+      //height[i][j] = rand()/20046 + (j-25)*(j-25)/30;
 #ifdef __WIN32__
-	  height[i][j]=(sin((float)j/3)*rand()*i/182400)*.2;
+      height[i][j]=(sin((float)j/3)*rand()*i/182400)*.5;
 #else
-	  height[i][j]=(sin((float)j/3)*rand()*(long)i/6282450500.0)*.2;
+      height[i][j]=(sin((float)j/3)*rand()*(long)i/6282450500.0)*.5;
 #endif
-	}
-    }
+
   //Die Hügel ein wenig glätten
   for (int h=1; h<2;h++)
-    for (int i=1;i<399 ;i+=1 )
-      for(int j=1;j<99;j+=1)
+    for (int i=1;i<sizeX-2 ;i+=1 )
+      for(int j=1;j<sizeY-2;j+=1)
 	height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4;
   
   //Berechnung von normalen Vektoren
-  
-  for(int i=1;i<399;i+=1){
-    for(int j=1;j<99 ;j+=1)
-      
+
+  for(int i=1;i<sizeX-2;i+=1)
+    for(int j=1;j<sizeY-2 ;j+=1)
       {
-	Vector* v1 = new Vector (size*i,size*(j-25)-50,height[i][j]-20 );
-	Vector* v2 = new Vector (size*(i+1),size*(j-25)-50,height[i+1][j]-20);
-	Vector* v3 = new Vector (size*(i),size*(j-24)-50,height[i][j+1]-20);
-	Vector* v4 = new Vector (size*(i-1),size*(j-25)-50,height[i-1][j]-20);
-	Vector* v5 = new Vector (size*(i),size*(j-26)-50,height[i][j-1]-20);
+	Vector v1 = Vector (widthX*(1),      widthY*(j)  ,      height[i][j]);
+	Vector v2 = Vector (widthX*(i-1),    widthY*(j)  ,      height[i-1][j]);
+	Vector v3 = Vector (widthX*(i),      widthY*(j+1),      height[i][j+1]);
+	Vector v4 = Vector (widthX*(i+1),    widthY*(j),        height[i+1][j]);
+	Vector v5 = Vector (widthX*(i),      widthY*(j-1),      height[i][j-1]);
 	
-	Vector c1 = *v1 - *v2;
-	Vector c2 = *v1 - *v3;
-	Vector c3= *v1 - *v4;
-	Vector c4 = *v1 - *v5;
-	normal_vectors[i][j]=c1.cross(*v1-*v3)+c2.cross(*v1-*v4)+c3.cross(*v1-*v5)+c4.cross(*v1-*v2);
+	Vector c1 = v2 - v1;
+	Vector c2 = v3 - v1;
+	Vector c3=  v4 - v1;
+	Vector c4 = v5 - v1;
+	Vector zero = Vector (0,0,0);
+	normal_vectors[i][j]=c1.cross(v4-v2)+c2.cross(v1-v3)+c3.cross(v2-v4)+c4.cross(v3-v1);
 	normal_vectors[i][j].normalize();
-	
-	
-	
-	
-	}
-  }
+      }
+
   int snowheight=3;
-  for ( int i = 0; i<400; i+=1)
-    {
-      for (int j = 0; j<100;j+=1)
-	{	  
-	  Vector* v1 = new Vector (size*i,        size*(j-25)-50,      height[i][j]-20 );
-	  Vector* v2 = new Vector (size*(i+1),    size*(j-25)-50,      height[i+1][j]-20);
-	  Vector* v3 = new Vector (size*(i+1),    size*(j-24)-50,  height[i+1][j+1]-20);
-	  Vector* v4 = new Vector (size*(i),        size*(j-24)-50,  height[i][j+1]-20);
-	  float a[3];
-	  if(height[i][j]<snowheight){
-	    a[0]=0;
-	    a[1]=1.0-height[i][j]/10-.3;
-	    a[2]=0;
-	    glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
-	  }
-	  else{
+  for ( int i = 0; i<sizeX; i+=1)
+    for (int j = 0; j<sizeY;j+=1)
+      {	  
+	Vector v1 = Vector (widthX*(i),      widthY*(j)  -width/2,      height[i][j]-20 );
+	Vector v2 = Vector (widthX*(i+1),    widthY*(j)  -width/2,      height[i+1][j]-20);
+	Vector v3 = Vector (widthX*(i+1),    widthY*(j+1)-width/2,    height[i+1][j+1]-20);
+	Vector v4 = Vector (widthX*(i),      widthY*(j+1)-width/2,    height[i][j+1]-20);
+	float a[3];
+	if(height[i][j]<snowheight){
+	  a[0]=0;
+	  a[1]=1.0-height[i][j]/10-.3;
+	  a[2]=0;
+	  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	}
+	else{
 	    a[0]=1.0;
 	    a[1]=1.0;
@@ -259,55 +258,54 @@
 	    glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
 	    
-	  }
-		glNormal3f(normal_vectors[i][j].x, normal_vectors[i][j].y, normal_vectors[i][j].z);
-		glVertex3f(v1->x, v1->y, v1->z);
-		if(height[i+1][j]<snowheight){
-		  a[0]=0;
-		  a[1] =1.0-height[i+1][j]/10-.3;
-		  a[2]=0;
-		  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
-		}
-		else{
-		  a[0]=1.0;
-		  a[1]=1.0;
-		  a[2]=1.0;
-		  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
-		  
-		}
-		glNormal3f(normal_vectors[i+1][j].x, normal_vectors[i+1][j].y, normal_vectors[i+1][j].z);
-		glVertex3f(v2->x, v2->y, v2->z);
-		if(height[i+1][j+1]<snowheight){
-		  a[0]=0;
-		  a[1] =1.0-height[i+1][j+1]/10-.3;
-		  a[2]=0;
-		  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
-		}
-		else{
-		  a[0]=1.0;
-		  a[1]=1.0;
-		  a[2]=1.0;
-		  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
-		  
-		  
-		}
-		glNormal3f(normal_vectors[i+1][j+1].x, normal_vectors[i+1][j+1].y, normal_vectors[i+1][j+1].z);
-		glVertex3f(v3->x, v3->y, v3->z);
-		if(height[i][j+1]<snowheight){
-		  a[0]=0;
-		  a[1] =1.0-height[i+1][j+1]/10-.3;
-		  a[2]=0;
-		  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
-		}
-		else{
-		  a[0]=1.0;
-		  a[1]=1.0;
-		  a[2]=1.0;
-		  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
-		}
-		glNormal3f(normal_vectors[i][j+1].x, normal_vectors[i][j+1].y, normal_vectors[i][j+1].z);
-		glVertex3f(v4->x, v4->y, v4->z);
-		
-	}
-    }
+	}
+	glNormal3f(normal_vectors[i][j].x, normal_vectors[i][j].y, normal_vectors[i][j].z);
+	glVertex3f(v1.x, v1.y, v1.z);
+	if(height[i+1][j]<snowheight){
+	  a[0]=0;
+	  a[1] =1.0-height[i+1][j]/10-.3;
+	  a[2]=0;
+	  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	}
+	else{
+	  a[0]=1.0;
+	  a[1]=1.0;
+	  a[2]=1.0;
+	  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	  
+	}
+	glNormal3f(normal_vectors[i+1][j].x, normal_vectors[i+1][j].y, normal_vectors[i+1][j].z);
+	glVertex3f(v2.x, v2.y, v2.z);
+	if(height[i+1][j+1]<snowheight){
+	  a[0]=0;
+	  a[1] =1.0-height[i+1][j+1]/10-.3;
+	  a[2]=0;
+	  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	}
+	else{
+	  a[0]=1.0;
+	  a[1]=1.0;
+	  a[2]=1.0;
+	  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	  
+	  
+	}
+	glNormal3f(normal_vectors[i+1][j+1].x, normal_vectors[i+1][j+1].y, normal_vectors[i+1][j+1].z);
+	glVertex3f(v3.x, v3.y, v3.z);
+	if(height[i][j+1]<snowheight){
+	  a[0]=0;
+	  a[1] =1.0-height[i+1][j+1]/10-.3;
+	  a[2]=0;
+	  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	}
+	else{
+	  a[0]=1.0;
+	  a[1]=1.0;
+	  a[2]=1.0;
+	  glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
+	}
+	glNormal3f(normal_vectors[i][j+1].x, normal_vectors[i][j+1].y, normal_vectors[i][j+1].z);
+	glVertex3f(v4.x, v4.y, v4.z);
+	
+      }
   glEnd();
   /*  
