]> Dogcows Code - chaz/yoink/blob - src/Moof/Frustum.hh
destroyed global classes; view hierarchy instead
[chaz/yoink] / src / Moof / Frustum.hh
1
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
4 *
5 * vi:ts=4 sw=4 tw=75
6 *
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
9 *
10 **************************************************************************/
11
12 #ifndef _MOOF_FRUSTUM_HH_
13 #define _MOOF_FRUSTUM_HH_
14
15 #include <Moof/Math.hh>
16 #include <Moof/Plane.hh>
17
18
19 namespace Mf {
20
21
22 template <int D> class Aabb;
23 template <int D> class Sphere;
24
25 class Frustum
26 {
27 Plane mPlanes[6]; // left, right, bottom, top, near, far
28
29 public:
30 typedef enum
31 {
32 OUTSIDE = 0,
33 INSIDE = 1,
34 INTERSECT = 2
35 } Collision;
36
37 Frustum() {}
38 Frustum(const Matrix4& modelview, const Matrix4& projection)
39 {
40 init(modelview, projection);
41 }
42 Frustum(const Matrix4& modelview, Scalar fovy, Scalar aspect,
43 Scalar abutting, Scalar distant)
44 {
45 init(modelview, fovy, aspect, abutting, distant);
46 }
47
48 void init(const Matrix4& modelview, const Matrix4& projection);
49 void init(const Matrix4& modelview, Scalar fovy, Scalar aspect,
50 Scalar abutting, Scalar distant);
51
52 Collision contains(const Aabb<3>& aabb) const;
53 Collision contains(const Sphere<3>& sphere) const;
54 };
55
56
57 } // namespace Mf
58
59 #endif // _MOOF_FRUSTUM_HH_
60
This page took 0.034312 seconds and 4 git commands to generate.