Physics3D: Rename ::GeomType to Nz::ColliderType3D

This commit is contained in:
Lynix 2016-10-14 17:27:30 +02:00
parent 9a7767867b
commit 9b48c9ee37
3 changed files with 45 additions and 42 deletions

View File

@ -54,7 +54,7 @@ namespace Nz
virtual float ComputeVolume() const; virtual float ComputeVolume() const;
NewtonCollision* GetHandle(PhysWorld3D* world) const; NewtonCollision* GetHandle(PhysWorld3D* world) const;
virtual GeomType GetType() const = 0; virtual ColliderType3D GetType() const = 0;
Collider3D& operator=(const Collider3D&) = delete; Collider3D& operator=(const Collider3D&) = delete;
Collider3D& operator=(Collider3D&&) = delete; Collider3D& operator=(Collider3D&&) = delete;
@ -90,7 +90,7 @@ namespace Nz
float ComputeVolume() const override; float ComputeVolume() const override;
Vector3f GetLengths() const; Vector3f GetLengths() const;
GeomType GetType() const override; ColliderType3D GetType() const override;
template<typename... Args> static BoxCollider3DRef New(Args&&... args); template<typename... Args> static BoxCollider3DRef New(Args&&... args);
@ -114,7 +114,7 @@ namespace Nz
float GetLength() const; float GetLength() const;
float GetRadius() const; float GetRadius() const;
GeomType GetType() const override; ColliderType3D GetType() const override;
template<typename... Args> static CapsuleCollider3DRef New(Args&&... args); template<typename... Args> static CapsuleCollider3DRef New(Args&&... args);
@ -137,7 +137,7 @@ namespace Nz
CompoundCollider3D(Collider3D** geoms, std::size_t geomCount); CompoundCollider3D(Collider3D** geoms, std::size_t geomCount);
const std::vector<Collider3DRef>& GetGeoms() const; const std::vector<Collider3DRef>& GetGeoms() const;
GeomType GetType() const override; ColliderType3D GetType() const override;
template<typename... Args> static CompoundCollider3DRef New(Args&&... args); template<typename... Args> static CompoundCollider3DRef New(Args&&... args);
@ -160,7 +160,7 @@ namespace Nz
float GetLength() const; float GetLength() const;
float GetRadius() const; float GetRadius() const;
GeomType GetType() const override; ColliderType3D GetType() const override;
template<typename... Args> static ConeCollider3DRef New(Args&&... args); template<typename... Args> static ConeCollider3DRef New(Args&&... args);
@ -183,7 +183,7 @@ namespace Nz
ConvexCollider3D(const void* vertices, unsigned int vertexCount, unsigned int stride = sizeof(Vector3f), float tolerance = 0.002f, const Matrix4f& transformMatrix = Matrix4f::Identity()); ConvexCollider3D(const void* vertices, unsigned int vertexCount, unsigned int stride = sizeof(Vector3f), float tolerance = 0.002f, const Matrix4f& transformMatrix = Matrix4f::Identity());
ConvexCollider3D(const void* vertices, unsigned int vertexCount, unsigned int stride, float tolerance, const Vector3f& translation, const Quaternionf& rotation = Quaternionf::Identity()); ConvexCollider3D(const void* vertices, unsigned int vertexCount, unsigned int stride, float tolerance, const Vector3f& translation, const Quaternionf& rotation = Quaternionf::Identity());
GeomType GetType() const override; ColliderType3D GetType() const override;
template<typename... Args> static ConvexCollider3DRef New(Args&&... args); template<typename... Args> static ConvexCollider3DRef New(Args&&... args);
@ -209,7 +209,7 @@ namespace Nz
float GetLength() const; float GetLength() const;
float GetRadius() const; float GetRadius() const;
GeomType GetType() const override; ColliderType3D GetType() const override;
template<typename... Args> static CylinderCollider3DRef New(Args&&... args); template<typename... Args> static CylinderCollider3DRef New(Args&&... args);
@ -233,7 +233,7 @@ namespace Nz
void ComputeInertialMatrix(Vector3f* inertia, Vector3f* center) const override; void ComputeInertialMatrix(Vector3f* inertia, Vector3f* center) const override;
GeomType GetType() const override; ColliderType3D GetType() const override;
template<typename... Args> static NullCollider3DRef New(Args&&... args); template<typename... Args> static NullCollider3DRef New(Args&&... args);
@ -256,7 +256,7 @@ namespace Nz
float ComputeVolume() const override; float ComputeVolume() const override;
float GetRadius() const; float GetRadius() const;
GeomType GetType() const override; ColliderType3D GetType() const override;
template<typename... Args> static SphereCollider3DRef New(Args&&... args); template<typename... Args> static SphereCollider3DRef New(Args&&... args);

View File

@ -4,24 +4,27 @@
#pragma once #pragma once
#ifndef NAZARA_ENUMS_PHYSICS_HPP #ifndef NAZARA_ENUMS_PHYSICS3D_HPP
#define NAZARA_ENUMS_PHYSICS_HPP #define NAZARA_ENUMS_PHYSICS3D_HPP
enum GeomType namespace Nz
{ {
GeomType_Box, enum ColliderType3D
GeomType_Capsule, {
GeomType_Cone, ColliderType3D_Box,
GeomType_Compound, ColliderType3D_Capsule,
GeomType_ConvexHull, ColliderType3D_Cone,
GeomType_Cylinder, ColliderType3D_Compound,
GeomType_Heightfield, ColliderType3D_ConvexHull,
GeomType_Null, ColliderType3D_Cylinder,
GeomType_Scene, ColliderType3D_Heightfield,
GeomType_Sphere, ColliderType3D_Null,
GeomType_Tree, ColliderType3D_Scene,
ColliderType3D_Sphere,
ColliderType3D_Tree,
GeomType_Max = GeomType_Tree ColliderType3D_Max = ColliderType3D_Tree
};
}; };
#endif // NAZARA_ENUMS_PHYSICS_HPP #endif // NAZARA_ENUMS_PHYSICS3D_HPP

View File

@ -193,9 +193,9 @@ namespace Nz
return m_lengths; return m_lengths;
} }
GeomType BoxCollider3D::GetType() const ColliderType3D BoxCollider3D::GetType() const
{ {
return GeomType_Box; return ColliderType3D_Box;
} }
NewtonCollision* BoxCollider3D::CreateHandle(PhysWorld3D* world) const NewtonCollision* BoxCollider3D::CreateHandle(PhysWorld3D* world) const
@ -227,9 +227,9 @@ namespace Nz
return m_radius; return m_radius;
} }
GeomType CapsuleCollider3D::GetType() const ColliderType3D CapsuleCollider3D::GetType() const
{ {
return GeomType_Capsule; return ColliderType3D_Capsule;
} }
NewtonCollision* CapsuleCollider3D::CreateHandle(PhysWorld3D* world) const NewtonCollision* CapsuleCollider3D::CreateHandle(PhysWorld3D* world) const
@ -251,9 +251,9 @@ namespace Nz
return m_geoms; return m_geoms;
} }
GeomType CompoundCollider3D::GetType() const ColliderType3D CompoundCollider3D::GetType() const
{ {
return GeomType_Compound; return ColliderType3D_Compound;
} }
NewtonCollision* CompoundCollider3D::CreateHandle(PhysWorld3D* world) const NewtonCollision* CompoundCollider3D::CreateHandle(PhysWorld3D* world) const
@ -263,7 +263,7 @@ namespace Nz
NewtonCompoundCollisionBeginAddRemove(compoundCollision); NewtonCompoundCollisionBeginAddRemove(compoundCollision);
for (const Collider3DRef& geom : m_geoms) for (const Collider3DRef& geom : m_geoms)
{ {
if (geom->GetType() == GeomType_Compound) if (geom->GetType() == ColliderType3D_Compound)
{ {
CompoundCollider3D* compoundGeom = static_cast<CompoundCollider3D*>(geom.Get()); CompoundCollider3D* compoundGeom = static_cast<CompoundCollider3D*>(geom.Get());
for (const Collider3DRef& piece : compoundGeom->GetGeoms()) for (const Collider3DRef& piece : compoundGeom->GetGeoms())
@ -301,9 +301,9 @@ namespace Nz
return m_radius; return m_radius;
} }
GeomType ConeCollider3D::GetType() const ColliderType3D ConeCollider3D::GetType() const
{ {
return GeomType_Cone; return ColliderType3D_Cone;
} }
NewtonCollision* ConeCollider3D::CreateHandle(PhysWorld3D* world) const NewtonCollision* ConeCollider3D::CreateHandle(PhysWorld3D* world) const
@ -335,9 +335,9 @@ namespace Nz
{ {
} }
GeomType ConvexCollider3D::GetType() const ColliderType3D ConvexCollider3D::GetType() const
{ {
return GeomType_Compound; return ColliderType3D_Compound;
} }
NewtonCollision* ConvexCollider3D::CreateHandle(PhysWorld3D* world) const NewtonCollision* ConvexCollider3D::CreateHandle(PhysWorld3D* world) const
@ -369,9 +369,9 @@ namespace Nz
return m_radius; return m_radius;
} }
GeomType CylinderCollider3D::GetType() const ColliderType3D CylinderCollider3D::GetType() const
{ {
return GeomType_Cylinder; return ColliderType3D_Cylinder;
} }
NewtonCollision* CylinderCollider3D::CreateHandle(PhysWorld3D* world) const NewtonCollision* CylinderCollider3D::CreateHandle(PhysWorld3D* world) const
@ -385,9 +385,9 @@ namespace Nz
{ {
} }
GeomType NullCollider3D::GetType() const ColliderType3D NullCollider3D::GetType() const
{ {
return GeomType_Null; return ColliderType3D_Null;
} }
void NullCollider3D::ComputeInertialMatrix(Vector3f* inertia, Vector3f* center) const void NullCollider3D::ComputeInertialMatrix(Vector3f* inertia, Vector3f* center) const
@ -436,9 +436,9 @@ namespace Nz
return m_radius; return m_radius;
} }
GeomType SphereCollider3D::GetType() const ColliderType3D SphereCollider3D::GetType() const
{ {
return GeomType_Sphere; return ColliderType3D_Sphere;
} }
NewtonCollision* SphereCollider3D::CreateHandle(PhysWorld3D* world) const NewtonCollision* SphereCollider3D::CreateHandle(PhysWorld3D* world) const