123456789101112131415161718192021222324252627282930313233343536 |
- #ifndef CORE_FRUSTUM_HPP
- #define CORE_FRUSTUM_HPP
- #include "core/data/Array.hpp"
- #include "core/math/Matrix.hpp"
- #include "core/math/Plane.hpp"
- namespace Core {
- class Frustum final {
- Matrix projection;
- Array<Plane, 6> planes;
- public:
- float tan;
- float nearClip;
- float farClip;
- Frustum(float fieldOfView, float nearClip, float farClip);
- const Matrix& updateProjection(const IntVector2& size);
- void updatePlanes(const Vector3& pos, const Vector3& right,
- const Vector3& up, const Vector3& front,
- const IntVector2& size);
- bool isInside(const Vector3& pos) const;
- bool isInside(const Vector3& pos, float radius) const;
- void toString(BufferString& s) const {
- s.append("(tan = ").append(tan);
- s.append(", nearClip = ").append(nearClip);
- s.append(", farClip = ").append(farClip);
- s.append(')');
- }
- };
- }
- #endif
|