Rename Physics3D to BulletPhysics3D
This commit is contained in:
committed by
Jérôme Leclercq
parent
5cbc435e1a
commit
bd4c2d6ee7
@@ -1,7 +1,7 @@
|
||||
// this file was automatically generated and should not be edited
|
||||
|
||||
/*
|
||||
Nazara Engine - Physics3D module
|
||||
Nazara Engine - BulletPhysics3D module
|
||||
|
||||
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
|
||||
@@ -29,18 +29,18 @@
|
||||
#ifndef NAZARA_GLOBAL_PHYSICS3D_HPP
|
||||
#define NAZARA_GLOBAL_PHYSICS3D_HPP
|
||||
|
||||
#include <Nazara/Physics3D/Collider3D.hpp>
|
||||
#include <Nazara/Physics3D/Config.hpp>
|
||||
#include <Nazara/Physics3D/Constraint3D.hpp>
|
||||
#include <Nazara/Physics3D/Enums.hpp>
|
||||
#include <Nazara/Physics3D/Physics3D.hpp>
|
||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||
#include <Nazara/Physics3D/RigidBody3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletCollider3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletConstraint3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Enums.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletPhysics3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletPhysWorld3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletRigidBody3D.hpp>
|
||||
|
||||
#ifdef NAZARA_ENTT
|
||||
|
||||
#include <Nazara/Physics3D/Components.hpp>
|
||||
#include <Nazara/Physics3D/Systems.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Components.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Systems.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_COLLIDER3D_HPP
|
||||
#define NAZARA_PHYSICS3D_COLLIDER3D_HPP
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_BULLETCOLLIDER3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_BULLETCOLLIDER3D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Enums.hpp>
|
||||
#include <Nazara/Core/ObjectLibrary.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Physics3D/Config.hpp>
|
||||
#include <Nazara/Physics3D/Enums.hpp>
|
||||
#include <NazaraUtils/Signal.hpp>
|
||||
#include <NazaraUtils/SparsePtr.hpp>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
||||
class btBoxShape;
|
||||
class btCapsuleShape;
|
||||
@@ -34,13 +34,13 @@ namespace Nz
|
||||
class StaticMesh;
|
||||
struct Primitive;
|
||||
|
||||
class NAZARA_PHYSICS3D_API Collider3D
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletCollider3D
|
||||
{
|
||||
public:
|
||||
Collider3D() = default;
|
||||
Collider3D(const Collider3D&) = delete;
|
||||
Collider3D(Collider3D&&) = delete;
|
||||
virtual ~Collider3D();
|
||||
BulletCollider3D() = default;
|
||||
BulletCollider3D(const BulletCollider3D&) = delete;
|
||||
BulletCollider3D(BulletCollider3D&&) = delete;
|
||||
virtual ~BulletCollider3D();
|
||||
|
||||
virtual void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix = Matrix4f::Identity()) const = 0;
|
||||
|
||||
@@ -53,16 +53,16 @@ namespace Nz
|
||||
virtual btCollisionShape* GetShape() const = 0;
|
||||
virtual ColliderType3D GetType() const = 0;
|
||||
|
||||
Collider3D& operator=(const Collider3D&) = delete;
|
||||
Collider3D& operator=(Collider3D&&) = delete;
|
||||
BulletCollider3D& operator=(const BulletCollider3D&) = delete;
|
||||
BulletCollider3D& operator=(BulletCollider3D&&) = delete;
|
||||
|
||||
static std::shared_ptr<Collider3D> Build(const PrimitiveList& list);
|
||||
static std::shared_ptr<BulletCollider3D> Build(const PrimitiveList& list);
|
||||
|
||||
private:
|
||||
static std::shared_ptr<Collider3D> CreateGeomFromPrimitive(const Primitive& primitive);
|
||||
static std::shared_ptr<BulletCollider3D> CreateGeomFromPrimitive(const Primitive& primitive);
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API BoxCollider3D final : public Collider3D
|
||||
class NAZARA_BULLETPHYSICS3D_API BoxCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BoxCollider3D(const Vector3f& lengths);
|
||||
@@ -79,7 +79,7 @@ namespace Nz
|
||||
Vector3f m_lengths;
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API CapsuleCollider3D final : public Collider3D
|
||||
class NAZARA_BULLETPHYSICS3D_API CapsuleCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
CapsuleCollider3D(float length, float radius);
|
||||
@@ -98,7 +98,7 @@ namespace Nz
|
||||
float m_radius;
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API CompoundCollider3D final : public Collider3D
|
||||
class NAZARA_BULLETPHYSICS3D_API CompoundCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
struct ChildCollider;
|
||||
@@ -114,7 +114,7 @@ namespace Nz
|
||||
|
||||
struct ChildCollider
|
||||
{
|
||||
std::shared_ptr<Collider3D> collider;
|
||||
std::shared_ptr<BulletCollider3D> collider;
|
||||
Matrix4f offsetMatrix;
|
||||
};
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Nz
|
||||
std::vector<ChildCollider> m_childs;
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API ConeCollider3D final : public Collider3D
|
||||
class NAZARA_BULLETPHYSICS3D_API ConeCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
ConeCollider3D(float length, float radius);
|
||||
@@ -142,7 +142,7 @@ namespace Nz
|
||||
float m_radius;
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API ConvexCollider3D final : public Collider3D
|
||||
class NAZARA_BULLETPHYSICS3D_API ConvexCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
ConvexCollider3D(SparsePtr<const Vector3f> vertices, unsigned int vertexCount);
|
||||
@@ -157,7 +157,7 @@ namespace Nz
|
||||
std::unique_ptr<btConvexHullShape> m_shape;
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API CylinderCollider3D final : public Collider3D
|
||||
class NAZARA_BULLETPHYSICS3D_API CylinderCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
CylinderCollider3D(float length, float radius);
|
||||
@@ -177,7 +177,7 @@ namespace Nz
|
||||
float m_radius;
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API NullCollider3D final : public Collider3D
|
||||
class NAZARA_BULLETPHYSICS3D_API NullCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
NullCollider3D();
|
||||
@@ -194,7 +194,7 @@ namespace Nz
|
||||
std::unique_ptr<btEmptyShape> m_shape;
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API SphereCollider3D final : public Collider3D
|
||||
class NAZARA_BULLETPHYSICS3D_API SphereCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
SphereCollider3D(float radius);
|
||||
@@ -213,6 +213,6 @@ namespace Nz
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/Collider3D.inl>
|
||||
#include <Nazara/BulletPhysics3D/BulletCollider3D.inl>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_COLLIDER3D_HPP
|
||||
#endif // NAZARA_BULLETPHYSICS3D_BULLETCOLLIDER3D_HPP
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <memory>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/DebugOff.hpp>
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
74
include/Nazara/BulletPhysics3D/BulletConstraint3D.hpp
Normal file
74
include/Nazara/BulletPhysics3D/BulletConstraint3D.hpp
Normal file
@@ -0,0 +1,74 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_BULLETCONSTRAINT3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_BULLETCONSTRAINT3D_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletPhysWorld3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletRigidBody3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Core/HandledObject.hpp>
|
||||
#include <Nazara/Core/ObjectHandle.hpp>
|
||||
|
||||
class btTypedConstraint;
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class BulletConstraint3D;
|
||||
|
||||
using BulletConstraint3DHandle = ObjectHandle<BulletConstraint3D>;
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletConstraint3D : public HandledObject<BulletConstraint3D>
|
||||
{
|
||||
public:
|
||||
BulletConstraint3D(const BulletConstraint3D&) = delete;
|
||||
BulletConstraint3D(BulletConstraint3D&& constraint) noexcept;
|
||||
virtual ~BulletConstraint3D();
|
||||
|
||||
BulletRigidBody3D& GetBodyA();
|
||||
const BulletRigidBody3D& GetBodyA() const;
|
||||
BulletRigidBody3D& GetBodyB();
|
||||
const BulletRigidBody3D& GetBodyB() const;
|
||||
BulletPhysWorld3D& GetWorld();
|
||||
const BulletPhysWorld3D& GetWorld() const;
|
||||
|
||||
inline bool IsBodyCollisionEnabled() const;
|
||||
bool IsSingleBody() const;
|
||||
|
||||
BulletConstraint3D& operator=(const BulletConstraint3D&) = delete;
|
||||
BulletConstraint3D& operator=(BulletConstraint3D&& constraint) noexcept;
|
||||
|
||||
protected:
|
||||
BulletConstraint3D(std::unique_ptr<btTypedConstraint> constraint, bool disableCollisions = false);
|
||||
|
||||
template<typename T> T* GetConstraint();
|
||||
template<typename T> const T* GetConstraint() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btTypedConstraint> m_constraint;
|
||||
bool m_bodyCollisionEnabled;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletPivotConstraint3D : public BulletConstraint3D
|
||||
{
|
||||
public:
|
||||
BulletPivotConstraint3D(BulletRigidBody3D& first, const Vector3f& pivot);
|
||||
BulletPivotConstraint3D(BulletRigidBody3D& first, BulletRigidBody3D& second, const Vector3f& pivot, bool disableCollisions = false);
|
||||
BulletPivotConstraint3D(BulletRigidBody3D& first, BulletRigidBody3D& second, const Vector3f& firstAnchor, const Vector3f& secondAnchor, bool disableCollisions = false);
|
||||
~BulletPivotConstraint3D() = default;
|
||||
|
||||
Vector3f GetFirstAnchor() const;
|
||||
Vector3f GetSecondAnchor() const;
|
||||
|
||||
void SetFirstAnchor(const Vector3f& firstAnchor);
|
||||
void SetSecondAnchor(const Vector3f& secondAnchor);
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/BulletConstraint3D.inl>
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_BULLETCONSTRAINT3D_HPP
|
||||
27
include/Nazara/BulletPhysics3D/BulletConstraint3D.inl
Normal file
27
include/Nazara/BulletPhysics3D/BulletConstraint3D.inl
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline bool BulletConstraint3D::IsBodyCollisionEnabled() const
|
||||
{
|
||||
return m_bodyCollisionEnabled;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* BulletConstraint3D::GetConstraint()
|
||||
{
|
||||
return SafeCast<T*>(m_constraint.get());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* BulletConstraint3D::GetConstraint() const
|
||||
{
|
||||
return SafeCast<const T*>(m_constraint.get());
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
@@ -1,17 +1,17 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_PHYSWORLD3D_HPP
|
||||
#define NAZARA_PHYSICS3D_PHYSWORLD3D_HPP
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_BULLETPHYSWORLD3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_BULLETPHYSWORLD3D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Core/Time.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Physics3D/Config.hpp>
|
||||
#include <NazaraUtils/FunctionRef.hpp>
|
||||
#include <NazaraUtils/MovablePtr.hpp>
|
||||
|
||||
@@ -20,19 +20,19 @@ class btRigidBody;
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class RigidBody3D;
|
||||
class BulletRigidBody3D;
|
||||
|
||||
class NAZARA_PHYSICS3D_API PhysWorld3D
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletPhysWorld3D
|
||||
{
|
||||
friend RigidBody3D;
|
||||
friend BulletRigidBody3D;
|
||||
|
||||
public:
|
||||
struct RaycastHit;
|
||||
|
||||
PhysWorld3D();
|
||||
PhysWorld3D(const PhysWorld3D&) = delete;
|
||||
PhysWorld3D(PhysWorld3D&& ph) = delete;
|
||||
~PhysWorld3D();
|
||||
BulletPhysWorld3D();
|
||||
BulletPhysWorld3D(const BulletPhysWorld3D&) = delete;
|
||||
BulletPhysWorld3D(BulletPhysWorld3D&& ph) = delete;
|
||||
~BulletPhysWorld3D();
|
||||
|
||||
btDynamicsWorld* GetDynamicsWorld();
|
||||
Vector3f GetGravity() const;
|
||||
@@ -47,13 +47,13 @@ namespace Nz
|
||||
|
||||
void Step(Time timestep);
|
||||
|
||||
PhysWorld3D& operator=(const PhysWorld3D&) = delete;
|
||||
PhysWorld3D& operator=(PhysWorld3D&&) = delete;
|
||||
BulletPhysWorld3D& operator=(const BulletPhysWorld3D&) = delete;
|
||||
BulletPhysWorld3D& operator=(BulletPhysWorld3D&&) = delete;
|
||||
|
||||
struct RaycastHit
|
||||
{
|
||||
float fraction;
|
||||
RigidBody3D* hitBody = nullptr;
|
||||
BulletRigidBody3D* hitBody = nullptr;
|
||||
Vector3f hitPosition;
|
||||
Vector3f hitNormal;
|
||||
};
|
||||
@@ -72,4 +72,4 @@ namespace Nz
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_PHYSWORLD3D_HPP
|
||||
#endif // NAZARA_BULLETPHYSICS3D_BULLETPHYSWORLD3D_HPP
|
||||
33
include/Nazara/BulletPhysics3D/BulletPhysics3D.hpp
Normal file
33
include/Nazara/BulletPhysics3D/BulletPhysics3D.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletPhysics3D : public ModuleBase<BulletPhysics3D>
|
||||
{
|
||||
friend ModuleBase;
|
||||
|
||||
public:
|
||||
using Dependencies = TypeList<Core>;
|
||||
|
||||
struct Config {};
|
||||
|
||||
BulletPhysics3D(Config /*config*/);
|
||||
~BulletPhysics3D() = default;
|
||||
|
||||
private:
|
||||
static BulletPhysics3D* s_instance;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_HPP
|
||||
@@ -1,35 +1,35 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_RIGIDBODY3D_HPP
|
||||
#define NAZARA_PHYSICS3D_RIGIDBODY3D_HPP
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_BULLETRIGIDBODY3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_BULLETRIGIDBODY3D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletCollider3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Core/Enums.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Physics3D/Collider3D.hpp>
|
||||
#include <Nazara/Physics3D/Config.hpp>
|
||||
#include <NazaraUtils/MovablePtr.hpp>
|
||||
|
||||
class btRigidBody;
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class PhysWorld3D;
|
||||
class BulletPhysWorld3D;
|
||||
|
||||
class NAZARA_PHYSICS3D_API RigidBody3D
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletRigidBody3D
|
||||
{
|
||||
public:
|
||||
RigidBody3D(PhysWorld3D* world, const Matrix4f& mat = Matrix4f::Identity());
|
||||
RigidBody3D(PhysWorld3D* world, std::shared_ptr<Collider3D> geom, const Matrix4f& mat = Matrix4f::Identity());
|
||||
RigidBody3D(const RigidBody3D& object) = delete;
|
||||
RigidBody3D(RigidBody3D&& object) noexcept;
|
||||
~RigidBody3D();
|
||||
BulletRigidBody3D(BulletPhysWorld3D* world, const Matrix4f& mat = Matrix4f::Identity());
|
||||
BulletRigidBody3D(BulletPhysWorld3D* world, std::shared_ptr<BulletCollider3D> geom, const Matrix4f& mat = Matrix4f::Identity());
|
||||
BulletRigidBody3D(const BulletRigidBody3D& object) = delete;
|
||||
BulletRigidBody3D(BulletRigidBody3D&& object) noexcept;
|
||||
~BulletRigidBody3D();
|
||||
|
||||
void AddForce(const Vector3f& force, CoordSys coordSys = CoordSys::Global);
|
||||
void AddForce(const Vector3f& force, const Vector3f& point, CoordSys coordSys = CoordSys::Global);
|
||||
@@ -43,7 +43,7 @@ namespace Nz
|
||||
Boxf GetAABB() const;
|
||||
float GetAngularDamping() const;
|
||||
Vector3f GetAngularVelocity() const;
|
||||
inline const std::shared_ptr<Collider3D>& GetGeom() const;
|
||||
inline const std::shared_ptr<BulletCollider3D>& GetGeom() const;
|
||||
float GetLinearDamping() const;
|
||||
Vector3f GetLinearVelocity() const;
|
||||
float GetMass() const;
|
||||
@@ -53,7 +53,7 @@ namespace Nz
|
||||
inline btRigidBody* GetRigidBody() const;
|
||||
Quaternionf GetRotation() const;
|
||||
inline std::size_t GetUniqueIndex() const;
|
||||
inline PhysWorld3D* GetWorld() const;
|
||||
inline BulletPhysWorld3D* GetWorld() const;
|
||||
|
||||
bool IsSimulationEnabled() const;
|
||||
bool IsSleeping() const;
|
||||
@@ -61,7 +61,7 @@ namespace Nz
|
||||
|
||||
void SetAngularDamping(float angularDamping);
|
||||
void SetAngularVelocity(const Vector3f& angularVelocity);
|
||||
void SetGeom(std::shared_ptr<Collider3D> geom, bool recomputeInertia = true);
|
||||
void SetGeom(std::shared_ptr<BulletCollider3D> geom, bool recomputeInertia = true);
|
||||
void SetLinearDamping(float damping);
|
||||
void SetLinearVelocity(const Vector3f& velocity);
|
||||
void SetMass(float mass);
|
||||
@@ -76,20 +76,20 @@ namespace Nz
|
||||
|
||||
void WakeUp();
|
||||
|
||||
RigidBody3D& operator=(const RigidBody3D& object) = delete;
|
||||
RigidBody3D& operator=(RigidBody3D&& object) noexcept;
|
||||
BulletRigidBody3D& operator=(const BulletRigidBody3D& object) = delete;
|
||||
BulletRigidBody3D& operator=(BulletRigidBody3D&& object) noexcept;
|
||||
|
||||
protected:
|
||||
void Destroy();
|
||||
|
||||
private:
|
||||
std::shared_ptr<Collider3D> m_geom;
|
||||
std::shared_ptr<BulletCollider3D> m_geom;
|
||||
std::size_t m_bodyPoolIndex;
|
||||
btRigidBody* m_body;
|
||||
PhysWorld3D* m_world;
|
||||
BulletPhysWorld3D* m_world;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/RigidBody3D.inl>
|
||||
#include <Nazara/BulletPhysics3D/BulletRigidBody3D.inl>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_RIGIDBODY3D_HPP
|
||||
#endif // NAZARA_BULLETPHYSICS3D_BULLETRIGIDBODY3D_HPP
|
||||
34
include/Nazara/BulletPhysics3D/BulletRigidBody3D.inl
Normal file
34
include/Nazara/BulletPhysics3D/BulletRigidBody3D.inl
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline void BulletRigidBody3D::DisableSleeping()
|
||||
{
|
||||
return EnableSleeping(false);
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<BulletCollider3D>& BulletRigidBody3D::GetGeom() const
|
||||
{
|
||||
return m_geom;
|
||||
}
|
||||
|
||||
inline btRigidBody* BulletRigidBody3D::GetRigidBody() const
|
||||
{
|
||||
return m_body;
|
||||
}
|
||||
inline std::size_t BulletRigidBody3D::GetUniqueIndex() const
|
||||
{
|
||||
return m_bodyPoolIndex;
|
||||
}
|
||||
|
||||
inline BulletPhysWorld3D* BulletRigidBody3D::GetWorld() const
|
||||
{
|
||||
return m_world;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
@@ -1,7 +1,7 @@
|
||||
// this file was automatically generated and should not be edited
|
||||
|
||||
/*
|
||||
Nazara Engine - Physics3D module
|
||||
Nazara Engine - BulletPhysics3D module
|
||||
|
||||
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_COMPONENTS_HPP
|
||||
#define NAZARA_PHYSICS3D_COMPONENTS_HPP
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_COMPONENTS_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_COMPONENTS_HPP
|
||||
|
||||
#include <Nazara/Physics3D/Components/RigidBody3DComponent.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Components/BulletRigidBody3DComponent.hpp>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_COMPONENTS_HPP
|
||||
#endif // NAZARA_BULLETPHYSICS3D_COMPONENTS_HPP
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_COMPONENTS_BULLETRIGIDBODY3DCOMPONENT_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_COMPONENTS_BULLETRIGIDBODY3DCOMPONENT_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletRigidBody3D.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletRigidBody3DComponent : public BulletRigidBody3D
|
||||
{
|
||||
friend class BulletPhysics3DSystem;
|
||||
|
||||
public:
|
||||
using BulletRigidBody3D::BulletRigidBody3D;
|
||||
BulletRigidBody3DComponent(const BulletRigidBody3DComponent&) = default;
|
||||
BulletRigidBody3DComponent(BulletRigidBody3DComponent&&) noexcept = default;
|
||||
~BulletRigidBody3DComponent() = default;
|
||||
|
||||
BulletRigidBody3DComponent& operator=(const BulletRigidBody3DComponent&) = default;
|
||||
BulletRigidBody3DComponent& operator=(BulletRigidBody3DComponent&&) noexcept = default;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Components/BulletRigidBody3DComponent.inl>
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_COMPONENTS_BULLETRIGIDBODY3DCOMPONENT_HPP
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/DebugOff.hpp>
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Nazara Engine - Physics3D module
|
||||
Nazara Engine - BulletPhysics3D module
|
||||
|
||||
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
|
||||
@@ -24,25 +24,25 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_CONFIG_HPP
|
||||
#define NAZARA_PHYSICS3D_CONFIG_HPP
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_CONFIG_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_CONFIG_HPP
|
||||
|
||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||
|
||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||
#define NAZARA_PHYSICS3D_SAFE 1
|
||||
#define NAZARA_BULLETPHYSICS3D_SAFE 1
|
||||
|
||||
/// Vérification des valeurs et types de certaines constantes
|
||||
#include <Nazara/Physics3D/ConfigCheck.hpp>
|
||||
#include <Nazara/BulletPhysics3D/ConfigCheck.hpp>
|
||||
|
||||
#if defined(NAZARA_STATIC)
|
||||
#define NAZARA_PHYSICS3D_API
|
||||
#define NAZARA_BULLETPHYSICS3D_API
|
||||
#else
|
||||
#ifdef NAZARA_PHYSICS3D_BUILD
|
||||
#define NAZARA_PHYSICS3D_API NAZARA_EXPORT
|
||||
#ifdef NAZARA_BULLETPHYSICS3D_BUILD
|
||||
#define NAZARA_BULLETPHYSICS3D_API NAZARA_EXPORT
|
||||
#else
|
||||
#define NAZARA_PHYSICS3D_API NAZARA_IMPORT
|
||||
#define NAZARA_BULLETPHYSICS3D_API NAZARA_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_CONFIG_HPP
|
||||
#endif // NAZARA_BULLETPHYSICS3D_CONFIG_HPP
|
||||
10
include/Nazara/BulletPhysics3D/ConfigCheck.hpp
Normal file
10
include/Nazara/BulletPhysics3D/ConfigCheck.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_CONFIGCHECK_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_CONFIGCHECK_HPP
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_CONFIGCHECK_HPP
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// no header guards
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// no header guards
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_ENUMS_HPP
|
||||
#define NAZARA_PHYSICS3D_ENUMS_HPP
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_ENUMS_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_ENUMS_HPP
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -27,4 +27,4 @@ namespace Nz
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_ENUMS_HPP
|
||||
#endif // NAZARA_BULLETPHYSICS3D_ENUMS_HPP
|
||||
@@ -1,7 +1,7 @@
|
||||
// this file was automatically generated and should not be edited
|
||||
|
||||
/*
|
||||
Nazara Engine - Physics3D module
|
||||
Nazara Engine - BulletPhysics3D module
|
||||
|
||||
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_SYSTEMS_HPP
|
||||
#define NAZARA_PHYSICS3D_SYSTEMS_HPP
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_SYSTEMS_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_SYSTEMS_HPP
|
||||
|
||||
#include <Nazara/Physics3D/Systems/Physics3DSystem.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Systems/BulletPhysics3DSystem.hpp>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_SYSTEMS_HPP
|
||||
#endif // NAZARA_BULLETPHYSICS3D_SYSTEMS_HPP
|
||||
@@ -0,0 +1,65 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_SYSTEMS_BULLETPHYSICS3DSYSTEM_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_SYSTEMS_BULLETPHYSICS3DSYSTEM_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletPhysWorld3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Components/BulletRigidBody3DComponent.hpp>
|
||||
#include <Nazara/Core/Time.hpp>
|
||||
#include <Nazara/Utils/TypeList.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletPhysics3DSystem
|
||||
{
|
||||
public:
|
||||
static constexpr Int64 ExecutionOrder = 0;
|
||||
using Components = TypeList<BulletRigidBody3DComponent, class NodeComponent>;
|
||||
|
||||
struct RaycastHit;
|
||||
|
||||
BulletPhysics3DSystem(entt::registry& registry);
|
||||
BulletPhysics3DSystem(const BulletPhysics3DSystem&) = delete;
|
||||
BulletPhysics3DSystem(BulletPhysics3DSystem&&) = delete;
|
||||
~BulletPhysics3DSystem();
|
||||
|
||||
template<typename... Args> BulletRigidBody3DComponent CreateRigidBody(Args&&... args);
|
||||
|
||||
inline BulletPhysWorld3D& GetPhysWorld();
|
||||
inline const BulletPhysWorld3D& GetPhysWorld() const;
|
||||
|
||||
bool RaycastQueryFirst(const Vector3f& from, const Vector3f& to, RaycastHit* hitInfo = nullptr);
|
||||
|
||||
void Update(Time elapsedTime);
|
||||
|
||||
BulletPhysics3DSystem& operator=(const BulletPhysics3DSystem&) = delete;
|
||||
BulletPhysics3DSystem& operator=(BulletPhysics3DSystem&&) = delete;
|
||||
|
||||
struct RaycastHit : BulletPhysWorld3D::RaycastHit
|
||||
{
|
||||
entt::handle hitEntity;
|
||||
};
|
||||
|
||||
private:
|
||||
void OnConstruct(entt::registry& registry, entt::entity entity);
|
||||
void OnDestruct(entt::registry& registry, entt::entity entity);
|
||||
|
||||
std::vector<entt::entity> m_physicsEntities;
|
||||
entt::registry& m_registry;
|
||||
entt::observer m_physicsConstructObserver;
|
||||
entt::scoped_connection m_constructConnection;
|
||||
entt::scoped_connection m_destructConnection;
|
||||
BulletPhysWorld3D m_physWorld;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Systems/BulletPhysics3DSystem.inl>
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_SYSTEMS_BULLETPHYSICS3DSYSTEM_HPP
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
template<typename... Args>
|
||||
BulletRigidBody3DComponent BulletPhysics3DSystem::CreateRigidBody(Args&&... args)
|
||||
{
|
||||
return BulletRigidBody3DComponent(&m_physWorld, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
inline BulletPhysWorld3D& BulletPhysics3DSystem::GetPhysWorld()
|
||||
{
|
||||
return m_physWorld;
|
||||
}
|
||||
|
||||
inline const BulletPhysWorld3D& BulletPhysics3DSystem::GetPhysWorld() const
|
||||
{
|
||||
return m_physWorld;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_COMPONENTS_RIGIDBODY3DCOMPONENT_HPP
|
||||
#define NAZARA_PHYSICS3D_COMPONENTS_RIGIDBODY3DCOMPONENT_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Physics3D/RigidBody3D.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_PHYSICS3D_API RigidBody3DComponent : public RigidBody3D
|
||||
{
|
||||
friend class Physics3DSystem;
|
||||
|
||||
public:
|
||||
using RigidBody3D::RigidBody3D;
|
||||
RigidBody3DComponent(const RigidBody3DComponent&) = default;
|
||||
RigidBody3DComponent(RigidBody3DComponent&&) noexcept = default;
|
||||
~RigidBody3DComponent() = default;
|
||||
|
||||
RigidBody3DComponent& operator=(const RigidBody3DComponent&) = default;
|
||||
RigidBody3DComponent& operator=(RigidBody3DComponent&&) noexcept = default;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/Components/RigidBody3DComponent.inl>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_COMPONENTS_RIGIDBODY3DCOMPONENT_HPP
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_CONFIGCHECK_HPP
|
||||
#define NAZARA_PHYSICS3D_CONFIGCHECK_HPP
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_CONFIGCHECK_HPP
|
||||
@@ -1,74 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_CONSTRAINT3D_HPP
|
||||
#define NAZARA_PHYSICS3D_CONSTRAINT3D_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/HandledObject.hpp>
|
||||
#include <Nazara/Core/ObjectHandle.hpp>
|
||||
#include <Nazara/Physics3D/Config.hpp>
|
||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||
#include <Nazara/Physics3D/RigidBody3D.hpp>
|
||||
|
||||
class btTypedConstraint;
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class Constraint3D;
|
||||
|
||||
using Constraint3DHandle = ObjectHandle<Constraint3D>;
|
||||
|
||||
class NAZARA_PHYSICS3D_API Constraint3D : public HandledObject<Constraint3D>
|
||||
{
|
||||
public:
|
||||
Constraint3D(const Constraint3D&) = delete;
|
||||
Constraint3D(Constraint3D&& constraint) noexcept;
|
||||
virtual ~Constraint3D();
|
||||
|
||||
RigidBody3D& GetBodyA();
|
||||
const RigidBody3D& GetBodyA() const;
|
||||
RigidBody3D& GetBodyB();
|
||||
const RigidBody3D& GetBodyB() const;
|
||||
PhysWorld3D& GetWorld();
|
||||
const PhysWorld3D& GetWorld() const;
|
||||
|
||||
inline bool IsBodyCollisionEnabled() const;
|
||||
bool IsSingleBody() const;
|
||||
|
||||
Constraint3D& operator=(const Constraint3D&) = delete;
|
||||
Constraint3D& operator=(Constraint3D&& constraint) noexcept;
|
||||
|
||||
protected:
|
||||
Constraint3D(std::unique_ptr<btTypedConstraint> constraint, bool disableCollisions = false);
|
||||
|
||||
template<typename T> T* GetConstraint();
|
||||
template<typename T> const T* GetConstraint() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btTypedConstraint> m_constraint;
|
||||
bool m_bodyCollisionEnabled;
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API PivotConstraint3D : public Constraint3D
|
||||
{
|
||||
public:
|
||||
PivotConstraint3D(RigidBody3D& first, const Vector3f& pivot);
|
||||
PivotConstraint3D(RigidBody3D& first, RigidBody3D& second, const Vector3f& pivot, bool disableCollisions = false);
|
||||
PivotConstraint3D(RigidBody3D& first, RigidBody3D& second, const Vector3f& firstAnchor, const Vector3f& secondAnchor, bool disableCollisions = false);
|
||||
~PivotConstraint3D() = default;
|
||||
|
||||
Vector3f GetFirstAnchor() const;
|
||||
Vector3f GetSecondAnchor() const;
|
||||
|
||||
void SetFirstAnchor(const Vector3f& firstAnchor);
|
||||
void SetSecondAnchor(const Vector3f& secondAnchor);
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/Constraint3D.inl>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_CONSTRAINT3D_HPP
|
||||
@@ -1,29 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Constraint3D.hpp>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline bool Constraint3D::IsBodyCollisionEnabled() const
|
||||
{
|
||||
return m_bodyCollisionEnabled;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* Constraint3D::GetConstraint()
|
||||
{
|
||||
return SafeCast<T*>(m_constraint.get());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* Constraint3D::GetConstraint() const
|
||||
{
|
||||
return SafeCast<const T*>(m_constraint.get());
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/DebugOff.hpp>
|
||||
@@ -1,33 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_HPP
|
||||
#define NAZARA_PHYSICS3D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
#include <Nazara/Physics3D/Config.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_PHYSICS3D_API Physics3D : public ModuleBase<Physics3D>
|
||||
{
|
||||
friend ModuleBase;
|
||||
|
||||
public:
|
||||
using Dependencies = TypeList<Core>;
|
||||
|
||||
struct Config {};
|
||||
|
||||
Physics3D(Config /*config*/);
|
||||
~Physics3D() = default;
|
||||
|
||||
private:
|
||||
static Physics3D* s_instance;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_HPP
|
||||
@@ -1,34 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline void RigidBody3D::DisableSleeping()
|
||||
{
|
||||
return EnableSleeping(false);
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<Collider3D>& RigidBody3D::GetGeom() const
|
||||
{
|
||||
return m_geom;
|
||||
}
|
||||
|
||||
inline btRigidBody* RigidBody3D::GetRigidBody() const
|
||||
{
|
||||
return m_body;
|
||||
}
|
||||
inline std::size_t RigidBody3D::GetUniqueIndex() const
|
||||
{
|
||||
return m_bodyPoolIndex;
|
||||
}
|
||||
|
||||
inline PhysWorld3D* RigidBody3D::GetWorld() const
|
||||
{
|
||||
return m_world;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/DebugOff.hpp>
|
||||
@@ -1,65 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS3D_SYSTEMS_PHYSICS3DSYSTEM_HPP
|
||||
#define NAZARA_PHYSICS3D_SYSTEMS_PHYSICS3DSYSTEM_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Time.hpp>
|
||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||
#include <Nazara/Physics3D/Components/RigidBody3DComponent.hpp>
|
||||
#include <NazaraUtils/TypeList.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_PHYSICS3D_API Physics3DSystem
|
||||
{
|
||||
public:
|
||||
static constexpr Int64 ExecutionOrder = 0;
|
||||
using Components = TypeList<RigidBody3DComponent, class NodeComponent>;
|
||||
|
||||
struct RaycastHit;
|
||||
|
||||
Physics3DSystem(entt::registry& registry);
|
||||
Physics3DSystem(const Physics3DSystem&) = delete;
|
||||
Physics3DSystem(Physics3DSystem&&) = delete;
|
||||
~Physics3DSystem();
|
||||
|
||||
template<typename... Args> RigidBody3DComponent CreateRigidBody(Args&&... args);
|
||||
|
||||
inline PhysWorld3D& GetPhysWorld();
|
||||
inline const PhysWorld3D& GetPhysWorld() const;
|
||||
|
||||
bool RaycastQueryFirst(const Vector3f& from, const Vector3f& to, RaycastHit* hitInfo = nullptr);
|
||||
|
||||
void Update(Time elapsedTime);
|
||||
|
||||
Physics3DSystem& operator=(const Physics3DSystem&) = delete;
|
||||
Physics3DSystem& operator=(Physics3DSystem&&) = delete;
|
||||
|
||||
struct RaycastHit : PhysWorld3D::RaycastHit
|
||||
{
|
||||
entt::handle hitEntity;
|
||||
};
|
||||
|
||||
private:
|
||||
void OnConstruct(entt::registry& registry, entt::entity entity);
|
||||
void OnDestruct(entt::registry& registry, entt::entity entity);
|
||||
|
||||
std::vector<entt::entity> m_physicsEntities;
|
||||
entt::registry& m_registry;
|
||||
entt::observer m_physicsConstructObserver;
|
||||
entt::scoped_connection m_constructConnection;
|
||||
entt::scoped_connection m_destructConnection;
|
||||
PhysWorld3D m_physWorld;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/Systems/Physics3DSystem.inl>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_SYSTEMS_PHYSICS3DSYSTEM_HPP
|
||||
@@ -1,26 +0,0 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
template<typename... Args>
|
||||
RigidBody3DComponent Physics3DSystem::CreateRigidBody(Args&&... args)
|
||||
{
|
||||
return RigidBody3DComponent(&m_physWorld, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
inline PhysWorld3D& Physics3DSystem::GetPhysWorld()
|
||||
{
|
||||
return m_physWorld;
|
||||
}
|
||||
|
||||
inline const PhysWorld3D& Physics3DSystem::GetPhysWorld() const
|
||||
{
|
||||
return m_physWorld;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user