| 1 | /*! | 
|---|
| 2 |  * @file skybox.h | 
|---|
| 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. | 
|---|
| 7 | */ | 
|---|
| 8 |  | 
|---|
| 9 | #ifndef _SKYBOX_H | 
|---|
| 10 | #define _SKYBOX_H | 
|---|
| 11 |  | 
|---|
| 12 | /* INCLUDES */ | 
|---|
| 13 | #include "world_entity.h" | 
|---|
| 14 |  | 
|---|
| 15 | /* FORWARD DECLARATION */ | 
|---|
| 16 | class Material; | 
|---|
| 17 | class Texture; | 
|---|
| 18 |  | 
|---|
| 19 | //! A Class to handle a SkyBox | 
|---|
| 20 | class SkyBox : public WorldEntity | 
|---|
| 21 | { | 
|---|
| 22 |  public: | 
|---|
| 23 |   SkyBox(const char* fileName = NULL); | 
|---|
| 24 |   SkyBox(const TiXmlElement* root); | 
|---|
| 25 |  | 
|---|
| 26 |   virtual ~SkyBox(); | 
|---|
| 27 |  | 
|---|
| 28 |   void init(); | 
|---|
| 29 |   void preInit(); | 
|---|
| 30 |  | 
|---|
| 31 |   virtual void loadParams(const TiXmlElement* root); | 
|---|
| 32 |  | 
|---|
| 33 |   void postInit(); | 
|---|
| 34 |  | 
|---|
| 35 |  | 
|---|
| 36 |   void setSize(float size); | 
|---|
| 37 |   /** assumes jpg as input-format */ | 
|---|
| 38 |   void setTexture(const char* name) { if (textureName) delete[] textureName; textureName = new char[strlen(name)+1]; strcpy(textureName, name); this->setTextureAndType (name, "jpg"); }; | 
|---|
| 39 |  | 
|---|
| 40 |   void setTextureAndType(const char* name, const char* extension); | 
|---|
| 41 |   void setTextures(const char* top, const char* bottom, const char* left, | 
|---|
| 42 |                    const char* right, const char* front, const char* back); | 
|---|
| 43 |  | 
|---|
| 44 |   void loadCubeMapTextures(const char* top, const char* bottom, const char* left, | 
|---|
| 45 |                            const char* right, const char* front, const char* back); | 
|---|
| 46 |  | 
|---|
| 47 |   static void enableCubeMap(); | 
|---|
| 48 |   static void disableCubeMap(); | 
|---|
| 49 |  | 
|---|
| 50 |   virtual int       writeBytes(const byte* data, int length, int sender); | 
|---|
| 51 |   virtual int       readBytes(byte* data, int maxLength, int * reciever); | 
|---|
| 52 |   virtual void      writeDebug() const; | 
|---|
| 53 |   virtual void      readDebug() const; | 
|---|
| 54 |  | 
|---|
| 55 |  private: | 
|---|
| 56 |   void rebuild(); | 
|---|
| 57 |  | 
|---|
| 58 |   Material*       material[6];     //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back | 
|---|
| 59 |   Texture*        cubeTexture[6];  //!< Textures for the CubeMap. | 
|---|
| 60 |  | 
|---|
| 61 |   float           size;            //!< Size of the SkyBox. This should match the frustum maximum range. | 
|---|
| 62 |   char*           textureName;     //!< Name of the Texture | 
|---|
| 63 |  | 
|---|
| 64 | }; | 
|---|
| 65 |  | 
|---|
| 66 | #endif  /* _SKYBOX_H */ | 
|---|
| 67 |  | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|