Rename ChipmunkPhysics2D and JoltPhysics3D to Physics[2D|3D]
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" 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_PHYSCHARACTER3DCOMPONENT_HPP
|
||||
#define NAZARA_PHYSICS3D_COMPONENTS_PHYSCHARACTER3DCOMPONENT_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Physics3D/PhysCharacter3D.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_PHYSICS3D_API PhysCharacter3DComponent : public PhysCharacter3D
|
||||
{
|
||||
friend class Physics3DSystem;
|
||||
|
||||
public:
|
||||
inline PhysCharacter3DComponent(const PhysCharacter3D::Settings& settings);
|
||||
PhysCharacter3DComponent(const PhysCharacter3DComponent&) = default;
|
||||
PhysCharacter3DComponent(PhysCharacter3DComponent&&) noexcept = default;
|
||||
~PhysCharacter3DComponent() = default;
|
||||
|
||||
PhysCharacter3DComponent& operator=(const PhysCharacter3DComponent&) = default;
|
||||
PhysCharacter3DComponent& operator=(PhysCharacter3DComponent&&) noexcept = default;
|
||||
|
||||
private:
|
||||
inline void Construct(PhysWorld3D& world);
|
||||
|
||||
std::unique_ptr<PhysCharacter3D::Settings> m_settings;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/Components/PhysCharacter3DComponent.inl>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_COMPONENTS_PHYSCHARACTER3DCOMPONENT_HPP
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" 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 PhysCharacter3DComponent::PhysCharacter3DComponent(const PhysCharacter3D::Settings& settings)
|
||||
{
|
||||
m_settings = std::make_unique<PhysCharacter3D::Settings>(settings);
|
||||
}
|
||||
|
||||
inline void PhysCharacter3DComponent::Construct(PhysWorld3D& world)
|
||||
{
|
||||
assert(m_settings);
|
||||
Create(world, *m_settings);
|
||||
m_settings.reset();
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/DebugOff.hpp>
|
||||
40
include/Nazara/Physics3D/Components/RigidBody3DComponent.hpp
Normal file
40
include/Nazara/Physics3D/Components/RigidBody3DComponent.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" 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>
|
||||
#include <variant>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_PHYSICS3D_API RigidBody3DComponent : public RigidBody3D
|
||||
{
|
||||
friend class Physics3DSystem;
|
||||
|
||||
public:
|
||||
inline RigidBody3DComponent(const RigidBody3D::DynamicSettings& settings);
|
||||
inline RigidBody3DComponent(const RigidBody3D::StaticSettings& settings);
|
||||
RigidBody3DComponent(const RigidBody3DComponent&) = default;
|
||||
RigidBody3DComponent(RigidBody3DComponent&&) noexcept = default;
|
||||
~RigidBody3DComponent() = default;
|
||||
|
||||
RigidBody3DComponent& operator=(const RigidBody3DComponent&) = default;
|
||||
RigidBody3DComponent& operator=(RigidBody3DComponent&&) noexcept = default;
|
||||
|
||||
private:
|
||||
inline void Construct(PhysWorld3D& world);
|
||||
|
||||
using Setting = std::variant<RigidBody3D::DynamicSettings, RigidBody3D::StaticSettings>;
|
||||
std::unique_ptr<Setting> m_settings;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/Components/RigidBody3DComponent.inl>
|
||||
|
||||
#endif // NAZARA_PHYSICS3D_COMPONENTS_RIGIDBODY3DCOMPONENT_HPP
|
||||
31
include/Nazara/Physics3D/Components/RigidBody3DComponent.inl
Normal file
31
include/Nazara/Physics3D/Components/RigidBody3DComponent.inl
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" 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 <cassert>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline RigidBody3DComponent::RigidBody3DComponent(const RigidBody3D::DynamicSettings& settings)
|
||||
{
|
||||
m_settings = std::make_unique<Setting>(settings);
|
||||
}
|
||||
|
||||
inline RigidBody3DComponent::RigidBody3DComponent(const RigidBody3D::StaticSettings& settings)
|
||||
{
|
||||
m_settings = std::make_unique<Setting>(settings);
|
||||
}
|
||||
|
||||
inline void RigidBody3DComponent::Construct(PhysWorld3D& world)
|
||||
{
|
||||
assert(m_settings);
|
||||
std::visit([&](auto&& arg)
|
||||
{
|
||||
Create(world, arg);
|
||||
}, *m_settings);
|
||||
m_settings.reset();
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Physics3D/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user