DeferredRenderer 1.0

Frustum.h

Go to the documentation of this file.
00001 #ifndef FRUSTUM_H
00002 #define FRUSTUM_H
00003 
00004 #include "ngl/Matrix.h"
00005 
00013 // Modified from :-
00014 // Mathieu Sanchez (2010)
00015 class Frustum
00016 {
00017 private:
00018 
00020     struct Plane
00021     {
00022         float a,b,c,d;
00023     };
00024 
00027     enum planeSides{
00028         e_left = 0,
00029         e_right = 1,
00030         e_bottom = 2,
00031         e_top = 3,
00032         e_near = 4,
00033         e_far = 5
00034     };
00035 
00038     enum planeSign{
00039         e_minus = -1,
00040         e_plus = 1
00041     };
00042 
00044     Plane m_planes[6];
00045 
00051     void buildPlane(Plane &io_plane, const ngl::Matrix &_mat, int _row, int _sign);
00052 
00055     void normalizePlane(Plane &_plane);
00056 
00057 public:
00059     Frustum(){}
00060 
00063     void generate(const ngl::Matrix &_mat);
00064 
00068     bool isAbovePlane(unsigned int _planeSide, const ngl::Vector &_point)const;
00069 
00073     bool isInFrustum(const ngl::Vector &_min,const ngl::Vector &_max)const;
00074 
00077     bool isInFrustum(const ngl::Vector &_point)const;
00078 
00079 };
00080 
00081 #endif // FRUSTUM_H
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines