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
00023
00024 #ifndef GLC_FRUSTUM_H_
00025 #define GLC_FRUSTUM_H_
00026
00027 #include "../maths/glc_plane.h"
00028 #include "../glc_boundingbox.h"
00029 #include "../glc_config.h"
00030
00031 class GLC_LIB_EXPORT GLC_Viewport;
00032
00035
00038
00039 class GLC_LIB_EXPORT GLC_Frustum
00040 {
00041 private:
00042 enum planeId
00043 {
00044 LeftPlane= 0,
00045 RightPlane= 1,
00046 TopPlane= 2,
00047 BottomPlane= 3,
00048 NearPlane= 4,
00049 FarPlane= 5
00050 };
00051 public:
00052 enum Localisation
00053 {
00054 InFrustum = 0,
00055 IntersectFrustum = 1,
00056 OutFrustum= 3
00057 };
00059
00061
00062 public:
00064 GLC_Frustum();
00065
00067 GLC_Frustum(const GLC_Frustum&);
00068
00070 ~GLC_Frustum();
00072
00074
00076
00077 public:
00078
00080 inline GLC_Plane leftClippingPlane() const
00081 {return m_PlaneList.at(LeftPlane);}
00082
00084 inline GLC_Plane rightClippingPlane() const
00085 {return m_PlaneList.at(RightPlane);}
00086
00088 inline GLC_Plane topClippingPlane() const
00089 {return m_PlaneList.at(TopPlane);}
00090
00092 inline GLC_Plane bottomClippingPlane() const
00093 {return m_PlaneList.at(BottomPlane);}
00094
00096 inline GLC_Plane nearClippingPlane() const
00097 {return m_PlaneList.at(NearPlane);}
00098
00100 inline GLC_Plane farClippingPlane() const
00101 {return m_PlaneList.at(FarPlane);}
00102
00104 Localisation localizeBoundingBox(const GLC_BoundingBox&) const;
00105
00107 Localisation localizeSphere(const GLC_Point3d&, double) const;
00108
00110
00112
00114
00115 public:
00116
00118 inline void setLeftClippingPlane(const GLC_Plane& plane)
00119 {m_PlaneList[LeftPlane]= plane;}
00120
00122 inline void setRightClippingPlane(const GLC_Plane& plane)
00123 {m_PlaneList[RightPlane]= plane;}
00124
00126 inline void setTopClippingPlane(const GLC_Plane& plane)
00127 {m_PlaneList[TopPlane]= plane;}
00128
00130 inline void setBottomClippingPlane(const GLC_Plane& plane)
00131 {m_PlaneList[BottomPlane]= plane;}
00132
00134 inline void setNearClippingPlane(const GLC_Plane& plane)
00135 {m_PlaneList[NearPlane]= plane;}
00136
00138 inline void setFarClippingPlane(const GLC_Plane& plane)
00139 {m_PlaneList[FarPlane]= plane;}
00140
00142
00143 bool update(const GLC_Matrix4x4&);
00144
00146
00147
00149 private:
00151 Localisation localizeSphereToPlane(const GLC_Point3d&, double, const GLC_Plane&) const;
00152
00154
00156 private:
00157
00159 QList<GLC_Plane> m_PlaneList;
00160
00162 GLC_Matrix4x4 m_PreviousMatrix;
00163 };
00164
00165 #endif