Remove Config.hpp options and refactor headers
- Rename Config.hpp to Export.hpp - Remove Debug.hpp and DebugOff.hpp (not used anymore)
This commit is contained in:
committed by
Jérôme Leclercq
parent
3c7e2a1685
commit
5130a2ff84
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
#include <NazaraUtils/Constants.hpp>
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <math.h> //< sincos
|
||||
#endif
|
||||
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -791,4 +790,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -493,4 +492,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -634,8 +633,6 @@ namespace Nz
|
||||
* \return A reference to the ith element of the box
|
||||
*
|
||||
* \remark Access to index greater than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 6 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr T& Box<T>::operator[](std::size_t i)
|
||||
@@ -650,8 +647,6 @@ namespace Nz
|
||||
* \return A value to the ith element of the box
|
||||
*
|
||||
* \remark Access to index greater than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 6 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr const T& Box<T>::operator[](std::size_t i) const
|
||||
@@ -825,4 +820,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Math/Config.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -344,4 +342,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -25,21 +25,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_MATH_CONFIG_HPP
|
||||
#define NAZARA_MATH_CONFIG_HPP
|
||||
#ifndef NAZARA_MATH_EXPORT_HPP
|
||||
#define NAZARA_MATH_EXPORT_HPP
|
||||
|
||||
/*!
|
||||
* \defgroup math (NazaraMath) Mathematics module
|
||||
* 2D/3D mathematics module including matrix, vector, box, sphere, quaternion, ...
|
||||
*/
|
||||
|
||||
/// Each modification of a parameter of the module needs a recompilation of the unit
|
||||
#if !defined(NAZARA_STATIC)
|
||||
#ifdef NAZARA_CORE_BUILD // Math is compiled as part of Core
|
||||
#define NAZARA_MATH_API NAZARA_EXPORT
|
||||
#else
|
||||
#define NAZARA_MATH_API NAZARA_IMPORT
|
||||
#endif
|
||||
#else
|
||||
#define NAZARA_MATH_API
|
||||
#endif
|
||||
|
||||
// Checks for transform matrix on common operations (Concatenate, Inverse, ...) and warns if the operation could be optimized
|
||||
// also checks if transform calls are called on transform matrices
|
||||
#define NAZARA_MATH_MATRIX4_CHECK_TRANSFORM 0
|
||||
|
||||
// Enable tests of security based on the code (Advised for the development)
|
||||
#define NAZARA_MATH_SAFE 1
|
||||
|
||||
#endif // NAZARA_MATH_CONFIG_HPP
|
||||
#endif // NAZARA_MATH_EXPORT_HPP
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
// Sources:
|
||||
// http://www.crownandcutlass.com/features/technicaldetails/frustum.html
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -656,4 +655,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
///FIXME: Matrices column-major, difficile de bosser avec (Tout passer en row-major et transposer dans les shaders ?)
|
||||
|
||||
#include <Nazara/Math/Angle.hpp>
|
||||
#include <Nazara/Math/Config.hpp>
|
||||
#include <NazaraUtils/TypeTag.hpp>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Math/Config.hpp>
|
||||
#include <Nazara/Math/EulerAngles.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
@@ -15,7 +14,6 @@
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -167,21 +165,13 @@ namespace Nz
|
||||
*
|
||||
* \param matrix Matrix to multiply with
|
||||
*
|
||||
* \remark if NAZARA_MATH_MATRIX4_CHECK_TRANSFORM is defined, will print a message if both matrices are transform matrices (and will call ConcatenateTransform)
|
||||
* \remark if NAZARA_DEBUG is defined, will print a message if both matrices are transform matrices (and will call ConcatenateTransform)
|
||||
*
|
||||
* \see ConcatenateTransform
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr Matrix4<T>& Matrix4<T>::Concatenate(const Matrix4& matrix)
|
||||
{
|
||||
#if NAZARA_MATH_MATRIX4_CHECK_TRANSFORM
|
||||
if (IsTransformMatrix() && matrix.IsTransformMatrix())
|
||||
{
|
||||
NazaraDebug("Matrix4::Concatenate was called on transform matrices, use Matrix4::ConcatenateTransform");
|
||||
return ConcatenateTransform(matrix);
|
||||
}
|
||||
#endif
|
||||
|
||||
return operator=(Matrix4(
|
||||
m11 * matrix.m11 + m12 * matrix.m21 + m13 * matrix.m31 + m14 * matrix.m41,
|
||||
m11 * matrix.m12 + m12 * matrix.m22 + m13 * matrix.m32 + m14 * matrix.m42,
|
||||
@@ -211,14 +201,14 @@ namespace Nz
|
||||
*
|
||||
* \param matrix Matrix to multiply with
|
||||
*
|
||||
* \remark if NAZARA_MATH_MATRIX4_CHECK_TRANSFORM is defined and matrices are not transform matrices, a NazaraWarning is produced and Concatenate is called
|
||||
* \remark if NAZARA_DEBUG is defined and matrices are not transform matrices, a NazaraWarning is produced and Concatenate is called
|
||||
*
|
||||
* \see Concatenate
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr Matrix4<T>& Matrix4<T>::ConcatenateTransform(const Matrix4& matrix)
|
||||
{
|
||||
#if NAZARA_MATH_MATRIX4_CHECK_TRANSFORM
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (!IsTransformMatrix())
|
||||
{
|
||||
NazaraDebug("Matrix4::ConcatenateTransform first matrix is not a transform matrix");
|
||||
@@ -273,21 +263,11 @@ namespace Nz
|
||||
* \brief Computes the determinant of this matrix
|
||||
* \return The value of the determinant
|
||||
*
|
||||
* \remark if NAZARA_MATH_MATRIX4_CHECK_AFFINE is defined, GetDeterminantTransform is called
|
||||
*
|
||||
* \see GetDeterminantTransform
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr T Matrix4<T>::GetDeterminant() const
|
||||
{
|
||||
#if NAZARA_MATH_MATRIX4_CHECK_TRANSFORM
|
||||
if (IsTransformMatrix())
|
||||
{
|
||||
NazaraDebug("Matrix4::GetDeterminant was called on a transform matrix, use Matrix4::GetDeterminantTransform");
|
||||
return GetDeterminantTransform();
|
||||
}
|
||||
#endif
|
||||
|
||||
T A = m22*(m33*m44 - m43*m34) - m32*(m23*m44 - m43*m24) + m42*(m23*m34 - m33*m24);
|
||||
T B = m12*(m33*m44 - m43*m34) - m32*(m13*m44 - m43*m14) + m42*(m13*m34 - m33*m14);
|
||||
T C = m12*(m23*m44 - m43*m24) - m22*(m13*m44 - m43*m14) + m42*(m13*m24 - m23*m14);
|
||||
@@ -300,14 +280,12 @@ namespace Nz
|
||||
* \brief Computes the determinant of this matrix
|
||||
* \return The value of the determinant
|
||||
*
|
||||
* \remark if NAZARA_DEBUG is defined and matrix is not affine, a NazaraWarning is produced and GetDeterminant is called
|
||||
*
|
||||
* \see GetDeterminant
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr T Matrix4<T>::GetDeterminantTransform() const
|
||||
{
|
||||
#if NAZARA_MATH_MATRIX4_CHECK_TRANSFORM
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (!IsTransformMatrix())
|
||||
{
|
||||
NazaraDebug("matrix is not a transform matrix");
|
||||
@@ -329,7 +307,7 @@ namespace Nz
|
||||
* \param dest Matrix to put the result
|
||||
*
|
||||
* \remark You can call this method on the same object
|
||||
* \remark if NAZARA_MATH_MATRIX4_CHECK_AFFINE is defined, GetInverseAffine is called
|
||||
* \remark if NAZARADEBUG is defined, GetInverseAffine is called
|
||||
* \remark if NAZARA_DEBUG is defined, a NazaraError is produced if dest is null and false is returned
|
||||
*
|
||||
* \see GetInverseAffine
|
||||
@@ -339,14 +317,6 @@ namespace Nz
|
||||
{
|
||||
NazaraAssert(dest, "destination matrix must be valid");
|
||||
|
||||
#if NAZARA_MATH_MATRIX4_CHECK_TRANSFORM
|
||||
if (IsTransformMatrix())
|
||||
{
|
||||
NazaraDebug("Matrix4::GetInverse was called on a transform matrix, use Matrix4::GetInverseTransform");
|
||||
return GetInverseTransform(dest);
|
||||
}
|
||||
#endif
|
||||
|
||||
T det = GetDeterminant();
|
||||
if (det == T(0.0))
|
||||
return false;
|
||||
@@ -490,7 +460,7 @@ namespace Nz
|
||||
{
|
||||
NazaraAssert(dest, "destination matrix must be valid");
|
||||
|
||||
#if NAZARA_MATH_MATRIX4_CHECK_TRANSFORM
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (!IsTransformMatrix())
|
||||
{
|
||||
NazaraDebug("matrix is not a transform matrix");
|
||||
@@ -627,9 +597,6 @@ namespace Nz
|
||||
* \return Vector4 which is the ith row of the matrix
|
||||
*
|
||||
* \param row Index of the row you want
|
||||
*
|
||||
* \remark Produce a NazaraError if you try to access index greater than 3 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::out_of_range if NAZARA_MATH_SAFE is defined and if you try to access index greater than 3
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr Vector4<T> Matrix4<T>::GetRow(std::size_t row) const
|
||||
@@ -1460,4 +1427,3 @@ namespace Nz
|
||||
}
|
||||
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
///DOC: Pour que les coins soient valides, la méthode Update doit être appelée
|
||||
|
||||
@@ -130,9 +129,6 @@ namespace Nz
|
||||
/*!
|
||||
* \brief Gets the ith corner of the oriented box
|
||||
* \return A reference to this corner
|
||||
*
|
||||
* \remark Produce a NazaraError if you try to access to index greather than BoxCorner::Max with NAZARA_MATH_SAFE defined. If not, it is undefined behaviour
|
||||
* \throw std::out_of_range if NAZARA_MATH_SAFE is defined and you try to acces to index greather than BoxCorner::Max
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr Vector3<T>& OrientedBox<T>::operator()(unsigned int i)
|
||||
@@ -144,9 +140,6 @@ namespace Nz
|
||||
/*!
|
||||
* \brief Gets the ith corner of the oriented box
|
||||
* \return A reference to this corner
|
||||
*
|
||||
* \remark Produce a NazaraError if you try to access to index greather than BoxCorner::Max with NAZARA_MATH_SAFE defined. If not, it is undefined behaviour
|
||||
* \throw std::out_of_range if NAZARA_MATH_SAFE is defined and you try to acces to index greather than BoxCorner::Max
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr const Vector3<T>& OrientedBox<T>::operator()(unsigned int i) const
|
||||
@@ -279,4 +272,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -27,4 +26,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -325,4 +324,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2024 Rémi Bèges - 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Copyright (C) 2024 Rémi Bèges - 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Math/Config.hpp>
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -711,9 +709,9 @@ namespace Nz
|
||||
template<typename T>
|
||||
Quaternion<T> Quaternion<T>::Mirror(Quaternion quat, const Vector3<T>& axis)
|
||||
{
|
||||
float x = std::copysign(T(1.0), axis.x);
|
||||
float y = std::copysign(T(1.0), axis.y);
|
||||
float z = std::copysign(T(1.0), axis.z);
|
||||
T x = std::copysign(T(1.0), axis.x);
|
||||
T y = std::copysign(T(1.0), axis.y);
|
||||
T z = std::copysign(T(1.0), axis.z);
|
||||
|
||||
quat.x = y * z * quat.x;
|
||||
quat.y = x * z * quat.y;
|
||||
@@ -844,4 +842,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2024 Gawaboumga (https://github.com/Gawaboumga) - 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// Copyright (C) 2024 Gawaboumga (https://github.com/Gawaboumga) - 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -65,9 +64,6 @@ namespace Nz
|
||||
*
|
||||
* \param planeOne First plane
|
||||
* \param planeTwo Second secant plane
|
||||
*
|
||||
* \remark Produce a NazaraError if planes are parallel with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and planes are parallel
|
||||
*/
|
||||
template<typename T>
|
||||
Ray<T>::Ray(const Plane<T>& planeOne, const Plane<T>& planeTwo)
|
||||
@@ -77,7 +73,7 @@ namespace Nz
|
||||
T termFour = planeTwo.normal.GetLength();
|
||||
T det = termOne * termFour - termTwo * termTwo;
|
||||
|
||||
#if NAZARA_MATH_SAFE
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (NumberEquals(det, T(0.0)))
|
||||
{
|
||||
std::string error("Planes are parallel");
|
||||
@@ -622,4 +618,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -500,8 +499,6 @@ namespace Nz
|
||||
* \return A reference to the ith element of the rectangle
|
||||
*
|
||||
* \remark Access to index greather than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr T& Rect<T>::operator[](std::size_t i)
|
||||
@@ -516,8 +513,6 @@ namespace Nz
|
||||
* \return A value to the ith element of the rectangle
|
||||
*
|
||||
* \remark Access to index greater than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr const T& Rect<T>::operator[](std::size_t i) const
|
||||
@@ -685,4 +680,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <NazaraUtils/MathUtils.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -319,8 +318,6 @@ namespace Nz
|
||||
* \return A reference to the ith element of the sphere
|
||||
*
|
||||
* \remark Access to index greater than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr T& Sphere<T>::operator[](std::size_t i)
|
||||
@@ -335,8 +332,6 @@ namespace Nz
|
||||
* \return A value to the ith element of the sphere
|
||||
*
|
||||
* \remark Access to index greater than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr T Sphere<T>::operator[](std::size_t i) const
|
||||
@@ -566,4 +561,3 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -823,4 +822,3 @@ namespace std
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2024 Rémi Bèges - 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2024 Rémi Bèges - 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -124,8 +123,6 @@ namespace Nz
|
||||
* \param vec The other vector to measure the angle with
|
||||
*
|
||||
* \remark The vectors need to be normalised
|
||||
* \remark Produce a NazaraError if one of the vec components is null with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of the vec components is null
|
||||
*
|
||||
* \see NormalizeAngle
|
||||
*/
|
||||
@@ -1041,4 +1038,3 @@ namespace std
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2024 Rémi Bèges - 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2024 Rémi Bèges - 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 Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
///FIXME: Les calculs effectués ici sont probablements tous faux, la composante W étant spéciale dans le monde de la 3D
|
||||
|
||||
@@ -861,4 +860,3 @@ namespace std
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
||||
Reference in New Issue
Block a user