[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 | |
---|
[6512] | 31 | virtual void loadParams(const TiXmlElement* root); |
---|
[4261] | 32 | |
---|
[4746] | 33 | void postInit(); |
---|
[4010] | 34 | |
---|
[6634] | 35 | virtual void draw(); |
---|
[4012] | 36 | |
---|
[3796] | 37 | void setSize(float size); |
---|
[4998] | 38 | /** assumes jpg as input-format */ |
---|
[6341] | 39 | void setTexture(const char* name) { if (textureName) delete[] textureName; textureName = new char[strlen(name)+1]; strcpy(textureName, name); this->setTextureAndType (name, "jpg"); }; |
---|
[4680] | 40 | |
---|
[4261] | 41 | void setTextureAndType(const char* name, const char* extension); |
---|
[4680] | 42 | void setTextures(const char* top, const char* bottom, const char* left, |
---|
| 43 | const char* right, const char* front, const char* back); |
---|
[3420] | 44 | |
---|
[6470] | 45 | void loadCubeMapTextures(const char* top, const char* bottom, const char* left, |
---|
| 46 | const char* right, const char* front, const char* back); |
---|
| 47 | |
---|
| 48 | static void enableCubeMap(); |
---|
| 49 | static void disableCubeMap(); |
---|
| 50 | |
---|
[6341] | 51 | virtual int writeBytes(const byte* data, int length, int sender); |
---|
| 52 | virtual int readBytes(byte* data, int maxLength, int * reciever); |
---|
| 53 | virtual void writeDebug() const; |
---|
| 54 | virtual void readDebug() const; |
---|
| 55 | |
---|
[3801] | 56 | private: |
---|
| 57 | void rebuild(); |
---|
| 58 | |
---|
[6307] | 59 | Material* material[6]; //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back |
---|
[6519] | 60 | Texture* cubeTexture[6]; //!< Textures for the CubeMap. |
---|
[6470] | 61 | |
---|
[4597] | 62 | float size; //!< Size of the SkyBox. This should match the frustum maximum range. |
---|
[6634] | 63 | float textureSize; //!< this is the length of a texture (assumes a square texture) |
---|
[6341] | 64 | char* textureName; //!< Name of the Texture |
---|
[4597] | 65 | |
---|
[3411] | 66 | }; |
---|
| 67 | |
---|
[3796] | 68 | #endif /* _SKYBOX_H */ |
---|
[3411] | 69 | |
---|
| 70 | |
---|
[3484] | 71 | |
---|