GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_frustum.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
23 
24 #ifndef GLC_FRUSTUM_H_
25 #define GLC_FRUSTUM_H_
26 
27 #include "../maths/glc_plane.h"
28 #include "../glc_boundingbox.h"
29 #include "../glc_config.h"
30 
32 
35 
38 
40 {
41 private:
42  enum planeId
43  {
44  LeftPlane= 0,
45  RightPlane= 1,
46  TopPlane= 2,
47  BottomPlane= 3,
48  NearPlane= 4,
49  FarPlane= 5
50  };
51 public:
53  {
54  InFrustum = 0,
55  IntersectFrustum = 1,
56  OutFrustum= 3
57  };
59 
61 
62 public:
64  GLC_Frustum();
65 
67  GLC_Frustum(const GLC_Frustum&);
68 
70  ~GLC_Frustum();
72 
74 
76 
77 public:
78 
80  inline GLC_Plane leftClippingPlane() const
81  {return m_PlaneList.at(LeftPlane);}
82 
84  inline GLC_Plane rightClippingPlane() const
85  {return m_PlaneList.at(RightPlane);}
86 
88  inline GLC_Plane topClippingPlane() const
89  {return m_PlaneList.at(TopPlane);}
90 
92  inline GLC_Plane bottomClippingPlane() const
93  {return m_PlaneList.at(BottomPlane);}
94 
96  inline GLC_Plane nearClippingPlane() const
97  {return m_PlaneList.at(NearPlane);}
98 
100  inline GLC_Plane farClippingPlane() const
101  {return m_PlaneList.at(FarPlane);}
102 
104  Localisation localizeBoundingBox(const GLC_BoundingBox&) const;
105 
107  Localisation localizeSphere(const GLC_Point3d&, double) const;
108 
110 
112 
114 
115 public:
116 
118  inline void setLeftClippingPlane(const GLC_Plane& plane)
119  {m_PlaneList[LeftPlane]= plane;}
120 
122  inline void setRightClippingPlane(const GLC_Plane& plane)
123  {m_PlaneList[RightPlane]= plane;}
124 
126  inline void setTopClippingPlane(const GLC_Plane& plane)
127  {m_PlaneList[TopPlane]= plane;}
128 
130  inline void setBottomClippingPlane(const GLC_Plane& plane)
131  {m_PlaneList[BottomPlane]= plane;}
132 
134  inline void setNearClippingPlane(const GLC_Plane& plane)
135  {m_PlaneList[NearPlane]= plane;}
136 
138  inline void setFarClippingPlane(const GLC_Plane& plane)
139  {m_PlaneList[FarPlane]= plane;}
140 
142 
143  bool update(const GLC_Matrix4x4&);
144 
146 
147 // Private services function
149 private:
151  Localisation localizeSphereToPlane(const GLC_Point3d&, double, const GLC_Plane&) const;
152 
154 // Private Member
156 private:
157 
159  QList<GLC_Plane> m_PlaneList;
160 
163 };
164 
165 #endif /* GLC_FRUSTUM_H_ */

©2005-2013 Laurent Ribon