1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/**
\file G3D/Frustum.h
\maintainer Morgan McGuire, http://graphics.cs.williams.edu
\created 2005-07-20
\edited 2013-06-11
*/
#ifndef G3D_Frustum_h
#define G3D_Frustum_h
#include "G3D/platform.h"
#include "G3D/g3dmath.h"
#include "G3D/Plane.h"
#include "G3D/SmallArray.h"
#include "G3D/Vector4.h"
namespace G3D {
class Box;
/** \see Projection */
class Frustum {
public:
class Face {
public:
/** Counter clockwise indices into vertexPos */
int vertexIndex[4];
/** The plane containing the face. */
Plane plane;
};
/** The vertices, in homogeneous space. The order is that of
the near face, starting from the (object space) +x,+y corner
and proceeding CCW from the camera's point of view; followed
by the far face also in CCW order.
If w == 0,
a vertex is at infinity. */
SmallArray<Vector4, 8> vertexPos;
/** The faces in the frustum. When the
far plane is at infinity, there are 5 faces,
otherwise there are 6. The faces are in the order
N,R,L,B,T,[F].
*/
SmallArray<Face, 6> faceArray;
/** \param minObjectSpaceDepth Smallest value permitted for the near plane Z - far plane Z (e.g., to force finite bounds)*/
Box boundingBox(float minObjectSpaceDepth = finf()) const;
};
} // namespace G3D
#endif
|