123456789101112131415161718192021222324252627282930313233343536 |
- #ifndef FRUSTUM_H
- #define FRUSTUM_H
- #include "data/Array.h"
- #include "math/Matrix.h"
- #include "math/Plane.h"
- #include "utils/StringBuffer.h"
- class Frustum final {
- Matrix projection;
- Array<Plane, 6> planes;
- public:
- float fieldOfView;
- 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;
- template<int L>
- void toString(StringBuffer<L>& s) const {
- s.append("(fieldOfView = ").append(fieldOfView);
- s.append(", nearClip = ").append(nearClip);
- s.append(", farClip = ").append(farClip);
- s.append(')');
- }
- };
- #endif
|