]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/clouds3d/SkyBoundingVolume.hpp
Clouds3D crashes because there is no Light
[simgear.git] / simgear / scene / sky / clouds3d / SkyBoundingVolume.hpp
1 //------------------------------------------------------------------------------
2 // File : SkyBoundingVolume.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 SkyBoundingVolume.hpp
20  * 
21  * Base class interface definition for a bounding volume.
22  */
23 #ifndef __SKYBOUNDINGVOLUME_HPP__
24 #define __SKYBOUNDINGVOLUME_HPP__
25
26 #include "vec3f.hpp"
27 #include "mat44.hpp"
28
29 // forward to reduce unnecessary dependencies
30 class Camera;
31
32 //------------------------------------------------------------------------------
33 /**
34  * @class SkyBoundingVolume
35  * @brief An abstract base class for bounding volumes (AABB,OBB,Sphere,etc.)
36  *
37  * This base class maintains a center and a radius, so it is effectively a bounding
38  * sphere.  Derived classes may represent other types of bounding volumes, but they 
39  * should be sure to update the radius and center, because some objects will treat
40  * all bounding volumes as spheres.
41  *
42  */
43 class SkyBoundingVolume
44 {
45 public:
46   //! Constructor
47   SkyBoundingVolume() : _vecCenter(0, 0, 0), _rRadius(0) {}
48   //! Destructor
49   virtual ~SkyBoundingVolume() {}
50
51
52   //------------------------------------------------------------------------------
53   // Function             : SetCenter
54   // Description            : 
55   //------------------------------------------------------------------------------
56   /**
57    * @fn SetCenter(const Vec3f &center)
58    * @brief Sets the center of the bounding volume.
59    */ 
60   virtual void SetCenter(const Vec3f &center)               { _vecCenter = center; }
61   
62
63   //------------------------------------------------------------------------------
64   // Function             : SetRadius
65   // Description            : 
66   //------------------------------------------------------------------------------
67   /**
68    * @fn SetRadius(float radius)
69    * @brief Sets the radius of the bounding volume.
70    */ 
71   virtual void SetRadius(float radius)                      { _rRadius = radius;   }
72
73
74   //------------------------------------------------------------------------------
75   // Function             : Vec3f& GetCenter
76   // Description            : 
77   //------------------------------------------------------------------------------
78   /**
79    * @fn Vec3f& GetCenter() const
80    * @brief Returns the center of the bounding volume.
81    */ 
82   virtual const Vec3f& GetCenter() const                    { return _vecCenter;   }
83
84
85   //------------------------------------------------------------------------------
86   // Function             : GetRadius
87   // Description            : 
88   //------------------------------------------------------------------------------
89   /**
90    * @fn GetRadius() const
91    * @brief Returns the radius ofthe bounding volume.
92    */ 
93   virtual float GetRadius() const                           { return _rRadius;     }
94
95   //------------------------------------------------------------------------------
96   // Function             : ViewFrustumCull
97   // Description            : 
98   //------------------------------------------------------------------------------
99   /**
100    * @fn ViewFrustumCull( const Camera &cam, const Mat44f &mat )
101    * @brief Cull a bounding volume.
102    * 
103    * Returns false if the bounding volume is entirely outside the camera's frustum,
104    * true otherwise.
105    */ 
106   virtual bool ViewFrustumCull( const Camera &cam, const Mat44f &mat ) = 0;
107
108   //------------------------------------------------------------------------------
109   // Function             : AddPoint
110   // Description            : 
111   //------------------------------------------------------------------------------
112   /*
113    * @fn AddPoint( const Vec3f &pt )
114    * @brief Add a point to a bounding volume.
115    * 
116    * One way to create a bounding volume is to add points.  What should/could happen 
117    * is that the BV will store an object space BV and then when a call to SetPosition 
118    * is called, the stored values will be transformed and stored separately, so that 
119    * the original values always exist.
120    *
121    */ 
122   //virtual void AddPoint( const Vec3f &point )  = 0;
123   
124   //------------------------------------------------------------------------------
125   // Function             : AddPoint
126   // Description            : 
127   //------------------------------------------------------------------------------
128   /*
129    * @fn AddPoint( float x, float y, float z )
130    * @brief Add a point to a bounding volume.
131    * 
132    * @see AddPoint(const Vec3f &pt)
133    */ 
134   //virtual void AddPoint( float x, float y, float z ) = 0;
135
136   //------------------------------------------------------------------------------
137   // Function             : Clear
138   // Description            : 
139   //------------------------------------------------------------------------------
140   /*
141    * @fn Clear()
142    * @brief Clear all data from the bounding volume.
143    */ 
144   //virtual void Clear() = 0;
145
146 protected:
147   Vec3f        _vecCenter;
148   float        _rRadius;
149 };
150
151 #endif //__SKYBOUNDINGVOLUME_HPP__