Fix compilation

This commit is contained in:
SirLynix 2023-08-10 12:03:56 +02:00
parent efa2a30934
commit ab95bec41b
4 changed files with 7 additions and 19 deletions

View File

@ -523,7 +523,6 @@ int main(int argc, char* argv[])
if (fpsClock.RestartIfOver(Nz::Time::Second()))
{
mainWindow.SetTitle("Physics playground - " + Nz::NumberToString(fps) + " FPS" + " - " + Nz::NumberToString(world.GetAliveEntityCount()) + " entities");
physSystem.Dump();
fps = 0;
}
});

View File

@ -32,10 +32,9 @@ namespace Nz
JoltPhysics3DSystem(JoltPhysics3DSystem&&) = delete;
~JoltPhysics3DSystem();
void Dump();
inline JoltPhysWorld3D& GetPhysWorld();
inline const JoltPhysWorld3D& GetPhysWorld() const;
inline entt::handle GetRigidBodyEntity(UInt32 bodyIndex) const;
bool RaycastQuery(const Vector3f& from, const Vector3f& to, const FunctionRef<std::optional<float>(const RaycastHit& hitInfo)>& callback);
bool RaycastQueryFirst(const Vector3f& from, const Vector3f& to, const FunctionRef<void(const RaycastHit& hitInfo)>& callback);
@ -56,7 +55,7 @@ namespace Nz
void OnBodyDestruct(entt::registry& registry, entt::entity entity);
std::size_t m_stepCount;
std::vector<entt::entity> m_physicsEntities;
std::vector<entt::entity> m_bodyIndicesToEntity;
entt::registry& m_registry;
entt::observer m_characterConstructObserver;
entt::observer m_rigidBodyConstructObserver;
@ -64,8 +63,6 @@ namespace Nz
entt::scoped_connection m_characterConstructConnection;
entt::scoped_connection m_bodyDestructConnection;
JoltPhysWorld3D m_physWorld;
Time m_physicsTime;
Time m_updateTime;
};
}

View File

@ -15,6 +15,11 @@ namespace Nz
{
return m_physWorld;
}
inline entt::handle JoltPhysics3DSystem::GetRigidBodyEntity(UInt32 bodyIndex) const
{
return entt::handle(m_registry, m_bodyIndicesToEntity[bodyIndex]);
}
}
#include <Nazara/JoltPhysics3D/DebugOff.hpp>

View File

@ -18,8 +18,6 @@ namespace Nz
m_bodyConstructConnection = registry.on_construct<JoltRigidBody3DComponent>().connect<&JoltPhysics3DSystem::OnBodyConstruct>(this);
m_characterConstructConnection = registry.on_construct<JoltCharacterComponent>().connect<&JoltPhysics3DSystem::OnCharacterConstruct>(this);
m_bodyDestructConnection = registry.on_destroy<JoltRigidBody3DComponent>().connect<&JoltPhysics3DSystem::OnBodyDestruct>(this);
m_stepCount = 0;
}
JoltPhysics3DSystem::~JoltPhysics3DSystem()
@ -92,14 +90,8 @@ namespace Nz
entityBody.TeleportTo(entityNode.GetPosition(), entityNode.GetRotation());
});
Time t1 = GetElapsedNanoseconds();
// Update the physics world
m_physWorld.Step(elapsedTime);
m_stepCount++;
Time t2 = GetElapsedNanoseconds();
// Replicate characters to their NodeComponent
{
@ -132,11 +124,6 @@ namespace Nz
nodeComponent.SetTransform(position, rotation);
}
}
Time t3 = GetElapsedNanoseconds();
m_physicsTime += (t2 - t1);
m_updateTime += (t3 - t2);
}
void JoltPhysics3DSystem::OnBodyConstruct(entt::registry& registry, entt::entity entity)