- Timestamp:
- Feb 22, 2005, 8:14:18 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/skysphere.cc
r3419 r3420 54 54 Skysphere::~Skysphere() 55 55 { 56 delete sky ;56 delete skyMaterial; 57 57 free(sphereObj); 58 58 } … … 64 64 void Skysphere::initialize(char* fileName) 65 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); 66 this->sphereObj = gluNewQuadric(); 67 gluQuadricTexture(this->sphereObj, GL_TRUE); 68 this->setRadius(250.0); 69 70 this->skyMaterial = new Material("Sky"); 71 this->setTexture(fileName); 72 this->skyMaterial->setIllum(3); 73 this->skyMaterial->setAmbient(.5, .5, 1.0); 74 } 75 76 /** 77 \brief sets the Radius of the Sphere. 78 \param radius The Radius of The Sphere 79 */ 80 void Skysphere::setRadius(float radius) 81 { 82 this->sphereRadius = radius; 83 } 84 85 /** 86 \brief Defines which texture should be loaded onto the skysphere. 87 \param fileName The filename of the Texture 88 */ 89 void Skysphere::setTexture(char* fileName) 90 { 91 this->skyMaterial->setDiffuseMap(fileName); 72 92 } 73 93 … … 93 113 void Skysphere::draw() 94 114 { 95 sky ->select();115 skyMaterial->select(); 96 116 glPushMatrix(); 97 117 glTranslatef(this->sphereCenter.x,this->sphereCenter.y,this->sphereCenter.z); 98 118 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);119 glRotatef(-30, 1, 0, 0); 120 glRotatef(95.0f, 0.0f, 0.0f, 1.0f); 121 glRotatef(-250.0f, 0.0, 1.0f, 0.0f); 102 122 103 gluSphere(sphereObj, 200.0f,20,20);123 gluSphere(sphereObj, sphereRadius, 20, 20); 104 124 glPopMatrix(); 105 125 } -
orxonox/trunk/src/skysphere.h
r3419 r3420 24 24 { 25 25 private: 26 GLUquadricObj *sphereObj; 27 Vector sphereCenter; //!< Center of the Skysphere 28 Material *sky; //!< A Material for the Sky 29 26 GLUquadricObj *sphereObj; //!< A Placeholder for the SkySphere. 27 Material *skyMaterial; //!< A Material for the SkySphere. 28 Vector sphereCenter; //!< Center of the SkySphere. 29 float sphereRadius; //!< Radius of the SkySphere. This should match the frustum maximum range. 30 30 31 public: 31 32 Skysphere(); 32 33 Skysphere(char* fileName); 33 34 ~Skysphere(); 35 36 void setRadius(float radius); 37 void setTexture(char* fileName); 34 38 35 39 void updatePosition(Vector sphereCenter);
Note: See TracChangeset
for help on using the changeset viewer.