Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3407 in orxonox.OLD for orxonox/branches/dave/src/world.cc


Ignore:
Timestamp:
Feb 17, 2005, 7:22:34 PM (19 years ago)
Author:
dave
Message:

branches/dave/src: Hab skybox.cc und skybox.h geschreieben→enjoy, ich hoffe es funktioniert so

File:
1 edited

Legend:

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

    r3406 r3407  
    2828#include "helper_parent.h"
    2929#include "glmenu_imagescreen.h"
     30#include "skybox.h"
    3031#include "importer/material.h"
    3132
     
    289290            orx->getLocalInput()->bind (myPlayer);
    290291           
     292            // create skybox
     293           
     294            this->skybox = new Skybox();
     295                   
    291296            // bind camera
    292297            this->localCamera = new Camera(this);
     
    333338            this->pathnodes[5] = Vector(30, 50, 0);
    334339           
    335 
     340           
    336341
    337342
     
    371376
    372377  // initialize debug coord system
    373   //fog initialisation
     378 
    374379 
    375   //float fog_color[]={0.8f,0.8f,0.2f,1.0f};
    376  
    377   //glEnable(GL_FOG);
    378   //glLoadIdentity();
    379   //glFogi(GL_FOG_MODE,GL_EXP);
    380   //glFogf(GL_FOG_DENSITY,.02f);
    381   //glFogfv(GL_FOG_COLOR,fog_color);
    382   //glClearColor(.8f,.8f,.8f,1.0f);
     380 
    383381 
    384382   
     
    389387  // Setting the illumination mode otherwise it is flat-shaded.
    390388  boden->setIllum(3);
    391 
     389 
     390  //Initializing the Sky, and loading a Texture into it.
     391  //GLUquadricObj *sphereObj=0;
     392  //sphereObj=gluNewQuadric();
     393  //gluQuadricTexture(sphereObj,GL_TRUE);
     394 
     395 
     396  Material* sky = new Material("Sky");
     397  sky->setDiffuseMap("../data/pictures/sky-replace.jpg");
     398  sky->setIllum(2);
     399 
     400 
     401 
     402 
    392403  objectList = glGenLists(1);
    393404  glNewList (objectList, GL_COMPILE);
     
    451462      }
    452463
    453   int snowheight=13;
     464 
    454465  for ( int i = 0; i<sizeX; i+=1)
    455466    for (int j = 0; j<sizeZ;j+=1)
     
    464475        a[2]=1.0;
    465476        glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    466         /*if(height[i][j]<snowheight){
    467           a[0]=0;
    468           a[1]=1.0-height[i][j]/10-.3;
    469           a[2]=0;
    470           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    471         }
    472         else{
    473             a[0]=1.0;
    474             a[1]=1.0;
    475             a[2]=1.0;
    476             glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    477            
    478         }*/
     477       
    479478        glNormal3f(normal_vectors[i][j].x, normal_vectors[i][j].y, normal_vectors[i][j].z);
    480479        glTexCoord2f(0.0f,0.0f);
     
    482481        glVertex3f(v1.x, v1.y, v1.z);
    483482       
    484         /*
    485         if(height[i+1][j]<snowheight){
    486           a[0]=0;
    487           a[1] =1.0-height[i+1][j]/10-.3;
    488           a[2]=0;
    489           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    490         }
    491         else{
    492           a[0]=1.0;
    493           a[1]=1.0;
    494           a[2]=1.0;
    495           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    496         }*/
     483       
    497484        glNormal3f(normal_vectors[i+1][j].x, normal_vectors[i+1][j].y, normal_vectors[i+1][j].z);
    498485        glTexCoord2f(1.0f,0.0f);
    499486        //glTexCoord2f((float)(i+1.0)/(float)sizeX,(float)j/(float)sizeZ);
    500487        glVertex3f(v2.x, v2.y, v2.z);
    501         /*
    502         if(height[i+1][j+1]<snowheight){
    503           a[0]=0;
    504           a[1] =1.0-height[i+1][j+1]/10-.3;
    505           a[2]=0;
    506           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    507         }
    508         else{
    509           a[0]=1.0;
    510           a[1]=1.0;
    511           a[2]=1.0;
    512           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    513         }*/
     488       
    514489        glNormal3f(normal_vectors[i+1][j+1].x, normal_vectors[i+1][j+1].y, normal_vectors[i+1][j+1].z);
    515490        glTexCoord2f(1.0f,1.0f);
    516491        //glTexCoord2f((float)(i+1.0)/(float)sizeX,(float)(j+1.0)/(float)sizeZ);
    517492        glVertex3f(v3.x, v3.y, v3.z);
    518         /*
    519         if(height[i][j+1]<snowheight){
    520           a[0]=0;
    521           a[1] =1.0-height[i+1][j+1]/10-.3;
    522           a[2]=0;
    523           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    524         }
    525         else{
    526           a[0]=1.0;
    527           a[1]=1.0;
    528           a[2]=1.0;
    529           glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    530         }*/
     493       
    531494        glNormal3f(normal_vectors[i][j+1].x, normal_vectors[i][j+1].y, normal_vectors[i][j+1].z);
    532495        glTexCoord2f(0.0f,1.0f);
     
    541504  glDisable(GL_TEXTURE_2D);
    542505
    543   /* 
    544   glBegin(GL_LINES);
    545   for( float x = -128.0; x < 128.0; x += 25.0)
    546     {
    547       for( float y = -128.0; y < 128.0; y += 25.0)
    548         {
    549           glColor3f(1,0,0);
    550           glVertex3f(x,y,-128.0);
    551           glVertex3f(x,y,0.0);
    552           glColor3f(0.5,0,0);
    553           glVertex3f(x,y,0.0);
    554           glVertex3f(x,y,128.0);
    555         }
    556     }
    557   for( float y = -128.0; y < 128.0; y += 25.0)
    558     {
    559       for( float z = -128.0; z < 128.0; z += 25.0)
    560         {
    561           glColor3f(0,1,0);
    562           glVertex3f(-128.0,y,z);
    563           glVertex3f(0.0,y,z);
    564           glColor3f(0,0.5,0);
    565           glVertex3f(0.0,y,z);
    566           glVertex3f(128.0,y,z);
    567         }
    568     }
    569   for( float x = -128.0; x < 128.0; x += 25.0)
    570     {
    571       for( float z = -128.0; z < 128.0; z += 25.0)
    572         {
    573           glColor3f(0,0,1);
    574           glVertex3f(x,-128.0,z);
    575           glVertex3f(x,0.0,z);
    576           glColor3f(0,0,0.5);
    577           glVertex3f(x,0.0,z);
    578           glVertex3f(x,128.0,z);
    579         }
    580      
    581     }
    582   */ 
     506 
    583507  //draw track
    584508  glBegin(GL_LINES);
     
    591515  glEnd();
    592516 
    593   /*
    594   glBegin(GL_LINE_STRIP);
    595   glColor3f(1.0, 5.0, 1.0);
    596   for( int i = 0; i <= 30; i++)
    597     {
    598       glEvalCoord1f ((GLfloat) i/30.0);
    599     }
    600   glEnd();
    601   */
     517
    602518
    603519  trackManager->drawGraph(.01);
     
    605521  delete trackManager;
    606522 
    607   /*
    608   glBegin(GL_LINES);
    609   float i;
    610   for(i = 0.0; i<1; i+=.01)
    611     {
    612       printf("%f, %f, %f\n",tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
    613       glVertex3f(tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
    614     }
    615   glEnd();
    616   */
    617   glEndList();
    618  
    619  
     523
     524 
     525  glEnable(GL_TEXTURE_2D);
     526  sky->select();
     527  skybox->draw();
     528 
     529  glEndList(); 
    620530}
    621531
Note: See TracChangeset for help on using the changeset viewer.