Frustum.pkg 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. $#include "Frustum.h"
  2. enum FrustumPlane
  3. {
  4. PLANE_NEAR = 0,
  5. PLANE_LEFT,
  6. PLANE_RIGHT,
  7. PLANE_UP,
  8. PLANE_DOWN,
  9. PLANE_FAR,
  10. };
  11. static const unsigned NUM_FRUSTUM_PLANES;
  12. static const unsigned NUM_FRUSTUM_VERTICES;
  13. class Frustum
  14. {
  15. Frustum();
  16. Frustum(const Frustum& frustum);
  17. void Define(float fov, float aspectRatio, float zoom, float nearZ, float farZ, const Matrix3x4& transform = Matrix3x4::IDENTITY);
  18. void Define(const Vector3& near, const Vector3& far, const Matrix3x4& transform = Matrix3x4::IDENTITY);
  19. void Define(const BoundingBox& box, const Matrix3x4& transform = Matrix3x4::IDENTITY);
  20. void DefineOrtho(float orthoSize, float aspectRatio, float zoom, float nearZ, float farZ, const Matrix3x4& transform = Matrix3x4::IDENTITY);
  21. void Transform(const Matrix3& transform);
  22. void Transform(const Matrix3x4& transform);
  23. Intersection IsInside(const Vector3& point) const;
  24. Intersection IsInside(const Sphere& sphere) const;
  25. Intersection IsInsideFast(const Sphere& sphere) const;
  26. Intersection IsInside(const BoundingBox& box) const;
  27. Intersection IsInsideFast(const BoundingBox& box) const;
  28. float Distance(const Vector3& point) const;
  29. Frustum Transformed(const Matrix3& transform) const;
  30. Frustum Transformed(const Matrix3x4& transform) const;
  31. Rect Projected(const Matrix4& transform) const;
  32. void UpdatePlanes();
  33. };