Changeset 3419 in orxonox.OLD for orxonox/trunk/src/skysphere.cc
- Timestamp:
- Feb 22, 2005, 6:26:03 PM (20 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/skysphere.cc
r3416 r3419 34 34 /** 35 35 \brief Standart Constructor 36 \todo second Constructor with char* input for different skies37 36 */ 38 37 Skysphere::Skysphere() 39 38 { 40 //GLUquadricObj *sphereObj=0; 41 sphereObj=gluNewQuadric(); 42 gluQuadricTexture(sphereObj,GL_TRUE); 43 sky = new Material("Sky"); 44 sky->setDiffuseMap("../data/pictures/sky-replace.jpg"); 45 sky->setIllum(3); 46 // sky->setAmbient(1,1,1); 39 initialize("../data/pictures/sky-replace.jpg"); 40 } 47 41 42 /** 43 \brief Constructs a SkySphere and takes fileName as a map. 44 \param fileName the file to take as input for the skysphere 45 */ 46 Skysphere::Skysphere(char* fileName) 47 { 48 initialize(fileName); 48 49 } 49 50 … … 53 54 Skysphere::~Skysphere() 54 55 { 55 delete sky; 56 delete sphereObj; 56 delete sky; 57 free(sphereObj); 58 } 57 59 60 /** 61 \brief initializes the Skysphere. 62 \param fileName the file to take as input for the skysphere 63 */ 64 void Skysphere::initialize(char* fileName) 65 { 66 sphereObj=gluNewQuadric(); 67 gluQuadricTexture(sphereObj,GL_TRUE); 68 sky = new Material("Sky"); 69 sky->setDiffuseMap(fileName); 70 sky->setIllum(3); 71 sky->setAmbient(.5, .5, 1.0); 58 72 } 59 73 … … 63 77 \param y the y-coordinate of the Center of the Sphere 64 78 \param z the z-coordinate of the Center of the Sphere 65 79 66 80 This is normally done in the update-phase of world, so the Skysphere is always centered at the Camera. 67 81 */ 68 void Skysphere::updatePosition( float x,float y,float z)82 void Skysphere::updatePosition(Vector sphereCenter) 69 83 { 70 this->a=x; 71 this->b=y; 72 this->c=z; 84 this->sphereCenter = sphereCenter; 73 85 } 74 86 75 87 /** 76 88 \brief draws the Skysphere 77 89 78 90 This part is normally precessed in the "Painting Phase". 79 91 */ 80 92 81 93 void Skysphere::draw() 82 94 { 83 sky->select(); 84 glPushMatrix(); 85 glTranslatef(this->a,this->b,this->c); 86 87 glRotatef(-30,1,0,0); 88 glRotatef(95.0f,0.0f,0.0f,1.0f); 89 glRotatef(-250.0f,0.0,1.0f,0.0f); 90 91 gluSphere(sphereObj,200.0f,20,20); 92 glPopMatrix(); 93 94 95 sky->select(); 96 glPushMatrix(); 97 glTranslatef(this->sphereCenter.x,this->sphereCenter.y,this->sphereCenter.z); 98 99 glRotatef(-30,1,0,0); 100 glRotatef(95.0f,0.0f,0.0f,1.0f); 101 glRotatef(-250.0f,0.0,1.0f,0.0f); 102 103 gluSphere(sphereObj,200.0f,20,20); 104 glPopMatrix(); 95 105 } 96 106
Note: See TracChangeset
for help on using the changeset viewer.