// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Math module" // For conditions of distribution and use, see copyright notice in Export.hpp #pragma once #ifndef NAZARA_MATH_BOUNDINGVOLUME_HPP #define NAZARA_MATH_BOUNDINGVOLUME_HPP #include #include #include #include #include #include #include namespace Nz { template class BoundingVolume { public: constexpr BoundingVolume(); constexpr explicit BoundingVolume(Extent Extend); constexpr explicit BoundingVolume(const Box& box); constexpr explicit BoundingVolume(const OrientedBox& orientedBox); template constexpr explicit BoundingVolume(const BoundingVolume& volume); constexpr BoundingVolume(const BoundingVolume&) = default; constexpr BoundingVolume(BoundingVolume&&) = default; ~BoundingVolume() = default; constexpr bool ApproxEqual(const BoundingVolume& volume, T maxDifference = std::numeric_limits::epsilon()) const; constexpr BoundingVolume& ExtendTo(const BoundingVolume& volume); constexpr bool Intersect(const Box& box) const; constexpr bool IsFinite() const; constexpr bool IsInfinite() const; constexpr bool IsNull() const; std::string ToString() const; constexpr void Update(const Matrix4& transformMatrix); constexpr void Update(const Vector3& translation); BoundingVolume& operator=(const BoundingVolume&) = default; BoundingVolume& operator=(BoundingVolume&&) = default; constexpr BoundingVolume operator*(T scalar) const; constexpr BoundingVolume& operator*=(T scalar); constexpr bool operator==(const BoundingVolume& volume) const; constexpr bool operator!=(const BoundingVolume& volume) const; static constexpr bool ApproxEqual(const BoundingVolume& lhs, const BoundingVolume& rhs, T maxDifference = std::numeric_limits::epsilon()); static constexpr BoundingVolume Infinite(); static constexpr BoundingVolume Lerp(const BoundingVolume& from, const BoundingVolume& to, T interpolation); static constexpr BoundingVolume Null(); Extent extent; Box aabb; OrientedBox obb; }; using BoundingVolumed = BoundingVolume; using BoundingVolumef = BoundingVolume; template bool Serialize(SerializationContext& context, const BoundingVolume& boundingVolume, TypeTag>); template bool Unserialize(SerializationContext& context, BoundingVolume* boundingVolume, TypeTag>); template std::ostream& operator<<(std::ostream& out, const Nz::BoundingVolume& volume); } #include #endif // NAZARA_MATH_BOUNDINGVOLUME_HPP