Changeset 3796 in orxonox.OLD for orxonox/trunk/src/world_entities
- Timestamp:
- Apr 13, 2005, 4:52:55 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/skybox.cc
r3794 r3796 27 27 28 28 29 #include "sky sphere.h"29 #include "skybox.h" 30 30 #include "stdincl.h" 31 31 32 32 #include "material.h" 33 33 #include "vector.h" 34 #include "resource_manager.h" 35 #include "model.h" 34 36 //#include "world_entity.h" 35 37 … … 38 40 39 41 /** 40 \brief Constructs a Sky Sphereand takes fileName as a map.41 \param fileName the file to take as input for the skysphere42 \brief Constructs a SkyBox and takes fileName as a map. 43 \param fileName the file to take as input for the SkyBox 42 44 */ 43 Sky sphere::Skysphere(char* fileName)45 SkyBox::SkyBox(char* fileName) 44 46 { 45 if (fileName == NULL) 46 this->initialize("../data/pictures/sky-replace.jpg"); 47 else 48 this->initialize(fileName); 47 this->setClassName("SkyBox"); 48 49 50 this->model = (Model*)ResourceManager::getInstance()->load("cube", PRIM, RP_LEVEL); 51 this->setMode(PNODE_MOVEMENT); 52 53 this->setSize(1900.0); 54 55 this->material = new Material("Sky"); 56 if (fileName) 57 this->setTexture(fileName); 58 this->material->setIllum(3); 59 this->material->setAmbient(1.0, 1.0, 1.0); 60 49 61 } 50 62 … … 53 65 \brief default destructor 54 66 */ 55 Sky sphere::~Skysphere()67 SkyBox::~SkyBox() 56 68 { 57 PRINTF(3)("Deleting the SkySphere\n"); 58 delete this->skyMaterial; 59 free(this->sphereObj); 60 } 61 62 /** 63 \brief initializes the Skysphere. 64 \param fileName the file to take as input for the skysphere 65 */ 66 void Skysphere::initialize(char* fileName) 67 { 68 PRINTF(1)("initializing the Skysphere with Material %s.\n", fileName); 69 this->sphereObj = gluNewQuadric(); 70 this->setMode(PNODE_MOVEMENT); 71 72 gluQuadricTexture(this->sphereObj, GL_TRUE); 73 this->setRadius(1900.0); 74 75 this->skyMaterial = new Material("Sky"); 76 this->setTexture(fileName); 77 this->skyMaterial->setIllum(3); 78 this->skyMaterial->setAmbient(1.0, 1.0, 1.0); 69 PRINTF(3)("Deleting the SkyBox\n"); 70 delete this->material; 79 71 } 80 72 81 73 82 74 /** 83 \brief Defines which texture should be loaded onto the skysphere.75 \brief Defines which texture should be loaded onto the SkyBox. 84 76 \param fileName The filename of the Texture 85 77 */ 86 void Sky sphere::setTexture(char* fileName)78 void SkyBox::setTexture(char* fileName) 87 79 { 88 this-> skyMaterial->setDiffuseMap(fileName);80 this->material->setDiffuseMap(fileName); 89 81 } 90 82 91 83 92 84 /** 93 \brief draws the Sky sphere85 \brief draws the SkyBox 94 86 95 87 This part is normally precessed in the "Painting Phase". 96 88 */ 97 void Sky sphere::draw()89 void SkyBox::draw() 98 90 { 99 91 glPushMatrix(); … … 102 94 glTranslatef(r.x, r.y, r.z); 103 95 104 //glRotatef(-30, 1, 0, 0); 105 //glRotatef(95.0f, 0.0f, 0.0f, 1.0f); 106 //glRotatef(-250.0f, 0.0, 1.0f, 0.0f); 107 108 skyMaterial->select(); 109 gluSphere(this->sphereObj, this->sphereRadius, 20, 20); 96 this->material->select(); 97 98 this->model->draw(); 99 110 100 glPopMatrix(); 111 101 } … … 116 106 \param radius The Radius of The Sphere 117 107 */ 118 void Sky sphere::setRadius(float radius)108 void SkyBox::setSize(float size) 119 109 { 120 this->s phereRadius = radius;110 this->size = size; 121 111 } -
orxonox/trunk/src/world_entities/skybox.h
r3794 r3796 1 1 /*! 2 \file sky sphere.h3 \brief Definition of the Sky sphere, that handles the Display of an atmosphere oforxonox.2 \file skybox.h 3 \brief Definition of the SkyBox, that handles the Display of an atmosphere for orxonox. 4 4 5 A Sky Sphereis always centered at the current working Camera, and will only obey the cameras5 A SkyBox is always centered at the current working Camera, and will only obey the cameras 6 6 movment but not its rotation. 7 8 \todo self-rotation9 \todo handle reference to parent-object10 7 */ 11 8 12 #ifndef _SKY SPHERE_H13 #define _SKY SPHERE_H9 #ifndef _SKYBOX_H 10 #define _SKYBOX_H 14 11 15 12 /* INCLUDES */ … … 20 17 class Vector; 21 18 22 //! A Class to handle a Sky Sphere23 class Sky sphere: public WorldEntity19 //! A Class to handle a Skybox 20 class SkyBox : public WorldEntity 24 21 { 25 22 26 23 public: 27 Skysphere(char* fileName = NULL); 28 virtual ~Skysphere(); 29 void destroy(); 24 SkyBox(char* fileName = NULL); 25 virtual ~SkyBox(); 30 26 31 void set Radius(float radius);27 void setSize(float size); 32 28 void setTexture(char* fileName); 33 29 … … 35 31 36 32 private: 37 GLUquadricObj *sphereObj; //!< A Placeholder for the SkySphere. 38 Material *skyMaterial; //!< A Material for the SkySphere. 39 float sphereRadius; //!< Radius of the SkySphere. This should match the frustum maximum range. 33 Material *material; //!< A Material for the Skybox. 34 float size; //!< Radius of the Skybox. This should match the frustum maximum range. 40 35 41 void initialize(char* fileName);42 36 }; 43 37 44 #endif /* _SKY SPHERE_H */38 #endif /* _SKYBOX_H */ 45 39 46 40
Note: See TracChangeset
for help on using the changeset viewer.