123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
-
-
- #ifndef _VIEWVOLUME_H_
- #define _VIEWVOLUME_H_
-
- #include "math/Matrix.h"
- #include "RoomData.h"
-
-
- class ViewVolume {
- public:
-
-
-
- enum ViewVolumeSide {
- rightSide = 0,
- leftSide = 1,
- bottomSide = 2,
- topSide = 3,
- farSide = 4,
- nearSide = 5
- };
-
-
-
- enum ViewVolumePlane {
- planeA = 0,
- planeB = 1,
- planeC = 2,
- planeD = 3
- };
-
-
-
- ViewVolume();
-
-
-
- bool isPointInFrustum(vec_t x, vec_t y, vec_t z);
-
-
-
- bool isSphereInFrustum(vec_t x, vec_t y, vec_t z, vec_t radius);
-
-
-
- bool isBboxInFrustum(vec3_t min, vec3_t max);
-
-
-
- vec_t getDistToSphereFromNear(vec_t x, vec_t y, vec_t z, vec_t radius);
-
-
-
- vec_t getDistToBboxFromNear(const vec3_t min, const vec3_t max);
-
-
-
- void getFrustum(vec_t frustum[6][4]);
-
-
-
- void getPlane(ViewVolumeSide p, vec4_t plane);
-
-
-
- void updateFrame(matrix_t proj, matrix_t mdl);
-
-
-
- void updateFrame();
-
-
-
- void setModel(matrix_t mdl);
-
-
-
- void setProjection(matrix_t proj);
-
- private:
-
-
-
- void updateClip();
-
-
-
- void updateFrustum();
-
- Matrix mProjection;
- Matrix mModel;
- Matrix mClip;
- vec_t mFrustum[6][4];
- };
-
- #endif
|