Physics stuff

This commit is contained in:
Confideo-IOM
2026-08-25 22:10:54 +01:00
parent 1253571c17
commit 30538ae7ab
59 changed files with 1403 additions and 518 deletions
+15 -3
View File
@@ -25,6 +25,7 @@
#include "../ecs/systems/HydraSpotShadowSourceSystem.h"
#include "../ecs/systems/HydraPointShadowSourceSystem.h"
#include "../ecs/systems/HydraPhysicsSystem.h"
#include "../ecs/systems/HydraTickActorsSystem.h"
#include "../ecs/components/HydraPositionComponent.h"
#include "../ecs/components/HydraMeshComponent.h"
@@ -36,7 +37,7 @@
#include "../ecs/components/HydraSpotShadowSourceComponent.h"
#include "../ecs/components/HydraPointShadowSourceComponent.h"
#include "../ecs/components/HydraPhysicsComponent.h"
#include "../ecs/components/HydraTickComponent.h"
#include "../camera/HydraCamera.h"
#include "../actor/HydraActorManager.h"
@@ -175,6 +176,11 @@ float HydraEngine::GetDeltaT()
return m_delta_t;
}
float HydraEngine::GetFixedDeltaT()
{
return m_fixed_delta_t;
}
uint32_t HydraEngine::GetLightCount()
{
return m_light_buffer_manager->GetLightCount();
@@ -238,6 +244,7 @@ void HydraEngine::_InitialiseSystems()
m_ecs->RegisterComponentType<HydraSpotShadowSourceComponent>();
m_ecs->RegisterComponentType<HydraPointShadowSourceComponent>();
m_ecs->RegisterComponentType<HydraPhysicsComponent>();
m_ecs->RegisterComponentType<HydraTickComponent>();
m_mesh_system = m_ecs->RegisterSystem<HydraMeshSystem>();
m_transform_system = m_ecs->RegisterSystem<HydraTransformSystem>();
@@ -248,6 +255,7 @@ void HydraEngine::_InitialiseSystems()
m_spot_shadow_system = m_ecs->RegisterSystem<HydraSpotShadowSourceSystem>();
m_point_shadow_system = m_ecs->RegisterSystem<HydraPointShadowSourceSystem>();
m_physics_system = m_ecs->RegisterSystem<HydraPhysicsSystem>();
m_tick_system = m_ecs->RegisterSystem<HydraTickActorsSystem>();
HydraSignature mesh_sig;
HydraSignature trans_sig;
@@ -258,6 +266,7 @@ void HydraEngine::_InitialiseSystems()
HydraSignature spot_shadow_sig;
HydraSignature point_shadow_sig;
HydraSignature physics_sig;
HydraSignature tick_sig;
mesh_sig.set(m_ecs->GetComponentType<HydraMeshComponent>(),true);
trans_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(),true);
@@ -282,6 +291,8 @@ void HydraEngine::_InitialiseSystems()
physics_sig.set(m_ecs->GetComponentType<HydraPhysicsComponent>(), true);
physics_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(), true);
tick_sig.set(m_ecs->GetComponentType<HydraTickComponent>(), true);
m_ecs->SetSystemSignature<HydraMeshSystem>(mesh_sig);
m_ecs->SetSystemSignature<HydraTransformSystem>(trans_sig);
m_ecs->SetSystemSignature<HydraRenderSystem>(render_sig);
@@ -291,7 +302,7 @@ void HydraEngine::_InitialiseSystems()
m_ecs->SetSystemSignature<HydraSpotShadowSourceSystem>(spot_shadow_sig);
m_ecs->SetSystemSignature<HydraPointShadowSourceSystem>(point_shadow_sig);
m_ecs->SetSystemSignature<HydraPhysicsSystem>(physics_sig);
m_ecs->SetSystemSignature<HydraTickActorsSystem>(tick_sig);
}
void HydraEngine::_UpdateSystems()
@@ -299,7 +310,7 @@ void HydraEngine::_InitialiseSystems()
//Update physics system with any changes from the transform system
m_physics_system->Update(m_delta_t);
HydraID posUpdateBarrierID = m_task_scheduler->CreateBarrier();
HydraID update_trans_id = m_task_scheduler->CreateTask<HydraUpdateSystemTask>(HydraThreadAffinity::General, posUpdateBarrierID);
@@ -340,6 +351,7 @@ void HydraEngine::_InitialiseSystems()
m_task_scheduler->StartTask(update_point_shadow_id);
m_task_scheduler->WaitForBarrier(shadow_barrier);
m_tick_system->FixedUpdate(m_fixed_delta_t);
m_shadow_buffer_manager->UpdateShadowBuffer();
}
+3 -1
View File
@@ -30,6 +30,7 @@ class HydraSpotShadowSourceSystem;
class HydraShadowBufferManager;
class HydraPointShadowSourceSystem;
class HydraPhysicsSystem;
class HydraTickActorsSystem;
class CLASS_DEFINE HydraEngine : public HydraObject
{
@@ -67,6 +68,7 @@ public:
void PossessPlayer(HydraID actor_id);
HydraID GetPossessedPlayer();
float GetDeltaT();
float GetFixedDeltaT();
uint32_t GetLightCount();
private:
void _CreateManagers();
@@ -105,7 +107,7 @@ private:
std::shared_ptr<HydraSpotShadowSourceSystem> m_spot_shadow_system;
std::shared_ptr<HydraPointShadowSourceSystem> m_point_shadow_system;
std::shared_ptr<HydraPhysicsSystem> m_physics_system;
std::shared_ptr<HydraTickActorsSystem> m_tick_system;
bool m_running = true;
float m_delta_t = 0.0f;
float m_fixed_delta_t = 0.0f;