Physics2D/Collider2D: Add some missing getters
This commit is contained in:
parent
e4d547316d
commit
ffc833439d
|
|
@ -135,6 +135,10 @@ Nazara Engine:
|
||||||
- Integrated Unicode Data
|
- Integrated Unicode Data
|
||||||
- Added CullingList::FillWithAllEntries method
|
- Added CullingList::FillWithAllEntries method
|
||||||
- Fixed ObjectHandle movement sometimes not resetting its internal pointer
|
- Fixed ObjectHandle movement sometimes not resetting its internal pointer
|
||||||
|
- Added BoxCollider2D::GetRadius
|
||||||
|
- Added CircleCollider2D::GetOffset
|
||||||
|
- Added ConvexCollider2D::GetVertices
|
||||||
|
- Added SegmentCollider2D::GetThickness()
|
||||||
|
|
||||||
Nazara Development Kit:
|
Nazara Development Kit:
|
||||||
- Added ImageWidget (#139)
|
- Added ImageWidget (#139)
|
||||||
|
|
|
||||||
|
|
@ -43,19 +43,19 @@ namespace Nz
|
||||||
|
|
||||||
virtual float ComputeMomentOfInertia(float mass) const = 0;
|
virtual float ComputeMomentOfInertia(float mass) const = 0;
|
||||||
|
|
||||||
inline Nz::UInt32 GetCategoryMask() const;
|
inline UInt32 GetCategoryMask() const;
|
||||||
inline Nz::UInt32 GetCollisionGroup() const;
|
inline UInt32 GetCollisionGroup() const;
|
||||||
inline unsigned int GetCollisionId() const;
|
inline unsigned int GetCollisionId() const;
|
||||||
inline Nz::UInt32 GetCollisionMask() const;
|
inline UInt32 GetCollisionMask() const;
|
||||||
|
|
||||||
virtual ColliderType2D GetType() const = 0;
|
virtual ColliderType2D GetType() const = 0;
|
||||||
|
|
||||||
inline bool IsTrigger() const;
|
inline bool IsTrigger() const;
|
||||||
|
|
||||||
inline void SetCategoryMask(Nz::UInt32 categoryMask);
|
inline void SetCategoryMask(UInt32 categoryMask);
|
||||||
inline void SetCollisionGroup(Nz::UInt32 groupId);
|
inline void SetCollisionGroup(UInt32 groupId);
|
||||||
inline void SetCollisionId(unsigned int typeId);
|
inline void SetCollisionId(unsigned int typeId);
|
||||||
inline void SetCollisionMask(Nz::UInt32 mask);
|
inline void SetCollisionMask(UInt32 mask);
|
||||||
inline void SetTrigger(bool trigger);
|
inline void SetTrigger(bool trigger);
|
||||||
|
|
||||||
Collider2D& operator=(const Collider2D&) = delete;
|
Collider2D& operator=(const Collider2D&) = delete;
|
||||||
|
|
@ -68,10 +68,10 @@ namespace Nz
|
||||||
virtual void CreateShapes(RigidBody2D* body, std::vector<cpShape*>& shapes) const = 0;
|
virtual void CreateShapes(RigidBody2D* body, std::vector<cpShape*>& shapes) const = 0;
|
||||||
|
|
||||||
bool m_trigger;
|
bool m_trigger;
|
||||||
Nz::UInt32 m_categoryMask;
|
UInt32 m_categoryMask;
|
||||||
Nz::UInt32 m_collisionGroup;
|
UInt32 m_collisionGroup;
|
||||||
unsigned int m_collisionId;
|
unsigned int m_collisionId;
|
||||||
Nz::UInt32 m_collisionMask;
|
UInt32 m_collisionMask;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual std::vector<cpShape*> GenerateShapes(RigidBody2D* body) const;
|
virtual std::vector<cpShape*> GenerateShapes(RigidBody2D* body) const;
|
||||||
|
|
@ -92,6 +92,7 @@ namespace Nz
|
||||||
|
|
||||||
float ComputeMomentOfInertia(float mass) const override;
|
float ComputeMomentOfInertia(float mass) const override;
|
||||||
|
|
||||||
|
inline float GetRadius() const;
|
||||||
inline const Rectf& GetRect() const;
|
inline const Rectf& GetRect() const;
|
||||||
inline Vector2f GetSize() const;
|
inline Vector2f GetSize() const;
|
||||||
ColliderType2D GetType() const override;
|
ColliderType2D GetType() const override;
|
||||||
|
|
@ -117,6 +118,7 @@ namespace Nz
|
||||||
|
|
||||||
float ComputeMomentOfInertia(float mass) const override;
|
float ComputeMomentOfInertia(float mass) const override;
|
||||||
|
|
||||||
|
inline const Vector2f& GetOffset() const;
|
||||||
inline float GetRadius() const;
|
inline float GetRadius() const;
|
||||||
ColliderType2D GetType() const override;
|
ColliderType2D GetType() const override;
|
||||||
|
|
||||||
|
|
@ -165,6 +167,7 @@ namespace Nz
|
||||||
float ComputeMomentOfInertia(float mass) const override;
|
float ComputeMomentOfInertia(float mass) const override;
|
||||||
|
|
||||||
ColliderType2D GetType() const override;
|
ColliderType2D GetType() const override;
|
||||||
|
inline const std::vector<Vector2d>& GetVertices() const;
|
||||||
|
|
||||||
template<typename... Args> static ConvexCollider2DRef New(Args&&... args);
|
template<typename... Args> static ConvexCollider2DRef New(Args&&... args);
|
||||||
|
|
||||||
|
|
@ -210,6 +213,7 @@ namespace Nz
|
||||||
inline const Vector2f& GetFirstPoint() const;
|
inline const Vector2f& GetFirstPoint() const;
|
||||||
inline float GetLength() const;
|
inline float GetLength() const;
|
||||||
inline const Vector2f& GetSecondPoint() const;
|
inline const Vector2f& GetSecondPoint() const;
|
||||||
|
inline float GetThickness() const;
|
||||||
ColliderType2D GetType() const override;
|
ColliderType2D GetType() const override;
|
||||||
|
|
||||||
template<typename... Args> static SegmentCollider2DRef New(Args&&... args);
|
template<typename... Args> static SegmentCollider2DRef New(Args&&... args);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// This file is part of the "Nazara Engine - Physics 2D module"
|
// This file is part of the "Nazara Engine - Physics 2D module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
#include <Nazara/Physics2D/Collider2D.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <Nazara/Physics2D/Debug.hpp>
|
#include <Nazara/Physics2D/Debug.hpp>
|
||||||
|
|
||||||
|
|
@ -16,12 +17,12 @@ namespace Nz
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Nz::UInt32 Collider2D::GetCategoryMask() const
|
inline UInt32 Collider2D::GetCategoryMask() const
|
||||||
{
|
{
|
||||||
return m_categoryMask;
|
return m_categoryMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Nz::UInt32 Collider2D::GetCollisionGroup() const
|
inline UInt32 Collider2D::GetCollisionGroup() const
|
||||||
{
|
{
|
||||||
return m_collisionGroup;
|
return m_collisionGroup;
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +32,7 @@ namespace Nz
|
||||||
return m_collisionId;
|
return m_collisionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Nz::UInt32 Collider2D::GetCollisionMask() const
|
inline UInt32 Collider2D::GetCollisionMask() const
|
||||||
{
|
{
|
||||||
return m_collisionMask;
|
return m_collisionMask;
|
||||||
}
|
}
|
||||||
|
|
@ -41,12 +42,12 @@ namespace Nz
|
||||||
return m_trigger;
|
return m_trigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Collider2D::SetCategoryMask(Nz::UInt32 categoryMask)
|
inline void Collider2D::SetCategoryMask(UInt32 categoryMask)
|
||||||
{
|
{
|
||||||
m_categoryMask = categoryMask;
|
m_categoryMask = categoryMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Collider2D::SetCollisionGroup(Nz::UInt32 groupId)
|
inline void Collider2D::SetCollisionGroup(UInt32 groupId)
|
||||||
{
|
{
|
||||||
m_collisionGroup = groupId;
|
m_collisionGroup = groupId;
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +57,7 @@ namespace Nz
|
||||||
m_collisionId = typeId;
|
m_collisionId = typeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Collider2D::SetCollisionMask(Nz::UInt32 mask)
|
inline void Collider2D::SetCollisionMask(UInt32 mask)
|
||||||
{
|
{
|
||||||
m_collisionMask = mask;
|
m_collisionMask = mask;
|
||||||
}
|
}
|
||||||
|
|
@ -66,6 +67,11 @@ namespace Nz
|
||||||
m_trigger = trigger;
|
m_trigger = trigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline float BoxCollider2D::GetRadius() const
|
||||||
|
{
|
||||||
|
return m_radius;
|
||||||
|
}
|
||||||
|
|
||||||
inline const Rectf& BoxCollider2D::GetRect() const
|
inline const Rectf& BoxCollider2D::GetRect() const
|
||||||
{
|
{
|
||||||
return m_rect;
|
return m_rect;
|
||||||
|
|
@ -85,6 +91,11 @@ namespace Nz
|
||||||
return object.release();
|
return object.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const Vector2f& CircleCollider2D::GetOffset() const
|
||||||
|
{
|
||||||
|
return m_offset;
|
||||||
|
}
|
||||||
|
|
||||||
inline float CircleCollider2D::GetRadius() const
|
inline float CircleCollider2D::GetRadius() const
|
||||||
{
|
{
|
||||||
return m_radius;
|
return m_radius;
|
||||||
|
|
@ -99,7 +110,7 @@ namespace Nz
|
||||||
return object.release();
|
return object.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::vector<Collider2DRef>& Nz::CompoundCollider2D::GetGeoms() const
|
inline const std::vector<Collider2DRef>& CompoundCollider2D::GetGeoms() const
|
||||||
{
|
{
|
||||||
return m_geoms;
|
return m_geoms;
|
||||||
}
|
}
|
||||||
|
|
@ -113,6 +124,11 @@ namespace Nz
|
||||||
return object.release();
|
return object.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const std::vector<Vector2d>& ConvexCollider2D::GetVertices() const
|
||||||
|
{
|
||||||
|
return m_vertices;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
ConvexCollider2DRef ConvexCollider2D::New(Args&&... args)
|
ConvexCollider2DRef ConvexCollider2D::New(Args&&... args)
|
||||||
{
|
{
|
||||||
|
|
@ -153,6 +169,11 @@ namespace Nz
|
||||||
return m_second;
|
return m_second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline float SegmentCollider2D::GetThickness() const
|
||||||
|
{
|
||||||
|
return m_thickness;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
SegmentCollider2DRef SegmentCollider2D::New(Args&&... args)
|
SegmentCollider2DRef SegmentCollider2D::New(Args&&... args)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue