Move free operator overloads inside Nz namespace
This commit is contained in:
parent
763bef3fdd
commit
2243d0b1a7
|
|
@ -114,9 +114,9 @@ namespace Nz
|
|||
using ParameterMap = std::unordered_map<std::string, Parameter>;
|
||||
ParameterMap m_parameters;
|
||||
};
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::ParameterList& parameterList);
|
||||
std::ostream& operator<<(std::ostream& out, const ParameterList& parameterList);
|
||||
}
|
||||
|
||||
#include <Nazara/Core/ParameterList.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ namespace Nz
|
|||
constexpr Angle(T angle);
|
||||
template<typename U> constexpr explicit Angle(const Angle<Unit, U>& Angle);
|
||||
template<AngleUnit FromUnit> constexpr Angle(const Angle<FromUnit, T>& angle);
|
||||
constexpr Angle(const Angle&) = default;
|
||||
constexpr Angle(Angle&&) noexcept = default;
|
||||
~Angle() = default;
|
||||
|
||||
T GetCos() const;
|
||||
|
|
@ -41,7 +43,7 @@ namespace Nz
|
|||
|
||||
constexpr Angle& Normalize();
|
||||
|
||||
constexpr Angle& Set(const Angle& ang);
|
||||
constexpr Angle& Set(Angle ang);
|
||||
template<typename U> constexpr Angle& Set(const Angle<Unit, U>& ang);
|
||||
|
||||
template<AngleUnit ToUnit> T To() const;
|
||||
|
|
@ -57,22 +59,23 @@ namespace Nz
|
|||
constexpr Angle<AngleUnit::Turn, T> ToTurnAngle() const;
|
||||
|
||||
constexpr Angle& operator=(const Angle&) = default;
|
||||
constexpr Angle& operator=(Angle&&) noexcept = default;
|
||||
|
||||
constexpr const Angle& operator+() const;
|
||||
constexpr Angle operator+() const;
|
||||
constexpr Angle operator-() const;
|
||||
|
||||
constexpr Angle operator+(const Angle& other) const;
|
||||
constexpr Angle operator-(const Angle& other) const;
|
||||
constexpr Angle operator+(Angle other) const;
|
||||
constexpr Angle operator-(Angle other) const;
|
||||
constexpr Angle operator*(T scalar) const;
|
||||
constexpr Angle operator/(T divider) const;
|
||||
|
||||
constexpr Angle& operator+=(const Angle& other);
|
||||
constexpr Angle& operator-=(const Angle& other);
|
||||
constexpr Angle& operator+=(Angle other);
|
||||
constexpr Angle& operator-=(Angle other);
|
||||
constexpr Angle& operator*=(T scalar);
|
||||
constexpr Angle& operator/=(T divider);
|
||||
|
||||
constexpr bool operator==(const Angle& other) const;
|
||||
constexpr bool operator!=(const Angle& other) const;
|
||||
constexpr bool operator==(Angle other) const;
|
||||
constexpr bool operator!=(Angle other) const;
|
||||
|
||||
template<AngleUnit FromUnit> static constexpr Angle From(T value);
|
||||
static constexpr Angle FromDegrees(T degrees);
|
||||
|
|
@ -101,19 +104,16 @@ namespace Nz
|
|||
using TurnAngled = TurnAngle<double>;
|
||||
using TurnAnglef = TurnAngle<float>;
|
||||
|
||||
template<AngleUnit Unit, typename T> bool Serialize(SerializationContext& context, const Angle<Unit, T>& angle, TypeTag<Angle<Unit, T>>);
|
||||
template<AngleUnit Unit, typename T> Angle<Unit, T> operator*(T scale, Angle<Unit, T> angle);
|
||||
|
||||
template<AngleUnit Unit, typename T> Angle<Unit, T> operator/(T divider, Angle<Unit, T> angle);
|
||||
|
||||
template<AngleUnit Unit, typename T> std::ostream& operator<<(std::ostream& out, Angle<Unit, T> angle);
|
||||
|
||||
template<AngleUnit Unit, typename T> bool Serialize(SerializationContext& context, Angle<Unit, T> angle, TypeTag<Angle<Unit, T>>);
|
||||
template<AngleUnit Unit, typename T> bool Unserialize(SerializationContext& context, Angle<Unit, T>* angle, TypeTag<Angle<Unit, T>>);
|
||||
}
|
||||
|
||||
template<Nz::AngleUnit Unit, typename T>
|
||||
Nz::Angle<Unit, T> operator*(T scale, const Nz::Angle<Unit, T>& angle);
|
||||
|
||||
template<Nz::AngleUnit Unit, typename T>
|
||||
Nz::Angle<Unit, T> operator/(T divider, const Nz::Angle<Unit, T>& angle);
|
||||
|
||||
template<Nz::AngleUnit Unit, typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Angle<Unit, T>& angle);
|
||||
|
||||
#include <Nazara/Math/Angle.inl>
|
||||
|
||||
#endif // NAZARA_MATH_ANGLE_HPP
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ namespace Nz
|
|||
}
|
||||
/*!
|
||||
* \ingroup math
|
||||
* \class Nz::Angle
|
||||
* \class Angle
|
||||
* \brief Math class that represents an angle
|
||||
*/
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ namespace Nz
|
|||
* \param Angle Angle which will be copied
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
constexpr Angle<Unit, T>& Angle<Unit, T>::Set(const Angle& ang)
|
||||
constexpr Angle<Unit, T>& Angle<Unit, T>::Set(Angle ang)
|
||||
{
|
||||
value = ang.value;
|
||||
return *this;
|
||||
|
|
@ -463,7 +463,7 @@ namespace Nz
|
|||
* \return A constant reference to this angle
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
constexpr const Angle<Unit, T>& Angle<Unit, T>::operator+() const
|
||||
constexpr Angle<Unit, T> Angle<Unit, T>::operator+() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -485,7 +485,7 @@ namespace Nz
|
|||
* \param other Angle to add
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
constexpr Angle<Unit, T> Angle<Unit, T>::operator+(const Angle& other) const
|
||||
constexpr Angle<Unit, T> Angle<Unit, T>::operator+(Angle other) const
|
||||
{
|
||||
return Angle(value + other.value);
|
||||
}
|
||||
|
|
@ -497,7 +497,7 @@ namespace Nz
|
|||
* \param other Angle to subtract
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
constexpr Angle<Unit, T> Angle<Unit, T>::operator-(const Angle& other) const
|
||||
constexpr Angle<Unit, T> Angle<Unit, T>::operator-(Angle other) const
|
||||
{
|
||||
return Angle(value - other.value);
|
||||
}
|
||||
|
|
@ -533,7 +533,7 @@ namespace Nz
|
|||
* \param other Angle to add
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
constexpr Angle<Unit, T>& Angle<Unit, T>::operator+=(const Angle& other)
|
||||
constexpr Angle<Unit, T>& Angle<Unit, T>::operator+=(Angle other)
|
||||
{
|
||||
value += other.value;
|
||||
return *this;
|
||||
|
|
@ -546,7 +546,7 @@ namespace Nz
|
|||
* \param other Angle to subtract
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
constexpr Angle<Unit, T>& Angle<Unit, T>::operator-=(const Angle& other)
|
||||
constexpr Angle<Unit, T>& Angle<Unit, T>::operator-=(Angle other)
|
||||
{
|
||||
value -= other.value;
|
||||
return *this;
|
||||
|
|
@ -585,7 +585,7 @@ namespace Nz
|
|||
* \param other The other angle to compare to
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
constexpr bool Angle<Unit, T>::operator==(const Angle& other) const
|
||||
constexpr bool Angle<Unit, T>::operator==(Angle other) const
|
||||
{
|
||||
return NumberEquals(value, other.value, Detail::AngleUtils<Unit>::template GetEpsilon<T>());
|
||||
}
|
||||
|
|
@ -597,7 +597,7 @@ namespace Nz
|
|||
* \param other The other angle to compare to
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
constexpr bool Angle<Unit, T>::operator!=(const Angle& other) const
|
||||
constexpr bool Angle<Unit, T>::operator!=(Angle other) const
|
||||
{
|
||||
return !NumberEquals(value, other.value, Detail::AngleUtils<Unit>::template GetEpsilon<T>());
|
||||
}
|
||||
|
|
@ -664,6 +664,45 @@ namespace Nz
|
|||
return angle;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Multiplication operator
|
||||
* \return An angle corresponding to scale * angle
|
||||
*
|
||||
* \param scale Multiplier
|
||||
* \param angle Angle
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
Angle<Unit, T> operator*(T scale, Angle<Unit, T> angle)
|
||||
{
|
||||
return Angle<Unit, T>(scale * angle.value);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Division operator
|
||||
* \return An angle corresponding to scale / angle
|
||||
*
|
||||
* \param scale Divisor
|
||||
* \param angle Angle
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
Angle<Unit, T> operator/(T scale, Angle<Unit, T> angle)
|
||||
{
|
||||
return Angle<Unit, T>(scale / angle.value);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param box The box to output
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
std::ostream& operator<<(std::ostream& out, Angle<Unit, T> angle)
|
||||
{
|
||||
return Detail::AngleUtils<Unit>::ToString(out, angle.value);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Serializes an Angle
|
||||
* \return true if successfully serialized
|
||||
|
|
@ -672,7 +711,7 @@ namespace Nz
|
|||
* \param angle Input Angle
|
||||
*/
|
||||
template<AngleUnit Unit, typename T>
|
||||
bool Serialize(SerializationContext& context, const Angle<Unit, T>& angle, TypeTag<Angle<Unit, T>>)
|
||||
bool Serialize(SerializationContext& context, Angle<Unit, T> angle, TypeTag<Angle<Unit, T>>)
|
||||
{
|
||||
if (!Serialize(context, angle.value))
|
||||
return false;
|
||||
|
|
@ -697,43 +736,4 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Multiplication operator
|
||||
* \return An angle corresponding to scale * angle
|
||||
*
|
||||
* \param scale Multiplier
|
||||
* \param angle Angle
|
||||
*/
|
||||
template<Nz::AngleUnit Unit, typename T>
|
||||
Nz::Angle<Unit, T> operator*(T scale, const Nz::Angle<Unit, T>& angle)
|
||||
{
|
||||
return Nz::Angle<Unit, T>(scale * angle.value);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Division operator
|
||||
* \return An angle corresponding to scale / angle
|
||||
*
|
||||
* \param scale Divisor
|
||||
* \param angle Angle
|
||||
*/
|
||||
template<Nz::AngleUnit Unit, typename T>
|
||||
Nz::Angle<Unit, T> operator/(T scale, const Nz::Angle<Unit, T>& angle)
|
||||
{
|
||||
return Nz::Angle<Unit, T>(scale / angle.value);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param box The box to output
|
||||
*/
|
||||
template<Nz::AngleUnit Unit, typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Angle<Unit, T>& angle)
|
||||
{
|
||||
return Nz::Detail::AngleUtils<Unit>::ToString(out, angle.value);
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -65,10 +65,9 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const BoundingVolume<T>& boundingVolume, TypeTag<BoundingVolume<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, BoundingVolume<T>* boundingVolume, TypeTag<BoundingVolume<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::BoundingVolume<T>& volume);
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::BoundingVolume<T>& volume);
|
||||
}
|
||||
|
||||
#include <Nazara/Math/BoundingVolume.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -466,35 +466,34 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param volume The bounding volume to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::BoundingVolume<T>& volume)
|
||||
{
|
||||
switch (volume.extend)
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param volume The bounding volume to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::BoundingVolume<T>& volume)
|
||||
{
|
||||
case Nz::Extend::Finite:
|
||||
out << "BoundingVolume(localBox=" << volume.obb.localBox << ')';
|
||||
break;
|
||||
switch (volume.extend)
|
||||
{
|
||||
case Nz::Extend::Finite:
|
||||
out << "BoundingVolume(localBox=" << volume.obb.localBox << ')';
|
||||
break;
|
||||
|
||||
case Nz::Extend::Infinite:
|
||||
out << "BoundingVolume(Infinite)";
|
||||
break;
|
||||
case Nz::Extend::Infinite:
|
||||
out << "BoundingVolume(Infinite)";
|
||||
break;
|
||||
|
||||
case Nz::Extend::Null:
|
||||
out << "BoundingVolume(Null)";
|
||||
break;
|
||||
case Nz::Extend::Null:
|
||||
out << "BoundingVolume(Null)";
|
||||
break;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ namespace Nz
|
|||
Box(Box&&) noexcept = default;
|
||||
~Box() = default;
|
||||
|
||||
bool ApproxEquals(const Box& box, T maxDifference = 0) const;
|
||||
|
||||
bool Contains(T X, T Y, T Z) const;
|
||||
bool Contains(const Box& box) const;
|
||||
bool Contains(const Vector3<T>& point) const;
|
||||
|
|
@ -93,12 +95,10 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Box<T>& box, TypeTag<Box<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Box<T>* box, TypeTag<Box<T>>);
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Box<T>& box);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Box<T>& box);
|
||||
|
||||
|
||||
#include <Nazara/Math/Box.inl>
|
||||
|
||||
#endif // NAZARA_MATH_BOX_HPP
|
||||
|
|
|
|||
|
|
@ -137,6 +137,13 @@ namespace Nz
|
|||
* \see Contains
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
bool Box<T>::ApproxEquals(const Box& box, T maxDifference) const
|
||||
{
|
||||
return NumberEquals(x, box.x, maxDifference) && NumberEquals(y, box.y, maxDifference) && NumberEquals(z, box.z, maxDifference) &&
|
||||
NumberEquals(width, box.width, maxDifference) && NumberEquals(height, box.height, maxDifference) && NumberEquals(depth, box.depth, maxDifference);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool Box<T>::Contains(T X, T Y, T Z) const
|
||||
{
|
||||
|
|
@ -635,8 +642,7 @@ namespace Nz
|
|||
template<typename T>
|
||||
bool Box<T>::operator==(const Box& box) const
|
||||
{
|
||||
return NumberEquals(x, box.x) && NumberEquals(y, box.y) && NumberEquals(z, box.z) &&
|
||||
NumberEquals(width, box.width) && NumberEquals(height, box.height) && NumberEquals(depth, box.depth);
|
||||
return x == box.x && y == box.y && z == box.z && width == box.width && height == box.height && depth == box.depth;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -788,20 +794,19 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param box The box to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Box<T>& box)
|
||||
{
|
||||
return out << "Box(" << box.x << ", " << box.y << ", " << box.z << ", " << box.width << ", " << box.height << ", " << box.depth << ')';
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param box The box to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Box<T>& box)
|
||||
{
|
||||
return out << "Box(" << box.x << ", " << box.y << ", " << box.z << ", " << box.width << ", " << box.height << ", " << box.depth << ')';
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const EulerAngles<T>& eulerAngles, TypeTag<EulerAngles<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, EulerAngles<T>* eulerAngles, TypeTag<EulerAngles<T>>);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::EulerAngles<T>& angles);
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::EulerAngles<T>& angles);
|
||||
}
|
||||
|
||||
|
||||
#include <Nazara/Math/EulerAngles.inl>
|
||||
|
|
|
|||
|
|
@ -383,20 +383,19 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param angles The euler angle to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::EulerAngles<T>& angles)
|
||||
{
|
||||
return out << "EulerAngles(" << angles.pitch << ", " << angles.yaw << ", " << angles.roll << ')';
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param angles The euler angle to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const EulerAngles<T>& angles)
|
||||
{
|
||||
return out << "EulerAngles(" << angles.pitch << ", " << angles.yaw << ", " << angles.roll << ')';
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -68,10 +68,9 @@ namespace Nz
|
|||
|
||||
using Frustumd = Frustum<double>;
|
||||
using Frustumf = Frustum<float>;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Frustum<T>& frustum);
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Frustum<T>& frustum);
|
||||
}
|
||||
|
||||
#include <Nazara/Math/Frustum.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -587,25 +587,24 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param frustum The frustum to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Frustum<T>& frustum)
|
||||
{
|
||||
return out << "Frustum(Bottom: " << frustum.GetPlane(Nz::FrustumPlane::Bottom) << ",\n"
|
||||
<< " Far: " << frustum.GetPlane(Nz::FrustumPlane::Far) << ",\n"
|
||||
<< " Left: " << frustum.GetPlane(Nz::FrustumPlane::Left) << ",\n"
|
||||
<< " Near: " << frustum.GetPlane(Nz::FrustumPlane::Near) << ",\n"
|
||||
<< " Right: " << frustum.GetPlane(Nz::FrustumPlane::Right) << ",\n"
|
||||
<< " Top: " << frustum.GetPlane(Nz::FrustumPlane::Top) << ")\n";
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param frustum The frustum to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Frustum<T>& frustum)
|
||||
{
|
||||
return out << "Frustum(Bottom: " << frustum.GetPlane(Nz::FrustumPlane::Bottom) << ",\n"
|
||||
<< " Far: " << frustum.GetPlane(Nz::FrustumPlane::Far) << ",\n"
|
||||
<< " Left: " << frustum.GetPlane(Nz::FrustumPlane::Left) << ",\n"
|
||||
<< " Near: " << frustum.GetPlane(Nz::FrustumPlane::Near) << ",\n"
|
||||
<< " Right: " << frustum.GetPlane(Nz::FrustumPlane::Right) << ",\n"
|
||||
<< " Top: " << frustum.GetPlane(Nz::FrustumPlane::Top) << ")\n";
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -146,13 +146,12 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Matrix4<T>& matrix, TypeTag<Matrix4<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Matrix4<T>* matrix, TypeTag<Matrix4<T>>);
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Matrix4<T>& matrix);
|
||||
|
||||
template<typename T> Matrix4<T> operator*(T scale, const Matrix4<T>& matrix);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Matrix4<T>& matrix);
|
||||
|
||||
template<typename T> Nz::Matrix4<T> operator*(T scale, const Nz::Matrix4<T>& matrix);
|
||||
|
||||
|
||||
#include <Nazara/Math/Matrix4.inl>
|
||||
|
||||
#endif // NAZARA_MATH_MATRIX4_HPP
|
||||
|
|
|
|||
|
|
@ -1769,38 +1769,38 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param matrix The matrix to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Matrix4<T>& matrix)
|
||||
{
|
||||
return out << "Matrix4(" << matrix.m11 << ", " << matrix.m12 << ", " << matrix.m13 << ", " << matrix.m14 << ",\n"
|
||||
<< " " << matrix.m21 << ", " << matrix.m22 << ", " << matrix.m23 << ", " << matrix.m24 << ",\n"
|
||||
<< " " << matrix.m31 << ", " << matrix.m32 << ", " << matrix.m33 << ", " << matrix.m34 << ",\n"
|
||||
<< " " << matrix.m41 << ", " << matrix.m42 << ", " << matrix.m43 << ", " << matrix.m44 << ')';
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Multiplies the components of the matrix with a scalar
|
||||
* \return A Matrix4 where components are the product of matrix'components and the scalar
|
||||
*
|
||||
* \param scale The scalar to multiply the matrix'components with
|
||||
* \param matrix Matrix to multiply with
|
||||
*/
|
||||
template<typename T>
|
||||
Matrix4<T> operator*(T scale, const Matrix4<T>& matrix)
|
||||
{
|
||||
return matrix * scale;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param matrix The matrix to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Matrix4<T>& matrix)
|
||||
{
|
||||
return out << "Matrix4(" << matrix.m11 << ", " << matrix.m12 << ", " << matrix.m13 << ", " << matrix.m14 << ",\n"
|
||||
<< " " << matrix.m21 << ", " << matrix.m22 << ", " << matrix.m23 << ", " << matrix.m24 << ",\n"
|
||||
<< " " << matrix.m31 << ", " << matrix.m32 << ", " << matrix.m33 << ", " << matrix.m34 << ",\n"
|
||||
<< " " << matrix.m41 << ", " << matrix.m42 << ", " << matrix.m43 << ", " << matrix.m44 << ')';
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Multiplies the components of the matrix with a scalar
|
||||
* \return A Matrix4 where components are the product of matrix'components and the scalar
|
||||
*
|
||||
* \param scale The scalar to multiply the matrix'components with
|
||||
* \param matrix Matrix to multiply with
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
Nz::Matrix4<T> operator*(T scale, const Nz::Matrix4<T>& matrix)
|
||||
{
|
||||
return matrix * scale;
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
#include "Matrix4.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -61,10 +61,9 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const OrientedBox<T>& obb, TypeTag<OrientedBox<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, OrientedBox<T>* obb, TypeTag<OrientedBox<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::OrientedBox<T>& orientedBox);
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::OrientedBox<T>& orientedBox);
|
||||
}
|
||||
|
||||
#include <Nazara/Math/OrientedBox.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -274,28 +274,26 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param orientedBox The orientedBox to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::OrientedBox<T>& orientedBox)
|
||||
{
|
||||
return out << "OrientedBox(FLB: " << orientedBox.GetCorner(Nz::BoxCorner::FarLeftBottom) << ",\n"
|
||||
<< " FLT: " << orientedBox.GetCorner(Nz::BoxCorner::FarLeftTop) << ",\n"
|
||||
<< " FRB: " << orientedBox.GetCorner(Nz::BoxCorner::FarRightBottom) << ",\n"
|
||||
<< " FRT: " << orientedBox.GetCorner(Nz::BoxCorner::FarRightTop) << ",\n"
|
||||
<< " NLB: " << orientedBox.GetCorner(Nz::BoxCorner::NearLeftBottom) << ",\n"
|
||||
<< " NLT: " << orientedBox.GetCorner(Nz::BoxCorner::NearLeftTop) << ",\n"
|
||||
<< " NRB: " << orientedBox.GetCorner(Nz::BoxCorner::NearRightBottom) << ",\n"
|
||||
<< " NRT: " << orientedBox.GetCorner(Nz::BoxCorner::NearRightTop) << ")\n";
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param orientedBox The orientedBox to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::OrientedBox<T>& orientedBox)
|
||||
{
|
||||
return out << "OrientedBox(FLB: " << orientedBox.GetCorner(Nz::BoxCorner::FarLeftBottom) << ",\n"
|
||||
<< " FLT: " << orientedBox.GetCorner(Nz::BoxCorner::FarLeftTop) << ",\n"
|
||||
<< " FRB: " << orientedBox.GetCorner(Nz::BoxCorner::FarRightBottom) << ",\n"
|
||||
<< " FRT: " << orientedBox.GetCorner(Nz::BoxCorner::FarRightTop) << ",\n"
|
||||
<< " NLB: " << orientedBox.GetCorner(Nz::BoxCorner::NearLeftBottom) << ",\n"
|
||||
<< " NLT: " << orientedBox.GetCorner(Nz::BoxCorner::NearLeftTop) << ",\n"
|
||||
<< " NRB: " << orientedBox.GetCorner(Nz::BoxCorner::NearRightBottom) << ",\n"
|
||||
<< " NRT: " << orientedBox.GetCorner(Nz::BoxCorner::NearRightTop) << ")\n";
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
#include "OrientedBox.hpp"
|
||||
|
|
|
|||
|
|
@ -64,10 +64,9 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Plane<T>& plane, TypeTag<Plane<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Plane<T>* plane, TypeTag<Plane<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Plane<T>& plane);
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Plane<T>& plane);
|
||||
}
|
||||
|
||||
#include <Nazara/Math/Plane.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -469,20 +469,19 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param plane The plane to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Plane<T>& plane)
|
||||
{
|
||||
return out << "Plane(Normal: " << plane.normal << "; Distance: " << plane.distance << ')';
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param plane The plane to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Plane<T>& plane)
|
||||
{
|
||||
return out << "Plane(Normal: " << plane.normal << "; Distance: " << plane.distance << ')';
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Quaternion<T>& quat, TypeTag<Quaternion<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Quaternion<T>* quat, TypeTag<Quaternion<T>>);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Quaternion<T>& quat);
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Quaternion<T>& quat);
|
||||
}
|
||||
|
||||
#include <Nazara/Math/Quaternion.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -927,20 +927,19 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param quat The quaternion to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Quaternion<T>& quat)
|
||||
{
|
||||
return out << "Quaternion(" << quat.w << " | " << quat.x << ", " << quat.y << ", " << quat.z << ')';
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param quat The quaternion to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Quaternion<T>& quat)
|
||||
{
|
||||
return out << "Quaternion(" << quat.w << " | " << quat.x << ", " << quat.y << ", " << quat.z << ')';
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Ray<T>& ray, TypeTag<Ray<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Ray<T>* ray, TypeTag<Ray<T>>);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Ray<T>& vec);
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Ray<T>& vec);
|
||||
}
|
||||
|
||||
#include <Nazara/Math/Ray.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -748,20 +748,20 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param ray The ray to output
|
||||
*/
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param ray The ray to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Ray<T>& ray)
|
||||
{
|
||||
return out << "Ray(origin: " << ray.origin << ", direction: " << ray.direction << ")";
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Ray<T>& ray)
|
||||
{
|
||||
return out << "Ray(origin: " << ray.origin << ", direction: " << ray.direction << ")";
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ namespace Nz
|
|||
Rect(Rect&&) noexcept = default;
|
||||
~Rect() = default;
|
||||
|
||||
bool ApproxEquals(const Rect& rect, T maxDifference = 0) const;
|
||||
|
||||
bool Contains(T X, T Y) const;
|
||||
bool Contains(const Rect& rect) const;
|
||||
bool Contains(const Vector2<T>& point) const;
|
||||
|
|
@ -88,10 +90,9 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Rect<T>& rect, TypeTag<Rect<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Rect<T>* rect, TypeTag<Rect<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Rect<T>& rect);
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Rect<T>& rect);
|
||||
}
|
||||
|
||||
#include <Nazara/Math/Rect.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -97,6 +97,13 @@ namespace Nz
|
|||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool Rect<T>::ApproxEquals(const Rect& rect, T maxDifference) const
|
||||
{
|
||||
return NumberEquals(x, rect.x, maxDifference) && NumberEquals(y, rect.y, maxDifference) &&
|
||||
NumberEquals(width, rect.width, maxDifference) && NumberEquals(height, rect.height, maxDifference);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Tests whether the rectangle contains the provided point inclusive of the edge of the rectangle
|
||||
* \return true if inclusive
|
||||
|
|
@ -517,8 +524,7 @@ namespace Nz
|
|||
template<typename T>
|
||||
bool Rect<T>::operator==(const Rect& rect) const
|
||||
{
|
||||
return NumberEquals(x, rect.x) && NumberEquals(y, rect.y) &&
|
||||
NumberEquals(width, rect.width) && NumberEquals(height, rect.height);
|
||||
return x == rect.x && y == rect.y && width == rect.width && height == rect.height;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -649,20 +655,20 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param rect The rectangle to output
|
||||
*/
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param rect The rectangle to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Rect<T>& rect)
|
||||
{
|
||||
return out << "Rect(" << rect.x << ", " << rect.y << ", " << rect.width << ", " << rect.height << ')';
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Rect<T>& rect)
|
||||
{
|
||||
return out << "Rect(" << rect.x << ", " << rect.y << ", " << rect.width << ", " << rect.height << ')';
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -82,10 +82,9 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Sphere<T>& sphere, TypeTag<Sphere<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Sphere<T>* sphere, TypeTag<Sphere<T>>);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Sphere<T>& sphere);
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Sphere<T>& sphere);
|
||||
}
|
||||
|
||||
#include <Nazara/Math/Sphere.inl>
|
||||
|
||||
|
|
|
|||
|
|
@ -649,20 +649,19 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param sphere The sphere to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Sphere<T>& sphere)
|
||||
{
|
||||
return out << "Sphere(" << sphere.x << ", " << sphere.y << ", " << sphere.z << "; " << sphere.radius << ')';
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param sphere The sphere to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Sphere<T>& sphere)
|
||||
{
|
||||
return out << "Sphere(" << sphere.x << ", " << sphere.y << ", " << sphere.z << "; " << sphere.radius << ')';
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -117,13 +117,13 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Vector2<T>& vector, TypeTag<Vector2<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector2<T>* vector, TypeTag<Vector2<T>>);
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Vector2<T>& vec);
|
||||
|
||||
template<typename T> Vector2<T> operator*(T scale, const Nz::Vector2<T>& vec);
|
||||
template<typename T> Vector2<T> operator/(T scale, const Nz::Vector2<T>& vec);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector2<T>& vec);
|
||||
|
||||
template<typename T> Nz::Vector2<T> operator*(T scale, const Nz::Vector2<T>& vec);
|
||||
template<typename T> Nz::Vector2<T> operator/(T scale, const Nz::Vector2<T>& vec);
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<class T> struct hash<Nz::Vector2<T>>;
|
||||
|
|
|
|||
|
|
@ -885,6 +885,43 @@ namespace Nz
|
|||
return vector;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param vec The vector to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Vector2<T>& vec)
|
||||
{
|
||||
return out << "Vector2(" << vec.x << ", " << vec.y << ')';
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Multiplies the components of the vector with a scalar
|
||||
* \return A vector where components are the product of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to multiply components with
|
||||
*/
|
||||
template<typename T>
|
||||
Vector2<T> operator*(T scale, const Vector2<T>& vec)
|
||||
{
|
||||
return Vector2<T>(scale * vec.x, scale * vec.y);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Divides the components of the vector with a scalar
|
||||
* \return A vector where components are the quotient of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to divide components with
|
||||
*/
|
||||
template<typename T>
|
||||
Vector2<T> operator/(T scale, const Vector2<T>& vec)
|
||||
{
|
||||
return Vector2<T>(scale / vec.x, scale / vec.y);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Serializes a Vector2
|
||||
* \return true if successfully serialized
|
||||
|
|
@ -924,46 +961,6 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param vec The vector to output
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Vector2<T>& vec)
|
||||
{
|
||||
return out << "Vector2(" << vec.x << ", " << vec.y << ')';
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Multiplies the components of the vector with a scalar
|
||||
* \return A vector where components are the product of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to multiply components with
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
Nz::Vector2<T> operator*(T scale, const Nz::Vector2<T>& vec)
|
||||
{
|
||||
return Nz::Vector2<T>(scale * vec.x, scale * vec.y);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Divides the components of the vector with a scalar
|
||||
* \return A vector where components are the quotient of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to divide components with
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
Nz::Vector2<T> operator/(T scale, const Nz::Vector2<T>& vec)
|
||||
{
|
||||
return Nz::Vector2<T>(scale / vec.x, scale / vec.y);
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<class T>
|
||||
|
|
|
|||
|
|
@ -137,13 +137,13 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Vector3<T>& vector, TypeTag<Vector3<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector3<T>* vector, TypeTag<Vector3<T>>);
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Vector3<T>& vec);
|
||||
|
||||
template<typename T> Vector3<T> operator*(T scale, const Vector3<T>& vec);
|
||||
template<typename T> Vector3<T> operator/(T scale, const Vector3<T>& vec);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector3<T>& vec);
|
||||
|
||||
template<typename T> Nz::Vector3<T> operator*(T scale, const Nz::Vector3<T>& vec);
|
||||
template<typename T> Nz::Vector3<T> operator/(T scale, const Nz::Vector3<T>& vec);
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<class T> struct hash<Nz::Vector3<T>>;
|
||||
|
|
|
|||
|
|
@ -1188,46 +1188,43 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param vec The vector to output
|
||||
*/
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param vec The vector to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Vector3<T>& vec)
|
||||
{
|
||||
return out << "Vector3(" << vec.x << ", " << vec.y << ", " << vec.z << ')';
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Vector3<T>& vec)
|
||||
{
|
||||
return out << "Vector3(" << vec.x << ", " << vec.y << ", " << vec.z << ')';
|
||||
}
|
||||
/*!
|
||||
* \brief Multiplies the components of the vector with a scalar
|
||||
* \return A vector where components are the product of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to multiply components with
|
||||
*/
|
||||
template<typename T>
|
||||
Vector3<T> operator*(T scale, const Vector3<T>& vec)
|
||||
{
|
||||
return Vector3<T>(scale * vec.x, scale * vec.y, scale * vec.z);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Multiplies the components of the vector with a scalar
|
||||
* \return A vector where components are the product of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to multiply components with
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
Nz::Vector3<T> operator*(T scale, const Nz::Vector3<T>& vec)
|
||||
{
|
||||
return Nz::Vector3<T>(scale * vec.x, scale * vec.y, scale * vec.z);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Divides the components of the vector with a scalar
|
||||
* \return A vector where components are the quotient of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to divide components with
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
Nz::Vector3<T> operator/(T scale, const Nz::Vector3<T>& vec)
|
||||
{
|
||||
return Nz::Vector3<T>(scale / vec.x, scale / vec.y, scale / vec.z);
|
||||
/*!
|
||||
* \brief Divides the components of the vector with a scalar
|
||||
* \return A vector where components are the quotient of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to divide components with
|
||||
*/
|
||||
template<typename T>
|
||||
Vector3<T> operator/(T scale, const Vector3<T>& vec)
|
||||
{
|
||||
return Vector3<T>(scale / vec.x, scale / vec.y, scale / vec.z);
|
||||
}
|
||||
}
|
||||
|
||||
namespace std
|
||||
|
|
|
|||
|
|
@ -113,13 +113,13 @@ namespace Nz
|
|||
|
||||
template<typename T> bool Serialize(SerializationContext& context, const Vector4<T>& vector, TypeTag<Vector4<T>>);
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector4<T>* vector, TypeTag<Vector4<T>>);
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Vector4<T>& vec);
|
||||
|
||||
template<typename T> Vector4<T> operator*(T scale, const Vector4<T>& vec);
|
||||
template<typename T> Vector4<T> operator/(T scale, const Vector4<T>& vec);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector4<T>& vec);
|
||||
|
||||
template<typename T> Nz::Vector4<T> operator*(T scale, const Nz::Vector4<T>& vec);
|
||||
template<typename T> Nz::Vector4<T> operator/(T scale, const Nz::Vector4<T>& vec);
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<class T> struct hash<Nz::Vector4<T>>;
|
||||
|
|
|
|||
|
|
@ -997,47 +997,43 @@ namespace Nz
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param vec The vector to output
|
||||
*/
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param vec The vector to output
|
||||
*/
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Vector4<T>& vec)
|
||||
{
|
||||
return out << "Vector4(" << vec.x << ", " << vec.y << ", " << vec.z << ", " << vec.w << ')';
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::Vector4<T>& vec)
|
||||
{
|
||||
return out << "Vector4(" << vec.x << ", " << vec.y << ", " << vec.z << ", " << vec.w << ')';
|
||||
}
|
||||
/*!
|
||||
* \brief Multiplies the components of the vector with a scalar
|
||||
* \return A vector where components are the product of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to multiply components with
|
||||
*/
|
||||
template<typename T>
|
||||
Vector4<T> operator*(T scale, const Vector4<T>& vec)
|
||||
{
|
||||
return Nz::Vector4<T>(scale * vec.x, scale * vec.y, scale * vec.z, scale * vec.w);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Multiplies the components of the vector with a scalar
|
||||
* \return A vector where components are the product of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to multiply components with
|
||||
*/
|
||||
|
||||
|
||||
template<typename T>
|
||||
Nz::Vector4<T> operator*(T scale, const Nz::Vector4<T>& vec)
|
||||
{
|
||||
return Nz::Vector4<T>(scale * vec.x, scale * vec.y, scale * vec.z, scale * vec.w);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Divides the components of the vector with a scalar
|
||||
* \return A vector where components are the quotient of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to divide components with
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
Nz::Vector4<T> operator/(T scale, const Nz::Vector4<T>& vec)
|
||||
{
|
||||
return Nz::Vector4<T>(scale / vec.x, scale / vec.y, scale / vec.z, scale / vec.w);
|
||||
/*!
|
||||
* \brief Divides the components of the vector with a scalar
|
||||
* \return A vector where components are the quotient of this vector and the scalar
|
||||
*
|
||||
* \param scale The scalar to divide components with
|
||||
*/
|
||||
template<typename T>
|
||||
Vector4<T> operator/(T scale, const Vector4<T>& vec)
|
||||
{
|
||||
return Nz::Vector4<T>(scale / vec.x, scale / vec.y, scale / vec.z, scale / vec.w);
|
||||
}
|
||||
}
|
||||
|
||||
namespace std
|
||||
|
|
|
|||
|
|
@ -769,18 +769,17 @@ namespace Nz
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param parameterList The ParameterList to output
|
||||
*/
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::ParameterList& parameterList)
|
||||
{
|
||||
out << parameterList.ToString();
|
||||
return out;
|
||||
/*!
|
||||
* \brief Output operator
|
||||
* \return The stream
|
||||
*
|
||||
* \param out The stream
|
||||
* \param parameterList The ParameterList to output
|
||||
*/
|
||||
std::ostream& operator<<(std::ostream& out, const Nz::ParameterList& parameterList)
|
||||
{
|
||||
out << parameterList.ToString();
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue