1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef CORE_FRUSTUM_HPP
- #define CORE_FRUSTUM_HPP
- #include "data/Array.hpp"
- #include "math/Matrix.hpp"
- #include "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;
- template<typename String>
- check_return Error toString(String& s) const {
- CORE_RETURN_ERROR(s.append("(tan = "));
- CORE_RETURN_ERROR(s.append(tan));
- CORE_RETURN_ERROR(s.append(", nearClip = "));
- CORE_RETURN_ERROR(s.append(nearClip));
- CORE_RETURN_ERROR(s.append(", farClip = "));
- CORE_RETURN_ERROR(s.append(farClip));
- CORE_RETURN_ERROR(s.append(')'));
- return Error::NONE;
- }
- };
- }
- #endif
|