]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/clouds3d/SkyRenderable.hpp
Clouds3D crashes because there is no Light
[simgear.git] / simgear / scene / sky / clouds3d / SkyRenderable.hpp
1 //------------------------------------------------------------------------------
2 // File : SkyRenderable.hpp
3 //------------------------------------------------------------------------------
4 // SkyWorks : Copyright 2002 Mark J. Harris and
5 //                                              The University of North Carolina at Chapel Hill
6 //------------------------------------------------------------------------------
7 // Permission to use, copy, modify, distribute and sell this software and its 
8 // documentation for any purpose is hereby granted without fee, provided that 
9 // the above copyright notice appear in all copies and that both that copyright 
10 // notice and this permission notice appear in supporting documentation. 
11 // Binaries may be compiled with this software without any royalties or 
12 // restrictions. 
13 //
14 // The author(s) and The University of North Carolina at Chapel Hill make no 
15 // representations about the suitability of this software for any purpose. 
16 // It is provided "as is" without express or 
17 // implied warranty.
18 //------------------------------------------------------------------------------
19 // File : SkyRenderable.hpp
20 //------------------------------------------------------------------------------
21 // Sky  : Copyright 2002 Mark J. Harris and Andrew Zaferakis
22 //------------------------------------------------------------------------------
23 /**
24  * @file SkyRenderable.hpp
25  *
26  * Abstract base class definition for SkyRenderable, a renderable object class.
27  */ 
28 #ifndef __SKYRENDERABLE_HPP__
29 #define __SKYRENDERABLE_HPP__
30
31 #pragma warning( disable : 4786)
32
33 #include <string>
34
35 #include "SkyUtil.hpp"
36
37 // forward to reduce unnecessary dependencies
38 class SkyMinMaxBox;
39 class SkyRenderableInstance;
40 class Camera;
41
42 //------------------------------------------------------------------------------
43 /**
44  * @class SkyRenderable
45  * @brief An base class for renderable objects.
46  * 
47  * Each SkyRenderable object should know how to Display itself, however some
48  * objects may not have a bounding volume that is useful (skybox, etc.)
49  */
50 class SkyRenderable
51 {
52 public:
53   //! Constructor
54   SkyRenderable() {}
55   //! Destructor
56   virtual ~SkyRenderable() { }
57
58   //------------------------------------------------------------------------------
59   // Function             :                      SetName
60   // Description            : 
61   //------------------------------------------------------------------------------
62   /**
63   * @fn                      SetName(const std::string &name)
64   * @brief Set a name for this renderable.
65   */ 
66   void                        SetName(const std::string &name) { _name = name; }
67
68   //------------------------------------------------------------------------------
69   // Function             :         GetName
70   // Description            : 
71   //------------------------------------------------------------------------------
72   /**
73   * @fn         GetName() const
74   * @brief Get the name of this renderable.
75   */ 
76   const std::string&          GetName() const                  { return _name; }
77   
78   //------------------------------------------------------------------------------
79   // Function             : Update
80   // Description            : 
81   //------------------------------------------------------------------------------
82   /**
83    * @fn Update(const Camera &cam, SkyRenderableInstance *pInstance)
84    * @brief Update the state of the renderable.
85    * 
86    * This method is optional, as some renderables will need periodic updates
87    * (i.e. for animation) and others will not.
88    */ 
89   virtual SKYRESULT           Update(const Camera &cam, SkyRenderableInstance *pInstance = NULL)
90                               { return SKYRESULT_OK;  }
91   
92   //------------------------------------------------------------------------------
93   // Function             : Display
94   // Description            : 
95   //------------------------------------------------------------------------------
96   /**
97    * @fn Display(const Camera &cam, SkyRenderableInstance *pInstance)
98    * @brief Display the object.
99    */ 
100   virtual SKYRESULT           Display(const Camera &cam, SkyRenderableInstance *pInstance = NULL) = 0;
101
102   //------------------------------------------------------------------------------
103   // Function             : CopyBoundingVolume
104   // Description            : 
105   //------------------------------------------------------------------------------
106   /**
107    * @fn CopyBoundingVolume() const
108    * @brief Create a copy of the object's bounding volume, useful for collision, VFC, etc.
109    */ 
110   virtual SkyMinMaxBox*       CopyBoundingVolume() const = 0;// { return 0; }
111
112 protected:
113   std::string         _name; // the name of this renderable.
114 };
115
116 #endif //__SKYRENDERABLE_HPP__