00001 /* 00002 * Bounding volume header 00003 * 00004 * This file is part of the "SoftPixel Engine" (Copyright (c) 2008 by Lukas Hermanns) 00005 * See "SoftPixelEngine.hpp" for license information. 00006 */ 00007 00008 #ifndef __SP_SCENE_BOUNDINGVOLUME_H__ 00009 #define __SP_SCENE_BOUNDINGVOLUME_H__ 00010 00011 00012 #include "Base/spStandard.hpp" 00013 #include "Base/spDimension.hpp" 00014 #include "Base/spMath.hpp" 00015 #include "Base/spViewFrustum.hpp" 00016 00017 00018 namespace sp 00019 { 00020 namespace scene 00021 { 00022 00023 00025 enum EBoundingVolumes 00026 { 00027 BOUNDING_NONE, 00028 BOUNDING_SPHERE, 00029 BOUNDING_BOX, 00030 }; 00031 00032 00033 class SP_EXPORT BoundingVolume 00034 { 00035 00036 public: 00037 00038 BoundingVolume(); 00039 BoundingVolume(const BoundingVolume &Other); 00040 ~BoundingVolume(); 00041 00042 /* === Functions === */ 00043 00051 bool checkFrustumCulling(const scene::ViewFrustum &Frustum, const dim::matrix4f &Transformation) const; 00052 00053 /* === Inline functions === */ 00054 00061 inline void setType(const EBoundingVolumes Type) 00062 { 00063 Type_ = Type; 00064 } 00065 inline EBoundingVolumes getType() const 00066 { 00067 return Type_; 00068 } 00069 00074 inline void setBox(const dim::aabbox3df &BoundBox) 00075 { 00076 Box_ = BoundBox; 00077 } 00078 inline const dim::aabbox3df& getBox() const 00079 { 00080 return Box_; 00081 } 00082 00084 inline void setRadius(const f32 Radius) 00085 { 00086 Radius_ = Radius; 00087 } 00088 inline f32 getRadius() const 00089 { 00090 return Radius_; 00091 } 00092 00093 private: 00094 00095 /* === Members === */ 00096 00097 EBoundingVolumes Type_; 00098 dim::aabbox3df Box_; 00099 f32 Radius_; 00100 00101 }; 00102 00103 00104 } // /namespace scene 00105 00106 } // /namespace sp 00107 00108 00109 #endif 00110 00111 00112 00113 // ================================================================================