Go to the documentation of this file.00001
00002
00003 #ifndef _FRUSTUM_H_
00004 #define _FRUSTUM_H_
00005
00006 #include <EngineConfig.h>
00007 #include <core/Types.h>
00008 #include <core/Plane3d.h>
00009 #include <core/Vector3d.h>
00010
00011 namespace core
00012 {
00013 class matrix4;
00014 class sphere3d;
00015 class aabox3d;
00016 }
00017
00018 namespace render
00019 {
00020
00021 enum ProjectionType;
00022
00024 enum FrustumPlane
00025 {
00026 FRUSTUM_PLANE_NEAR = 0,
00027 FRUSTUM_PLANE_FAR = 1,
00028 FRUSTUM_PLANE_LEFT = 2,
00029 FRUSTUM_PLANE_RIGHT = 3,
00030 FRUSTUM_PLANE_TOP = 4,
00031 FRUSTUM_PLANE_BOTTOM = 5
00032 };
00033
00037 class ENGINE_PUBLIC_EXPORT Frustum
00038 {
00039 public:
00040
00041 Frustum();
00042
00043 ~Frustum();
00044
00046 void buildViewFrustum(const core::matrix4& projMat, const core::matrix4& viewMat, ProjectionType projType, f32 fov, f32 aspect, f32 near, f32 far);
00047
00050 void transform(const core::matrix4& mat);
00051
00052 const core::vector3d* getCorners();
00053
00055 bool isVisible(const core::vector3d& point);
00056
00058 bool isVisible(const core::sphere3d& sphere);
00059
00061 bool isVisible(const core::aabox3d& box);
00062
00063 protected:
00064
00065 core::plane3d mPlanes[6];
00066 core::vector3d mCorners[8];
00067 };
00068
00069 }
00070
00071 #endif