Index: orxonox/branches/shadows/src/shadow.cc
===================================================================
--- orxonox/branches/shadows/src/shadow.cc	(revision 3760)
+++ orxonox/branches/shadows/src/shadow.cc	(revision 3839)
@@ -56,5 +56,5 @@
 }
 
-void Shadow::init()
+void Shadow::init(GLuint ground_id_imported)
 {
     
@@ -63,4 +63,9 @@
     float plane_r[] ={0.0f,0.0f,1.0f,0.0f};
     float plane_q[] ={0.0f,0.0f,0.0f,1.0f};
+    
+    
+    this->mat=new Material("Ground");
+    this->mat->setDiffuseMap("../data/pictures/ground.tga");
+    this->mat->setIllum(3);
     
     glClearDepth(1);
@@ -91,16 +96,8 @@
     
     this->image=(unsigned char*)malloc(SIZE*SIZE*4);
-    
-
-}
-void Shadow::createGroundList(){
-     this->ground_id=glGenLists(1);
-     glNewList(this->ground_id,GL_COMPILE);
-    
-     setGround();
-    
-     glEndList();
-
-}
+    this->ground_id=ground_id_imported;
+
+}
+
 
 void Shadow::createShadow()
@@ -111,12 +108,5 @@
     glBindTexture(GL_TEXTURE_2D,this->shadow_id);
     
-    glClearColor(1,1,1,1);
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();
-    glOrtho(-4.2,4.2,-4.2,4.2,-100,100);
-    glMatrixMode(GL_MODELVIEW);
-    glLoadIdentity();
-    
+   
     gluLookAt(this->lightPos[0],this->lightPos[1],this->lightPos[2],this->playerPos[0],this->playerPos[1],this->playerPos[2],0,0,1);
     
@@ -132,13 +122,13 @@
     glEnable(GL_LIGHTING);
     
-    glColor3f(1,1,1);
-    
-    glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,SIZE,SIZE);
-    //glReadPixels(0,0,SIZE,SIZE,GL_RGB,GL_UNSIGNED_BYTE,this->image);
-    //blur(this->image,SIZE);
-    //glTexSubImage2D(GL_TEXTURE_2D,0,0,0,SIZE,SIZE,GL_RGB,GL_UNSIGNED_BYTE,this->image);
+    
+    
+    //glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,SIZE,SIZE);
+    glReadPixels(0,0,SIZE,SIZE,GL_RGB,GL_UNSIGNED_BYTE,this->image);
+    blur(this->image,SIZE);
+    glTexSubImage2D(GL_TEXTURE_2D,0,0,0,SIZE,SIZE,GL_RGB,GL_UNSIGNED_BYTE,this->image);
     
     glDisable(GL_SCISSOR_TEST);
-    glViewport(0,0,400,300); //Achtung: hier Aufloesung von Orxonox einstellen!
+    glViewport(0,0,1024,768); //Achtung: hier Aufloesung von Orxonox einstellen!
      
     
@@ -146,4 +136,57 @@
 }
 
+void Shadow::draw()
+{
+    float m[16],im[16];
+    
+    createShadow();
+    //glClearColor(0,0,0,1);
+    //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    //glMatrixMode(GL_PROJECTION);
+    //glLoadIdentity();
+    //gluPerspective(45,4.0/3.0,.5,100);
+    //glMatrixMode(GL_MODELVIEW);
+    //glLoadIdentity();
+        
+    this->mat->select();
+    glCallList(this->ground_id);
+    
+    //glDisable(GL_TEXTURE_2D);
+        
+    glEnable(GL_TEXTURE_GEN_S);
+    glEnable(GL_TEXTURE_GEN_T);
+    glEnable(GL_TEXTURE_GEN_R);
+    glEnable(GL_TEXTURE_GEN_Q);
+    glGetFloatv(GL_MODELVIEW_MATRIX,m);
+    m_inverse(m,im);
+    glMatrixMode(GL_TEXTURE);
+    glLoadIdentity();
+    //glTranslatef(.5,.5,0);
+    //glScalef(.5,.5,1.0);
+    //glOrtho(-1,1,-1,1,-1,1);
+    
+    gluLookAt(this->lightPos[0],this->lightPos[1],this->lightPos[2],this->playerPos[0],this->playerPos[1],this->playerPos[2],0,0,1);
+    
+    glMultMatrixf(im);
+    glEnable(GL_TEXTURE_2D),
+    glBindTexture(GL_TEXTURE_2D,this->shadow_id);
+    glEnable(GL_BLEND);
+    glBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
+    //glCallList(this->ground_id);
+    glDisable(GL_BLEND);
+    glDisable(GL_TEXTURE_2D);
+    
+    glLoadIdentity();
+    glMatrixMode(GL_MODELVIEW);
+    glDisable(GL_TEXTURE_GEN_S);
+    glDisable(GL_TEXTURE_GEN_T);
+    glDisable(GL_TEXTURE_GEN_R);
+    glDisable(GL_TEXTURE_GEN_Q);
+    
+    
+    
+    
+    
+}
 
 /** 
@@ -168,48 +211,8 @@
 }
 
-/**
-    brief takes the ground data from the world.cc class and passes it to shadow.cc
-
-*/
-
-void Shadow::setGround()
-{
-    
-    
-    glBegin(GL_QUADS);
-    for(int i=0;i<100;i+=1)
-	for(int j=0;j<80;j+=1)
-	    {
-	    glNormal3f(normal_vectors[i][j].x,normal_vectors[i][j].y,normal_vectors[i][j].z);
-	    glTexCoord2f(0.0f,0.0f);
-	    glVertex3f(vertexes[0][i][j].x,vertexes[0][i][j].y,vertexes[0][i][j].z);
-	    glNormal3f(normal_vectors[i+1][j].x,normal_vectors[i+1][j].y,normal_vectors[i+1][j].z);
-	    glTexCoord2f(1.0f,0.0f);
-	    glVertex3f(vertexes[1][i][j].x,vertexes[1][i][j].y,vertexes[1][i][j].z);
-	    glNormal3f(normal_vectors[i+1][j+1].x,normal_vectors[i+1][j+1].y,normal_vectors[i+1][j+1].z);
-	    glTexCoord2f(1.0f,1.0f);
-	    glVertex3f(vertexes[2][i][j].x,vertexes[2][i][j].y,vertexes[2][i][j].z);
-	    glNormal3f(normal_vectors[i][j+1].x,normal_vectors[i][j+1].y,normal_vectors[i][j+1].z);
-	    glTexCoord2f(0.0f,1.0f);
-	    glVertex3f(vertexes[3][i][j].x,vertexes[3][i][j].y,vertexes[3][i][j].z);
-	    }
-    glEnd();
-        
-
-
-
-}
-
-void Shadow::setNormal(Vector a,int i,int j)
-{
-    normal_vectors[i][j]=a;
-
-}
-
-void Shadow::setVertexNum(Vector a,int i,int j,int num)
-{
-    vertexes[num][i][j]=a;
-
-}
+
+
+
+
 /**
 
@@ -256,52 +259,4 @@
 */
 
-void Shadow::draw()
-{
-    float m[16],im[16];
-    
-    createShadow();
-    //glClearColor(0,0,0,0);
-    //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-    //glMatrixMode(GL_PROJECTION);
-    //glLoadIdentity();
-    //gluPerspective(45,4.0/3.0,.5,100);
-    //glMatrixMode(GL_MODELVIEW);
-    //glLoadIdentity();
-    
-    
-    
-    glEnable(GL_TEXTURE_GEN_S);
-    glEnable(GL_TEXTURE_GEN_T);
-    glEnable(GL_TEXTURE_GEN_R);
-    glEnable(GL_TEXTURE_GEN_Q);
-    glGetFloatv(GL_MODELVIEW_MATRIX,m);
-    m_inverse(m,im);
-    glMatrixMode(GL_TEXTURE);
-    glLoadIdentity();
-    glTranslatef(-.5,.5,0);
-    glScalef(0.3,0.3,1.0);
-    glOrtho(-1,1,-1,1,-1,1);
-    
-    gluLookAt(this->lightPos[0],this->lightPos[1],this->lightPos[2],this->playerPos[0],this->playerPos[1],this->playerPos[2],0,0,1);
-    
-    glMultMatrixf(im);
-    glEnable(GL_TEXTURE_2D),
-    glBindTexture(GL_TEXTURE_2D,this->shadow_id);
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
-    glCallList(this->ground_id);
-    glDisable(GL_BLEND);
-    glDisable(GL_TEXTURE_2D);
-    
-    glLoadIdentity();
-    glMatrixMode(GL_MODELVIEW);
-    glDisable(GL_TEXTURE_GEN_S);
-    glDisable(GL_TEXTURE_GEN_T);
-    glDisable(GL_TEXTURE_GEN_R);
-    glDisable(GL_TEXTURE_GEN_Q);
-    
-    
-    
-}
 
 
