00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _FRUSTUM_H_
00011 #define _FRUSTUM_H_
00012
00013 #include <celmath/plane.h>
00014
00015
00016 class Frustum
00017 {
00018 public:
00019 Frustum(float fov, float aspectRatio, float nearDist);
00020 Frustum(float fov, float aspectRatio, float nearDist, float farDist);
00021
00022 void transform(const Mat3f&);
00023 void transform(const Mat4f&);
00024
00025 inline Planef getPlane(int) const;
00026
00027 enum {
00028 Bottom = 0,
00029 Top = 1,
00030 Left = 2,
00031 Right = 3,
00032 Near = 4,
00033 Far = 5,
00034 };
00035
00036 enum Aspect {
00037 Outside = 0,
00038 Inside = 1,
00039 Intersect = 2,
00040 };
00041
00042 Aspect test(const Point3f&) const;
00043 Aspect testSphere(const Point3f& center, float radius) const;
00044 Aspect testSphere(const Point3d& center, double radius) const;
00045
00046 private:
00047 void init(float, float, float, float);
00048
00049 Planef planes[6];
00050 bool infinite;
00051 };
00052
00053 Planef Frustum::getPlane(int which) const
00054 {
00055 return planes[which];
00056 }
00057
00058 #endif // _FRUSTUM_H_