Replace floating point angle by Angle class instance
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Graphics/InstancedRenderable.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Math/Angle.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -34,14 +35,14 @@ namespace Nz
|
||||
std::unique_ptr<InstancedRenderable> Clone() const override;
|
||||
|
||||
inline const Color& GetColor() const;
|
||||
inline float GetRotation() const;
|
||||
inline const RadianAnglef& GetRotation() const;
|
||||
inline const Vector2f& GetSize() const;
|
||||
|
||||
inline void SetColor(const Color& color);
|
||||
inline void SetDefaultMaterial();
|
||||
inline void SetMaterial(MaterialRef material, bool resizeBillboard = true);
|
||||
inline void SetMaterial(std::size_t skinIndex, MaterialRef material, bool resizeBillboard = true);
|
||||
inline void SetRotation(float rotation);
|
||||
inline void SetRotation(const RadianAnglef& rotation);
|
||||
inline void SetSize(const Vector2f& size);
|
||||
inline void SetSize(float sizeX, float sizeY);
|
||||
inline void SetTexture(TextureRef texture, bool resizeBillboard = true);
|
||||
@@ -58,7 +59,7 @@ namespace Nz
|
||||
Color m_color;
|
||||
Vector2f m_sinCos;
|
||||
Vector2f m_size;
|
||||
float m_rotation;
|
||||
RadianAnglef m_rotation;
|
||||
|
||||
static BillboardLibrary::LibraryMap s_library;
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Nz
|
||||
* \return Current rotation
|
||||
*/
|
||||
|
||||
inline float Billboard::GetRotation() const
|
||||
inline const RadianAnglef& Billboard::GetRotation() const
|
||||
{
|
||||
return m_rotation;
|
||||
}
|
||||
@@ -161,10 +161,12 @@ namespace Nz
|
||||
* \param rotation Rotation for the billboard
|
||||
*/
|
||||
|
||||
inline void Billboard::SetRotation(float rotation)
|
||||
inline void Billboard::SetRotation(const RadianAnglef& rotation)
|
||||
{
|
||||
m_rotation = rotation;
|
||||
m_sinCos.Set(std::sin(m_rotation), std::cos(m_rotation));
|
||||
|
||||
auto sincos = rotation.GetSinCos();
|
||||
m_sinCos.Set(sincos.first, sincos.second);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/MovablePtr.hpp>
|
||||
#include <Nazara/Math/Angle.hpp>
|
||||
#include <Nazara/Physics2D/Config.hpp>
|
||||
#include <Nazara/Physics2D/PhysWorld2D.hpp>
|
||||
#include <Nazara/Physics2D/RigidBody2D.hpp>
|
||||
@@ -95,15 +96,15 @@ namespace Nz
|
||||
class NAZARA_PHYSICS2D_API DampedRotarySpringConstraint2D : public Constraint2D
|
||||
{
|
||||
public:
|
||||
DampedRotarySpringConstraint2D(RigidBody2D& first, RigidBody2D& second, float restAngle, float stiffness, float damping);
|
||||
DampedRotarySpringConstraint2D(RigidBody2D& first, RigidBody2D& second, const RadianAnglef& restAngle, float stiffness, float damping);
|
||||
~DampedRotarySpringConstraint2D() = default;
|
||||
|
||||
float GetDamping() const;
|
||||
float GetRestAngle() const;
|
||||
RadianAnglef GetRestAngle() const;
|
||||
float GetStiffness() const;
|
||||
|
||||
void SetDamping(float newDamping);
|
||||
void SetRestAngle(float newAngle);
|
||||
void SetRestAngle(const RadianAnglef& newAngle);
|
||||
void SetStiffness(float newStiffness);
|
||||
|
||||
template<typename... Args> static DampedRotarySpringConstraint2DRef New(Args&&... args);
|
||||
@@ -200,11 +201,11 @@ namespace Nz
|
||||
RatchetConstraint2D(RigidBody2D& first, RigidBody2D& second, float phase, float ratchet);
|
||||
~RatchetConstraint2D() = default;
|
||||
|
||||
float GetAngle() const;
|
||||
RadianAnglef GetAngle() const;
|
||||
float GetPhase() const;
|
||||
float GetRatchet() const;
|
||||
|
||||
void SetAngle(float angle);
|
||||
void SetAngle(const RadianAnglef& angle);
|
||||
void SetPhase(float phase);
|
||||
void SetRatchet(float ratchet);
|
||||
|
||||
@@ -219,14 +220,14 @@ namespace Nz
|
||||
class NAZARA_PHYSICS2D_API RotaryLimitConstraint2D : public Constraint2D
|
||||
{
|
||||
public:
|
||||
RotaryLimitConstraint2D(RigidBody2D& first, RigidBody2D& second, float minAngle, float maxAngle);
|
||||
RotaryLimitConstraint2D(RigidBody2D& first, RigidBody2D& second, const RadianAnglef& minAngle, const RadianAnglef& maxAngle);
|
||||
~RotaryLimitConstraint2D() = default;
|
||||
|
||||
float GetMaxAngle() const;
|
||||
float GetMinAngle() const;
|
||||
RadianAnglef GetMaxAngle() const;
|
||||
RadianAnglef GetMinAngle() const;
|
||||
|
||||
void SetMaxAngle(float maxAngle);
|
||||
void SetMinAngle(float minAngle);
|
||||
void SetMaxAngle(const RadianAnglef& maxAngle);
|
||||
void SetMinAngle(const RadianAnglef& minAngle);
|
||||
|
||||
template<typename... Args> static RotaryLimitConstraint2DRef New(Args&&... args);
|
||||
};
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/Signal.hpp>
|
||||
#include <Nazara/Math/Angle.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Physics2D/Config.hpp>
|
||||
#include <Nazara/Physics2D/RigidBody2D.hpp>
|
||||
@@ -33,7 +34,7 @@ namespace Nz
|
||||
using ContactPostSolveCallback = std::function<void(PhysWorld2D& world, Arbiter2D& arbiter, RigidBody2D& bodyA, RigidBody2D& bodyB, void* userdata)>;
|
||||
using ContactStartCallback = std::function<bool(PhysWorld2D& world, Arbiter2D& arbiter, RigidBody2D& bodyA, RigidBody2D& bodyB, void* userdata)>;
|
||||
|
||||
using DebugDrawCircleCallback = std::function<void(const Vector2f& origin, float rotation, float radius, Color outlineColor, Color fillColor, void* userdata)>;
|
||||
using DebugDrawCircleCallback = std::function<void(const Vector2f& origin, const RadianAnglef& rotation, float radius, Color outlineColor, Color fillColor, void* userdata)>;
|
||||
using DebugDrawDotCallback = std::function<void(const Vector2f& origin, float radius, Color color, void* userdata)>;
|
||||
using DebugDrawPolygonCallback = std::function<void(const Vector2f* vertices, std::size_t vertexCount, float radius, Color outlineColor, Color fillColor, void* userdata)>;
|
||||
using DebugDrawSegmentCallback = std::function<void(const Vector2f& first, const Vector2f& second, Color color, void* userdata)>;
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace Nz
|
||||
|
||||
inline void SetAngularDamping(float angularDamping);
|
||||
void SetAngularVelocity(float angularVelocity);
|
||||
void SetFriction(std::size_t shapeIndex, float friction);
|
||||
void SetGeom(Collider2DRef geom, bool recomputeMoment = true);
|
||||
void SetMass(float mass, bool recomputeMoment = true);
|
||||
void SetMassCenter(const Vector2f& center, CoordSys coordSys = CoordSys_Local);
|
||||
|
||||
Reference in New Issue
Block a user