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