1234567891011121314151617181920212223242526272829303132333435363738 |
- #ifndef CORE_FRUSTUM_H
- #define CORE_FRUSTUM_H
- #include "data/Array.h"
- #include "math/Matrix.h"
- #include "math/Plane.h"
- 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;
- // returns true on error and calls the error callback
- template<int L>
- check_return bool toString(ArrayString<L>& s) const {
- return s.append("(tan = ") || s.append(tan) ||
- s.append(", nearClip = ") || s.append(nearClip) ||
- s.append(", farClip = ") || s.append(farClip) ||
- s.append(')');
- }
- };
- }
- #endif
|