| [4597] | 1 | /*! | 
|---|
| [5039] | 2 |  * @file skybox.h | 
|---|
| [5357] | 3 |  *  Definition of the SkyBox, that handles the Display of an atmosphere for orxonox. | 
|---|
 | 4 |  * | 
|---|
 | 5 |  * A SkyBox is always centered at the current working Camera, and will only obey the cameras | 
|---|
 | 6 |  * movment but not its rotation. | 
|---|
| [3416] | 7 | */ | 
|---|
 | 8 |  | 
|---|
| [3796] | 9 | #ifndef _SKYBOX_H | 
|---|
 | 10 | #define _SKYBOX_H | 
|---|
| [3416] | 11 |  | 
|---|
| [3419] | 12 | /* INCLUDES */ | 
|---|
| [3502] | 13 | #include "world_entity.h" | 
|---|
| [6771] | 14 | #include "material.h" | 
|---|
| [3411] | 15 |  | 
|---|
| [6771] | 16 | enum SKY_SIDE | 
|---|
 | 17 | { | 
|---|
| [7328] | 18 |   SKY_BACK = 0, | 
|---|
 | 19 |   SKY_FRONT, | 
|---|
| [6771] | 20 |   SKY_BOTTOM, | 
|---|
| [7328] | 21 |   SKY_TOP, | 
|---|
| [6771] | 22 |   SKY_LEFT, | 
|---|
 | 23 |   SKY_RIGHT, | 
|---|
 | 24 | }; | 
|---|
| [3419] | 25 |  | 
|---|
| [3807] | 26 | //! A Class to handle a SkyBox | 
|---|
| [3796] | 27 | class SkyBox : public WorldEntity | 
|---|
| [3411] | 28 | { | 
|---|
| [9869] | 29 |   ObjectListDeclaration(SkyBox); | 
|---|
 | 30 | public: | 
|---|
| [7221] | 31 |   SkyBox(const std::string& fileName = ""); | 
|---|
| [4261] | 32 |   SkyBox(const TiXmlElement* root); | 
|---|
| [4010] | 33 |  | 
|---|
| [3796] | 34 |   virtual ~SkyBox(); | 
|---|
| [3419] | 35 |  | 
|---|
| [5357] | 36 |   void init(); | 
|---|
| [4746] | 37 |   void preInit(); | 
|---|
| [4680] | 38 |  | 
|---|
| [6512] | 39 |   virtual void loadParams(const TiXmlElement* root); | 
|---|
| [4261] | 40 |  | 
|---|
| [4746] | 41 |   void postInit(); | 
|---|
| [4010] | 42 |  | 
|---|
| [6634] | 43 |   virtual void draw(); | 
|---|
| [10259] | 44 |   virtual void tick(float dt); | 
|---|
| [4012] | 45 |  | 
|---|
| [3796] | 46 |   void setSize(float size); | 
|---|
| [4998] | 47 |   /** assumes jpg as input-format */ | 
|---|
| [7221] | 48 |   void setTexture(const std::string& name); | 
|---|
| [4680] | 49 |  | 
|---|
| [7221] | 50 |   void setTextureAndType(const std::string& name, const std::string& extension); | 
|---|
| [7328] | 51 |   void setTextures(const std::string& negX, const std::string& posX, const std::string& negY, | 
|---|
 | 52 |                    const std::string& posY, const std::string& negZ, const std::string& posZ); | 
|---|
| [3420] | 53 |  | 
|---|
| [7328] | 54 |   void loadCubeMapTextures(const std::string& negX, const std::string& posX, const std::string& negY, | 
|---|
 | 55 |                            const std::string& posY, const std::string& negZ, const std::string& posZ); | 
|---|
| [6470] | 56 |  | 
|---|
| [8619] | 57 |   GLuint getTexture(SKY_SIDE side) const { return (this->material[side]) ? this->material[side]->diffuseTextureID(): 0; }; | 
|---|
| [6771] | 58 |  | 
|---|
| [6470] | 59 |   static void enableCubeMap(); | 
|---|
 | 60 |   static void disableCubeMap(); | 
|---|
 | 61 |  | 
|---|
| [7954] | 62 |   virtual void varChangeHandler( std::list<int> & id ); | 
|---|
| [6341] | 63 |  | 
|---|
| [3801] | 64 |  private: | 
|---|
 | 65 |   void rebuild(); | 
|---|
 | 66 |  | 
|---|
| [6307] | 67 |   Material*       material[6];     //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back | 
|---|
| [9869] | 68 |   Texture         cubeTexture[6];  //!< Textures for the CubeMap. | 
|---|
| [6470] | 69 |  | 
|---|
| [4597] | 70 |   float           size;            //!< Size of the SkyBox. This should match the frustum maximum range. | 
|---|
| [6634] | 71 |   float           textureSize;     //!< this is the length of a texture (assumes a square texture) | 
|---|
| [7221] | 72 |   std::string     textureName;     //!< Name of the Texture | 
|---|
| [8619] | 73 |  | 
|---|
| [7954] | 74 |   int textureName_handle;          //!< used to notify about changes of textureName | 
|---|
 | 75 |   int size_handle;                 //!< used to notify about changes of size | 
|---|
| [4597] | 76 |  | 
|---|
| [3411] | 77 | }; | 
|---|
 | 78 |  | 
|---|
| [3796] | 79 | #endif  /* _SKYBOX_H */ | 
|---|
| [3411] | 80 |  | 
|---|
 | 81 |  | 
|---|
| [3484] | 82 |  | 
|---|