Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/ODE/src/world_entities/skybox.h @ 10089

Last change on this file since 10089 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 2.2 KB
Line 
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#include "material.h"
15
16enum SKY_SIDE
17{
18  SKY_BACK = 0,
19  SKY_FRONT,
20  SKY_BOTTOM,
21  SKY_TOP,
22  SKY_LEFT,
23  SKY_RIGHT,
24};
25
26//! A Class to handle a SkyBox
27class SkyBox : public WorldEntity
28{
29  ObjectListDeclaration(SkyBox);
30public:
31  SkyBox(const std::string& fileName = "");
32  SkyBox(const TiXmlElement* root);
33
34  virtual ~SkyBox();
35
36  void init();
37  void preInit();
38
39  virtual void loadParams(const TiXmlElement* root);
40
41  void postInit();
42
43  virtual void draw();
44
45  void setSize(float size);
46  /** assumes jpg as input-format */
47  void setTexture(const std::string& name);
48
49  void setTextureAndType(const std::string& name, const std::string& extension);
50  void setTextures(const std::string& negX, const std::string& posX, const std::string& negY,
51                   const std::string& posY, const std::string& negZ, const std::string& posZ);
52
53  void loadCubeMapTextures(const std::string& negX, const std::string& posX, const std::string& negY,
54                           const std::string& posY, const std::string& negZ, const std::string& posZ);
55
56  GLuint getTexture(SKY_SIDE side) const { return (this->material[side]) ? this->material[side]->diffuseTextureID(): 0; };
57
58  static void enableCubeMap();
59  static void disableCubeMap();
60
61  virtual void varChangeHandler( std::list<int> & id );
62
63 private:
64  void rebuild();
65
66  Material*       material[6];     //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back
67  Texture         cubeTexture[6];  //!< Textures for the CubeMap.
68
69  float           size;            //!< Size of the SkyBox. This should match the frustum maximum range.
70  float           textureSize;     //!< this is the length of a texture (assumes a square texture)
71  std::string     textureName;     //!< Name of the Texture
72
73  int textureName_handle;          //!< used to notify about changes of textureName
74  int size_handle;                 //!< used to notify about changes of size
75
76};
77
78#endif  /* _SKYBOX_H */
79
80
81
Note: See TracBrowser for help on using the repository browser.