]> Dogcows Code - chaz/yoink/blob - src/moof/frustum.hh
remove some unused stlplus modules
[chaz/yoink] / src / moof / frustum.hh
1
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
4 *
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
7 *
8 *****************************************************************************/
9
10 #ifndef _MOOF_FRUSTUM_HH_
11 #define _MOOF_FRUSTUM_HH_
12
13 /**
14 * \file frustum.hh
15 * All things related to frustums!
16 */
17
18 #include <moof/math.hh>
19 #include <moof/plane.hh>
20
21 namespace moof {
22
23 template <int D> class aabb;
24 template <int D> class sphere;
25
26 /**
27 * A six-sided volume for representing the space visible by a position looking
28 * outward.
29 */
30 class frustum
31 {
32 public:
33
34 enum collision
35 {
36 outside = 0,
37 inside = 1,
38 intersecting = 2
39 };
40
41 frustum() {}
42 frustum(const matrix4& modelview, const matrix4& projection)
43 {
44 init(modelview, projection);
45 }
46 frustum(const matrix4& modelview, scalar fovy, scalar aspect,
47 scalar abutting, scalar distant)
48 {
49 init(modelview, fovy, aspect, abutting, distant);
50 }
51
52 void init(const matrix4& modelview, const matrix4& projection);
53 void init(const matrix4& modelview, scalar fovy, scalar aspect,
54 scalar abutting, scalar distant);
55
56 collision contains(const aabb<3>& aabb) const;
57 collision contains(const sphere<3>& sphere) const;
58
59 private:
60
61 plane planes_[6]; // left, right, bottom, top, near, far
62 };
63
64 } // namespace moof
65
66 #endif // _MOOF_FRUSTUM_HH_
67
This page took 0.030702 seconds and 4 git commands to generate.