#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 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 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 ErrorCode::NONE; } }; } #endif