// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Math module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_MATH_ORIENTEDBOX_HPP #define NAZARA_MATH_ORIENTEDBOX_HPP #include #include #include #include #include #include namespace Nz { struct SerializationContext; template class OrientedBox { public: constexpr OrientedBox() = default; constexpr OrientedBox(const Box& box); template constexpr explicit OrientedBox(const OrientedBox& orientedBox); constexpr OrientedBox(const OrientedBox&) = default; constexpr OrientedBox(OrientedBox&&) noexcept = default; ~OrientedBox() = default; constexpr bool ApproxEqual(const OrientedBox& obb, T maxDifference = std::numeric_limits::epsilon()) const; constexpr const Vector3& GetCorner(BoxCorner corner) const; constexpr const EnumArray>& GetCorners() const; constexpr bool IsValid() const; std::string ToString() const; constexpr void Update(const Matrix4& transformMatrix); constexpr void Update(const Vector3& transformMatrix); constexpr Vector3& operator()(unsigned int i); constexpr const Vector3& operator()(unsigned int i) const; constexpr OrientedBox& operator=(const OrientedBox&) = default; constexpr OrientedBox& operator=(OrientedBox&&) noexcept = default; constexpr bool operator==(const OrientedBox& box) const; constexpr bool operator!=(const OrientedBox& box) const; static constexpr bool ApproxEqual(const OrientedBox& lhs, const OrientedBox& rhs, T maxDifference = std::numeric_limits::epsilon()); static constexpr OrientedBox Lerp(const OrientedBox& from, const OrientedBox& to, T interpolation); static constexpr OrientedBox Zero(); template friend bool Serialize(SerializationContext& context, const OrientedBox& obb, TypeTag>); template friend bool Unserialize(SerializationContext& context, OrientedBox* obb, TypeTag>); Box localBox; private: EnumArray> m_corners; }; using OrientedBoxd = OrientedBox; using OrientedBoxf = OrientedBox; template std::ostream& operator<<(std::ostream& out, const Nz::OrientedBox& orientedBox); } #include #endif // NAZARA_MATH_ORIENTEDBOX_HPP