// Copyright (C) 2017 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_ORIENTEDBOX_HPP #define NAZARA_ORIENTEDBOX_HPP #include #include #include #include namespace Nz { struct SerializationContext; template class OrientedBox { public: OrientedBox() = default; OrientedBox(T X, T Y, T Z, T Width, T Height, T Depth); OrientedBox(const Box& box); OrientedBox(const Vector3& vec1, const Vector3& vec2); template explicit OrientedBox(const OrientedBox& orientedBox); OrientedBox(const OrientedBox& orientedBox) = default; ~OrientedBox() = default; const Vector3& GetCorner(BoxCorner corner) const; bool IsValid() const; OrientedBox& MakeZero(); OrientedBox& Set(T X, T Y, T Z, T Width, T Height, T Depth); OrientedBox& Set(const Box& box); OrientedBox& Set(const OrientedBox& orientedBox); OrientedBox& Set(const Vector3& vec1, const Vector3& vec2); template OrientedBox& Set(const OrientedBox& orientedBox); String ToString() const; void Update(const Matrix4& transformMatrix); void Update(const Vector3& transformMatrix); operator Vector3* (); operator const Vector3* () const; Vector3& operator()(unsigned int i); Vector3 operator()(unsigned int i) const; OrientedBox operator*(T scalar) const; OrientedBox& operator=(const OrientedBox& other) = default; OrientedBox& operator*=(T scalar); bool operator==(const OrientedBox& box) const; bool operator!=(const OrientedBox& box) const; static OrientedBox Lerp(const OrientedBox& from, const OrientedBox& to, T interpolation); static OrientedBox Zero(); Box localBox; private: Vector3 m_corners[BoxCorner_Max+1]; // Ne peuvent pas être modifiés directement }; using OrientedBoxd = OrientedBox; using OrientedBoxf = OrientedBox; template bool Serialize(SerializationContext& context, const OrientedBox& obb, TypeTag>); template bool Unserialize(SerializationContext& context, OrientedBox* obb, TypeTag>); } template std::ostream& operator<<(std::ostream& out, const Nz::OrientedBox& orientedBox); #include #endif // NAZARA_ORIENTEDBOX_HPP