mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Frustum.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 // global definitions
9 #include "Structures.h" // CullingLocation, FrustumInformation
10 
11 // includes for mathematical objects
12 #include "Plane.h" // plane object
13 #include "Vector3.h" // vector object
14 #include "CameraObject.h" // camera object
15 
17 
26 class Frustum {
27 public:
28  Frustum( FrustumInformation frustum );
29  ~Frustum( void );
30  void update( CameraObject *camera );
31 
32  float Frustum::getFrustumWidth( float dist );
33  float Frustum::getFrustumHeight( float dist );
35  CullingLocation isSphereInFrustum( const Vector3 &p, float radius );
36  bool isInUpperHalf( const Vector3 &p );
37  bool isInRightHalf( const Vector3 &p );
39 private:
40  enum {// enumeration that give's us easy access to the planes array
41  topPlane = 0,
42  bottomPlane,
43  leftPlane,
44  rightPlane,
45  nearPlane,
46  farPlane
47  };
48  Plane planes[6]; // array for the six bording planes of the frustum
49 
50  // declaration of the 8 edges of the frustum
51  Vector3 farTopLeft;
52  Vector3 farTopRight;
53  Vector3 farBottomLeft;
54  Vector3 farBottomRight;
55  Vector3 nearTopLeft;
56  Vector3 nearTopRight;
57  Vector3 nearBottomLeft;
58  Vector3 nearBottomRight;
59 
60  FrustumInformation frustum;
61 };