123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
-
-
- #ifndef _VIEWVOLUME_H_
- #define _VIEWVOLUME_H_
-
- #include "math/Matrix.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(float x, float y, float z);
-
-
-
- bool isSphereInFrustum(float x, float y, float z, float radius);
-
-
-
- bool isBboxInFrustum(float min[3], float max[3]);
-
-
-
- float getDistToSphereFromNear(float x, float y, float z, float radius);
-
-
-
- float getDistToBboxFromNear(const float min[3], const float max[3]);
-
-
-
- void getFrustum(float frustum[6][4]);
-
-
-
- void getPlane(ViewVolumeSide p, float plane[4]);
-
-
-
- void updateFrame(float proj[16], float mdl[16]);
-
-
-
- void updateFrame();
-
-
-
- void setModel(float mdl[16]);
-
-
-
- void setProjection(float proj[16]);
-
- private:
-
-
-
- void updateClip();
-
-
-
- void updateFrustum();
-
- Matrix mProjection;
- Matrix mModel;
- Matrix mClip;
- float mFrustum[6][4];
- };
-
- #endif
|