glc_frustum.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00025
00026 #ifndef GLC_FRUSTUM_H_
00027 #define GLC_FRUSTUM_H_
00028
00029 #include "../maths/glc_plane.h"
00030 #include "../glc_boundingbox.h"
00031 #include "../glc_config.h"
00032
00033 class GLC_LIB_EXPORT GLC_Viewport;
00034
00037
00040
00041 class GLC_LIB_EXPORT GLC_Frustum
00042 {
00043 private:
00044 enum planeId
00045 {
00046 LeftPlane= 0,
00047 RightPlane= 1,
00048 TopPlane= 2,
00049 BottomPlane= 3,
00050 NearPlane= 4,
00051 FarPlane= 5
00052 };
00053 public:
00054 enum Localisation
00055 {
00056 InFrustum = 0,
00057 IntersectFrustum = 1,
00058 OutFrustum= 3
00059 };
00061
00063
00064 public:
00066 GLC_Frustum();
00067
00069 GLC_Frustum(const GLC_Frustum&);
00070
00072 ~GLC_Frustum();
00074
00076
00078
00079 public:
00080
00082 inline GLC_Plane leftClippingPlane() const
00083 {return m_PlaneList.at(LeftPlane);}
00084
00086 inline GLC_Plane rightClippingPlane() const
00087 {return m_PlaneList.at(RightPlane);}
00088
00090 inline GLC_Plane topClippingPlane() const
00091 {return m_PlaneList.at(TopPlane);}
00092
00094 inline GLC_Plane bottomClippingPlane() const
00095 {return m_PlaneList.at(BottomPlane);}
00096
00098 inline GLC_Plane nearClippingPlane() const
00099 {return m_PlaneList.at(NearPlane);}
00100
00102 inline GLC_Plane farClippingPlane() const
00103 {return m_PlaneList.at(FarPlane);}
00104
00106 Localisation localizeBoundingBox(const GLC_BoundingBox&) const;
00107
00109 Localisation localizeSphere(const GLC_Point3d&, double) const;
00110
00112
00114
00116
00117 public:
00118
00120 inline void setLeftClippingPlane(const GLC_Plane& plane)
00121 {m_PlaneList[LeftPlane]= plane;}
00122
00124 inline void setRightClippingPlane(const GLC_Plane& plane)
00125 {m_PlaneList[RightPlane]= plane;}
00126
00128 inline void setTopClippingPlane(const GLC_Plane& plane)
00129 {m_PlaneList[TopPlane]= plane;}
00130
00132 inline void setBottomClippingPlane(const GLC_Plane& plane)
00133 {m_PlaneList[BottomPlane]= plane;}
00134
00136 inline void setNearClippingPlane(const GLC_Plane& plane)
00137 {m_PlaneList[NearPlane]= plane;}
00138
00140 inline void setFarClippingPlane(const GLC_Plane& plane)
00141 {m_PlaneList[FarPlane]= plane;}
00142
00144
00145 bool update(const GLC_Matrix4x4&);
00146
00148
00149
00151 private:
00153 Localisation localizeSphereToPlane(const GLC_Point3d&, double, const GLC_Plane&) const;
00154
00156
00158 private:
00159
00161 QList<GLC_Plane> m_PlaneList;
00162
00164 GLC_Matrix4x4 m_PreviousMatrix;
00165 };
00166
00167 #endif