// Copyright (C) 2020 Jérôme Leclercq // This file is part of the "Nazara Engine - Mathematics module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_FRUSTUM_HPP #define NAZARA_FRUSTUM_HPP #include #include #include #include #include #include #include #include namespace Nz { struct SerializationContext; template class Frustum { public: Frustum() = default; template explicit Frustum(const Frustum& frustum); Frustum(const Frustum& frustum) = default; ~Frustum() = default; Frustum& Build(T angle, T ratio, T zNear, T zFar, const Vector3& eye, const Vector3& target, const Vector3& up = Vector3::Up()); bool Contains(const BoundingVolume& volume) const; bool Contains(const Box& box) const; bool Contains(const OrientedBox& orientedBox) const; bool Contains(const Sphere& sphere) const; bool Contains(const Vector3& point) const; bool Contains(const Vector3* points, unsigned int pointCount) const; Frustum& Extract(const Matrix4& clipMatrix); Frustum& Extract(const Matrix4& view, const Matrix4& projection); const Vector3& GetCorner(BoxCorner corner) const; const Plane& GetPlane(FrustumPlane plane) const; IntersectionSide Intersect(const BoundingVolume& volume) const; IntersectionSide Intersect(const Box& box) const; IntersectionSide Intersect(const OrientedBox& orientedBox) const; IntersectionSide Intersect(const Sphere& sphere) const; IntersectionSide Intersect(const Vector3* points, unsigned int pointCount) const; Frustum& operator=(const Frustum& other) = default; template Frustum& Set(const Frustum& frustum); String ToString() const; template friend bool Serialize(SerializationContext& context, const Frustum& frustum, TypeTag>); template friend bool Unserialize(SerializationContext& context, Frustum* frustum, TypeTag>); private: Vector3 m_corners[BoxCorner_Max+1]; Plane m_planes[FrustumPlane_Max+1]; }; using Frustumd = Frustum; using Frustumf = Frustum; } template std::ostream& operator<<(std::ostream& out, const Nz::Frustum& frustum); #include #endif // NAZARA_FRUSTUM_HPP