[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" |
---|
[3411] | 14 | |
---|
[5405] | 15 | /* FORWARD DECLARATION */ |
---|
[5511] | 16 | class Material; |
---|
[6470] | 17 | class Texture; |
---|
[3419] | 18 | |
---|
[3807] | 19 | //! A Class to handle a SkyBox |
---|
[3796] | 20 | class SkyBox : public WorldEntity |
---|
[3411] | 21 | { |
---|
[3416] | 22 | public: |
---|
[4261] | 23 | SkyBox(const char* fileName = NULL); |
---|
| 24 | SkyBox(const TiXmlElement* root); |
---|
[4010] | 25 | |
---|
[3796] | 26 | virtual ~SkyBox(); |
---|
[3419] | 27 | |
---|
[5357] | 28 | void init(); |
---|
[4746] | 29 | void preInit(); |
---|
[4680] | 30 | |
---|
[4261] | 31 | void loadParams(const TiXmlElement* root); |
---|
| 32 | |
---|
[4746] | 33 | void postInit(); |
---|
[4010] | 34 | |
---|
[4012] | 35 | |
---|
[3796] | 36 | void setSize(float size); |
---|
[4998] | 37 | /** assumes jpg as input-format */ |
---|
[6341] | 38 | void setTexture(const char* name) { if (textureName) delete[] textureName; textureName = new char[strlen(name)+1]; strcpy(textureName, name); this->setTextureAndType (name, "jpg"); }; |
---|
[4680] | 39 | |
---|
[4261] | 40 | void setTextureAndType(const char* name, const char* extension); |
---|
[4680] | 41 | void setTextures(const char* top, const char* bottom, const char* left, |
---|
| 42 | const char* right, const char* front, const char* back); |
---|
[3420] | 43 | |
---|
[6470] | 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 | |
---|
[6341] | 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 | |
---|
[3801] | 55 | private: |
---|
| 56 | void rebuild(); |
---|
| 57 | |
---|
[6307] | 58 | Material* material[6]; //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back |
---|
[6470] | 59 | Texture* texture[6]; //!< Textures for the CubeMap. |
---|
| 60 | |
---|
[4597] | 61 | float size; //!< Size of the SkyBox. This should match the frustum maximum range. |
---|
[6341] | 62 | char* textureName; //!< Name of the Texture |
---|
[4597] | 63 | |
---|
[3411] | 64 | }; |
---|
| 65 | |
---|
[3796] | 66 | #endif /* _SKYBOX_H */ |
---|
[3411] | 67 | |
---|
| 68 | |
---|
[3484] | 69 | |
---|