Rename Physics3D to BulletPhysics3D
This commit is contained in:
committed by
Jérôme Leclercq
parent
5cbc435e1a
commit
bd4c2d6ee7
@@ -2,7 +2,7 @@
|
||||
#include <Nazara/Core.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Network.hpp>
|
||||
#include <Nazara/Physics3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <NazaraSDK/Application.hpp>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <Nazara/Platform.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Math/PidController.hpp>
|
||||
#include <Nazara/Physics3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
@@ -20,14 +20,14 @@ int main()
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Application<Nz::Graphics, Nz::Physics3D> app;
|
||||
Nz::Application<Nz::Graphics, Nz::BulletPhysics3D> app;
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
|
||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||
|
||||
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||
Nz::Physics3DSystem& physSytem = world.AddSystem<Nz::Physics3DSystem>();
|
||||
Nz::BulletPhysics3DSystem& physSytem = world.AddSystem<Nz::BulletPhysics3DSystem>();
|
||||
physSytem.GetPhysWorld().SetGravity(Nz::Vector3f::Zero());
|
||||
|
||||
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||
@@ -140,7 +140,7 @@ int main()
|
||||
auto& entityNode = playerEntity.emplace<Nz::NodeComponent>();
|
||||
entityNode.SetPosition(Nz::Vector3f(12.5f, 0.f, 25.f));
|
||||
|
||||
auto& entityPhys = playerEntity.emplace<Nz::RigidBody3DComponent>(physSytem.CreateRigidBody(shipCollider));
|
||||
auto& entityPhys = playerEntity.emplace<Nz::BulletRigidBody3DComponent>(physSytem.CreateRigidBody(shipCollider));
|
||||
entityPhys.SetMass(50.f);
|
||||
entityPhys.SetAngularDamping(0.1f);
|
||||
entityPhys.SetLinearDamping(0.5f);
|
||||
@@ -179,7 +179,7 @@ int main()
|
||||
entityNode.SetPosition(Nz::Vector3f(x * 2.f, y * 1.5f, z * 2.f));
|
||||
entityNode.SetRotation(Nz::EulerAnglesf(0.f, Nz::TurnAnglef(0.5f), 0.f));
|
||||
|
||||
auto& entityPhys = entity.emplace<Nz::RigidBody3DComponent>(physSytem.CreateRigidBody(shipCollider));
|
||||
auto& entityPhys = entity.emplace<Nz::BulletRigidBody3DComponent>(physSytem.CreateRigidBody(shipCollider));
|
||||
entityPhys.SetMass(1.f);
|
||||
entityPhys.SetAngularDamping(0.f);
|
||||
entityPhys.SetLinearDamping(0.f);
|
||||
@@ -214,13 +214,13 @@ int main()
|
||||
showColliders = !showColliders;
|
||||
if (showColliders)
|
||||
{
|
||||
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::RigidBody3DComponent>();
|
||||
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::BulletRigidBody3DComponent>();
|
||||
for (auto [entity, gfxComponent, _] : view.each())
|
||||
gfxComponent.AttachRenderable(colliderModel, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::RigidBody3DComponent>();
|
||||
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::BulletRigidBody3DComponent>();
|
||||
for (auto [entity, gfxComponent, _] : view.each())
|
||||
gfxComponent.DetachRenderable(colliderModel);
|
||||
}
|
||||
@@ -235,7 +235,7 @@ int main()
|
||||
|
||||
entity.emplace<Nz::NodeComponent>();
|
||||
|
||||
auto& entityPhys = entity.emplace<Nz::RigidBody3DComponent>(physSytem.CreateRigidBody(shipCollider));
|
||||
auto& entityPhys = entity.emplace<Nz::BulletRigidBody3DComponent>(physSytem.CreateRigidBody(shipCollider));
|
||||
entityPhys.SetMass(1.f);
|
||||
entityPhys.SetAngularDamping(0.f);
|
||||
entityPhys.SetLinearDamping(0.f);
|
||||
@@ -262,7 +262,7 @@ int main()
|
||||
{
|
||||
float elapsedTime = deltaTime->AsSeconds();
|
||||
|
||||
auto spaceshipView = world.GetRegistry().view<Nz::NodeComponent, Nz::RigidBody3DComponent>();
|
||||
auto spaceshipView = world.GetRegistry().view<Nz::NodeComponent, Nz::BulletRigidBody3DComponent>();
|
||||
for (auto&& [entity, node, _] : spaceshipView.each())
|
||||
{
|
||||
if (entity == playerEntity)
|
||||
@@ -273,7 +273,7 @@ int main()
|
||||
world.GetRegistry().destroy(entity);
|
||||
}
|
||||
|
||||
Nz::RigidBody3DComponent& playerShipBody = playerEntity.get<Nz::RigidBody3DComponent>();
|
||||
Nz::BulletRigidBody3DComponent& playerShipBody = playerEntity.get<Nz::BulletRigidBody3DComponent>();
|
||||
Nz::Quaternionf currentRotation = playerShipBody.GetRotation();
|
||||
|
||||
Nz::Vector3f desiredHeading = headingEntity.get<Nz::NodeComponent>().GetForward();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
target("PhysicsDemo")
|
||||
add_deps("NazaraGraphics", "NazaraPhysics3D")
|
||||
add_deps("NazaraGraphics", "NazaraBulletPhysics3D")
|
||||
add_packages("entt")
|
||||
add_files("main.cpp")
|
||||
add_defines("NAZARA_ENTT")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <Nazara/Platform.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Math/PidController.hpp>
|
||||
#include <Nazara/Physics3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/Utility/Plugins/AssimpPlugin.hpp>
|
||||
@@ -30,7 +30,8 @@ int main()
|
||||
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||
world.AddSystem<Nz::SkeletonSystem>();
|
||||
|
||||
Nz::Physics3DSystem& physSytem = world.AddSystem<Nz::Physics3DSystem>();
|
||||
Nz::BulletPhysics3DSystem& physSytem = world.AddSystem<Nz::BulletPhysics3DSystem>();
|
||||
physSytem.GetPhysWorld().SetGravity(Nz::Vector3f::Zero());
|
||||
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
@@ -59,7 +60,7 @@ int main()
|
||||
|
||||
auto playerCollider = std::make_shared<Nz::BoxCollider3D>(Nz::Vector3f(0.2f, 1.8f, 0.2f));
|
||||
|
||||
auto& playerBody = playerEntity.emplace<Nz::RigidBody3DComponent>(physSytem.CreateRigidBody(playerCollider));
|
||||
auto& playerBody = playerEntity.emplace<Nz::BulletRigidBody3DComponent>(physSytem.CreateRigidBody(playerCollider));
|
||||
playerBody.SetMass(42.f);
|
||||
|
||||
std::shared_ptr<Nz::Mesh> colliderMesh = Nz::Mesh::Build(playerCollider->GenerateMesh());
|
||||
@@ -240,6 +241,9 @@ int main()
|
||||
sphereNode.SetInheritScale(false);
|
||||
sphereNode.SetParentJoint(bobEntity, "RightHand");
|
||||
|
||||
auto& sphereBody = sphereEntity.emplace<Nz::BulletRigidBody3DComponent>(&physSytem.GetPhysWorld());
|
||||
sphereBody.SetGeom(std::make_shared<Nz::SphereCollider3D>(0.1f));
|
||||
|
||||
auto& sphereGfx = sphereEntity.emplace<Nz::GraphicsComponent>();
|
||||
sphereGfx.AttachRenderable(sphereModel);
|
||||
}
|
||||
@@ -331,8 +335,8 @@ int main()
|
||||
|
||||
floorEntity.emplace<Nz::NodeComponent>();
|
||||
|
||||
auto& planeBody = floorEntity.emplace<Nz::RigidBody3DComponent>(&physSytem.GetPhysWorld());
|
||||
planeBody.SetGeom(std::make_shared<Nz::BoxCollider3D>(Nz::Vector3f(planeSize.x, 0.5f, planeSize.y), Nz::Vector3f(0.f, -0.25f, 0.f)));
|
||||
auto& planeBody = planeEntity.emplace<Nz::BulletRigidBody3DComponent>(&physSytem.GetPhysWorld());
|
||||
planeBody.SetGeom(std::make_shared<Nz::BoxCollider3D>(Nz::Vector3f(planeSize.x, 0.5f, planeSize.y)));
|
||||
|
||||
std::shared_ptr<Nz::GraphicalMesh> boxMeshGfx = Nz::GraphicalMesh::Build(Nz::Primitive::Box(Nz::Vector3f(0.5f, 0.5f, 0.5f)), meshPrimitiveParams);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ end
|
||||
target("Showcase")
|
||||
set_group("Examples")
|
||||
set_kind("binary")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraPhysics2D", "NazaraPhysics3D", "NazaraWidgets")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraPhysics2D", "NazaraBulletPhysics3D", "NazaraWidgets")
|
||||
if has_config("embed_plugins") then
|
||||
add_deps("PluginAssimp")
|
||||
else
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Network.hpp>
|
||||
#include <Nazara/Physics2D.hpp>
|
||||
#include <Nazara/Physics3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <iostream>
|
||||
@@ -12,7 +12,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
// This "example" has only one purpose: Giving an empty project for you to test whatever you want
|
||||
// If you wish to have multiple test projects, you only have to copy/paste this directory and change the name in the xmake.lua
|
||||
Nz::Application<Nz::Audio, Nz::Core, Nz::Graphics, Nz::Network, Nz::Physics2D, Nz::Physics3D, Nz::Renderer, Nz::Utility> app;
|
||||
Nz::Application<Nz::Audio, Nz::Core, Nz::Graphics, Nz::Network, Nz::Physics2D, Nz::BulletPhysics3D, Nz::Renderer, Nz::Utility> app;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
target("Tut00_EmptyProject")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraNetwork", "NazaraPhysics2D", "NazaraPhysics3D", "NazaraRenderer", "NazaraUtility")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraNetwork", "NazaraPhysics2D", "NazaraBulletPhysics3D", "NazaraRenderer", "NazaraUtility")
|
||||
add_files("main.cpp")
|
||||
|
||||
Reference in New Issue
Block a user