diff --git a/include/Nazara/Math/Angle.hpp b/include/Nazara/Math/Angle.hpp index 26bccdb36..fe559e958 100644 --- a/include/Nazara/Math/Angle.hpp +++ b/include/Nazara/Math/Angle.hpp @@ -74,7 +74,7 @@ namespace Nz static Angle FromRadians(T ang); static Angle Zero(); - T angle; + T value; }; template diff --git a/include/Nazara/Math/Angle.inl b/include/Nazara/Math/Angle.inl index 78b1d845d..fab999436 100644 --- a/include/Nazara/Math/Angle.inl +++ b/include/Nazara/Math/Angle.inl @@ -151,7 +151,7 @@ namespace Nz */ template Angle::Angle(T value) : - angle(value) + value(value) { } @@ -214,7 +214,7 @@ namespace Nz template Angle& Angle::MakeZero() { - angle = T(0); + value = T(0); return *this; } @@ -231,9 +231,9 @@ namespace Nz constexpr T limit = Detail::AngleUtils::template GetLimit(); constexpr T twoLimit = limit * T(2); - angle = std::fmod(angle, twoLimit); - if (angle < T(0)) - angle += twoLimit; + value = std::fmod(value, twoLimit); + if (value < T(0)) + value += twoLimit; } /*! @@ -245,7 +245,7 @@ namespace Nz template Angle& Angle::Set(const Angle& ang) { - angle = RadianToDegree(ang.angle); + value = RadianToDegree(ang.value); return *this; } @@ -258,7 +258,7 @@ namespace Nz template Angle& Angle::Set(const Angle& ang) { - angle = DegreeToRadian(ang.angle); + value = DegreeToRadian(ang.value); return *this; } @@ -270,7 +270,7 @@ namespace Nz template Angle& Angle::Set(const Angle& ang) { - angle = ang.angle; + value = ang.value; return *this; } @@ -285,7 +285,7 @@ namespace Nz template Angle& Angle::Set(const Angle& ang) { - angle = static_cast(ang.angle); + value = static_cast(ang.value); return *this; } @@ -296,7 +296,7 @@ namespace Nz template T Angle::ToDegrees() const { - return Detail::AngleUtils::ToDegrees(angle); + return Detail::AngleUtils::ToDegrees(value); } /*! @@ -318,7 +318,7 @@ namespace Nz template EulerAngles Angle::ToEulerAngles() const { - return EulerAngles(0, 0, ToDegreeAngle().angle); + return EulerAngles(0, 0, ToDegrees()); } /*! @@ -344,7 +344,7 @@ namespace Nz template T Angle::ToRadians() const { - return Detail::AngleUtils::ToRadians(angle); + return Detail::AngleUtils::ToRadians(value); } /*! @@ -364,7 +364,7 @@ namespace Nz template String Angle::ToString() const { - return Detail::AngleUtils::ToString(angle); + return Detail::AngleUtils::ToString(value); } /*! @@ -376,7 +376,7 @@ namespace Nz template Angle Angle::operator+(const Angle& other) const { - return Angle(angle + other.angle); + return Angle(value + other.value); } /*! @@ -388,7 +388,7 @@ namespace Nz template Angle Angle::operator-(const Angle& other) const { - return Angle(angle - other.angle); + return Angle(value - other.value); } /*! @@ -400,7 +400,7 @@ namespace Nz template Angle Angle::operator*(T scalar) const { - return Angle(angle * scalar); + return Angle(value * scalar); } /*! @@ -412,7 +412,7 @@ namespace Nz template Angle Angle::operator/(T divider) const { - return Angle(angle / divider); + return Angle(value / divider); } /*! @@ -424,7 +424,7 @@ namespace Nz template Angle& Angle::operator+=(const Angle& other) { - angle += other.angle; + value += other.value; return *this; } @@ -437,7 +437,7 @@ namespace Nz template Angle& Angle::operator-=(const Angle& other) { - angle -= other.angle; + value -= other.value; return *this; } @@ -450,7 +450,7 @@ namespace Nz template Angle& Angle::operator*=(T scalar) { - angle *= scalar; + value *= scalar; return *this; } @@ -463,7 +463,7 @@ namespace Nz template Angle& Angle::operator/=(T divider) { - angle /= divider; + value /= divider; return *this; } @@ -476,7 +476,7 @@ namespace Nz template bool Angle::operator==(const Angle& other) const { - return NumberEquals(angle, other.angle, Detail::AngleUtils::template GetEpsilon()); + return NumberEquals(value, other.value, Detail::AngleUtils::template GetEpsilon()); } /*! @@ -488,7 +488,7 @@ namespace Nz template bool Angle::operator!=(const Angle& other) const { - return !NumberEquals(angle, other.angle, Detail::AngleUtils::template GetEpsilon()); + return !NumberEquals(value, other.value, Detail::AngleUtils::template GetEpsilon()); } /*! @@ -538,7 +538,7 @@ namespace Nz template bool Serialize(SerializationContext& context, const Angle& angle, TypeTag>) { - if (!Serialize(context, angle.angle)) + if (!Serialize(context, angle.value)) return false; return true; @@ -554,7 +554,7 @@ namespace Nz template bool Unserialize(SerializationContext& context, Angle* angle, TypeTag>) { - if (!Unserialize(context, &angle->angle)) + if (!Unserialize(context, &angle->value)) return false; return true; @@ -571,7 +571,7 @@ namespace Nz template Nz::Angle operator*(T scale, const Nz::Angle& angle) { - return Nz::Angle(scale * angle.angle); + return Nz::Angle(scale * angle.value); } /*! @@ -584,7 +584,7 @@ Nz::Angle operator*(T scale, const Nz::Angle& angle) template Nz::Angle operator/(T scale, const Nz::Angle& angle) { - return Nz::Angle(scale / angle.angle); + return Nz::Angle(scale / angle.value); } /*! @@ -597,7 +597,7 @@ Nz::Angle operator/(T scale, const Nz::Angle& angle) template std::ostream& operator<<(std::ostream& out, const Nz::Angle& angle) { - return Nz::Detail::AngleUtils::ToString(out, angle.angle); + return Nz::Detail::AngleUtils::ToString(out, angle.value); } #include diff --git a/src/Nazara/Physics2D/Constraint2D.cpp b/src/Nazara/Physics2D/Constraint2D.cpp index c4c92fd4c..e4ad5e407 100644 --- a/src/Nazara/Physics2D/Constraint2D.cpp +++ b/src/Nazara/Physics2D/Constraint2D.cpp @@ -164,7 +164,7 @@ namespace Nz DampedRotarySpringConstraint2D::DampedRotarySpringConstraint2D(RigidBody2D& first, RigidBody2D& second, const RadianAnglef& restAngle, float stiffness, float damping) : - Constraint2D(first.GetWorld(), cpDampedRotarySpringNew(first.GetHandle(), second.GetHandle(), restAngle.angle, stiffness, damping)) + Constraint2D(first.GetWorld(), cpDampedRotarySpringNew(first.GetHandle(), second.GetHandle(), restAngle.value, stiffness, damping)) { } @@ -190,7 +190,7 @@ namespace Nz void DampedRotarySpringConstraint2D::SetRestAngle(const RadianAnglef& newAngle) { - cpDampedRotarySpringSetRestAngle(m_constraint, newAngle.angle); + cpDampedRotarySpringSetRestAngle(m_constraint, newAngle.value); } void DampedRotarySpringConstraint2D::SetStiffness(float newStiffness) @@ -334,7 +334,7 @@ namespace Nz void RatchetConstraint2D::SetAngle(const RadianAnglef& angle) { - cpRatchetJointSetAngle(m_constraint, angle.angle); + cpRatchetJointSetAngle(m_constraint, angle.value); } void RatchetConstraint2D::SetPhase(float phase) @@ -349,7 +349,7 @@ namespace Nz RotaryLimitConstraint2D::RotaryLimitConstraint2D(RigidBody2D& first, RigidBody2D& second, const RadianAnglef& minAngle, const RadianAnglef& maxAngle) : - Constraint2D(first.GetWorld(), cpRotaryLimitJointNew(first.GetHandle(), second.GetHandle(), minAngle.angle, maxAngle.angle)) + Constraint2D(first.GetWorld(), cpRotaryLimitJointNew(first.GetHandle(), second.GetHandle(), minAngle.value, maxAngle.value)) { } @@ -365,12 +365,12 @@ namespace Nz void RotaryLimitConstraint2D::SetMaxAngle(const RadianAnglef& maxAngle) { - cpRotaryLimitJointSetMax(m_constraint, maxAngle.angle); + cpRotaryLimitJointSetMax(m_constraint, maxAngle.value); } void RotaryLimitConstraint2D::SetMinAngle(const RadianAnglef& minAngle) { - cpRotaryLimitJointSetMin(m_constraint, minAngle.angle); + cpRotaryLimitJointSetMin(m_constraint, minAngle.value); } diff --git a/src/Nazara/Physics2D/RigidBody2D.cpp b/src/Nazara/Physics2D/RigidBody2D.cpp index 99013467e..0d8c120b6 100644 --- a/src/Nazara/Physics2D/RigidBody2D.cpp +++ b/src/Nazara/Physics2D/RigidBody2D.cpp @@ -307,7 +307,7 @@ namespace Nz void RigidBody2D::SetAngularVelocity(const RadianAnglef& angularVelocity) { - cpBodySetAngularVelocity(m_handle, angularVelocity.angle); + cpBodySetAngularVelocity(m_handle, angularVelocity.value); } void RigidBody2D::SetElasticity(float friction) @@ -450,7 +450,7 @@ namespace Nz void RigidBody2D::SetRotation(const RadianAnglef& rotation) { - cpBodySetAngle(m_handle, rotation.angle); + cpBodySetAngle(m_handle, rotation.value); if (m_isStatic) { m_world->RegisterPostStep(this, [](Nz::RigidBody2D* body) diff --git a/tests/Engine/Graphics/Billboard.cpp b/tests/Engine/Graphics/Billboard.cpp index de0bc8d02..651274bfd 100644 --- a/tests/Engine/Graphics/Billboard.cpp +++ b/tests/Engine/Graphics/Billboard.cpp @@ -20,7 +20,7 @@ SCENARIO("Billboard", "[GRAPHICS][BILLBOARD]") { REQUIRE(billboard.GetColor() == materialColor); REQUIRE(billboard.GetMaterial().Get() == materialRef.Get()); - REQUIRE(billboard.GetRotation().angle == Approx(0.f)); + REQUIRE(billboard.GetRotation().value == Approx(0.f)); REQUIRE(billboard.GetSize() == Nz::Vector2f(64.f, 64.f)); // Default sizes } diff --git a/tests/Engine/Physics2D/RigidBody2D.cpp b/tests/Engine/Physics2D/RigidBody2D.cpp index 749fa6f5c..98af5c13b 100644 --- a/tests/Engine/Physics2D/RigidBody2D.cpp +++ b/tests/Engine/Physics2D/RigidBody2D.cpp @@ -130,7 +130,7 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") CHECK(body.GetGeom() == box); CHECK(body.GetMass() == Approx(mass)); CHECK(body.GetPosition() == position); - CHECK(body.GetRotation().angle == Approx(0.f)); + CHECK(body.GetRotation().value == Approx(0.f)); CHECK(body.GetUserdata() == &userData); CHECK(body.GetVelocity() == Nz::Vector2f::Zero()); @@ -196,8 +196,8 @@ SCENARIO("RigidBody2D", "[PHYSICS2D][RIGIDBODY2D]") THEN("It is also counter-clockwise") { - CHECK(body.GetAngularVelocity().angle >= 0.f); - CHECK(body.GetRotation().angle >= 0.f); + CHECK(body.GetAngularVelocity().value >= 0.f); + CHECK(body.GetRotation().value >= 0.f); } } } @@ -321,7 +321,7 @@ void EQUALITY(const Nz::RigidBody2D& left, const Nz::RigidBody2D& right) CHECK(left.GetHandle() != right.GetHandle()); CHECK(left.GetMass() == Approx(right.GetMass())); CHECK(left.GetPosition() == right.GetPosition()); - CHECK(left.GetRotation().angle == Approx(right.GetRotation().angle)); + CHECK(left.GetRotation().value == Approx(right.GetRotation().value)); CHECK(left.GetUserdata() == right.GetUserdata()); CHECK(left.GetVelocity() == right.GetVelocity()); }