Point light working

This commit is contained in:
Confideo-IOM
2026-08-16 13:47:11 +01:00
parent f9b696f9e8
commit 98ff54c106
50 changed files with 1187 additions and 357 deletions
+17
View File
@@ -23,6 +23,7 @@
#include "../ecs/systems/HydraLightSystem.h"
#include "../ecs/systems/HydraDirectionalShadowSourceSystem.h"
#include "../ecs/systems/HydraSpotShadowSourceSystem.h"
#include "../ecs/systems/HydraPointShadowSourceSystem.h"
#include "../ecs/components/HydraPositionComponent.h"
#include "../ecs/components/HydraMeshComponent.h"
@@ -32,6 +33,7 @@
#include "../ecs/components/HydraLightComponent.h"
#include "../ecs/components/HydraDirectionalShadowSourceComponent.h"
#include "../ecs/components/HydraSpotShadowSourceComponent.h"
#include "../ecs/components/HydraPointShadowSourceComponent.h"
#include "../camera/HydraCamera.h"
@@ -231,6 +233,7 @@ void HydraEngine::_InitialiseSystems()
m_ecs->RegisterComponentType<HydraLightComponent>();
m_ecs->RegisterComponentType<HydraDirectionalShadowSourceComponent>();
m_ecs->RegisterComponentType<HydraSpotShadowSourceComponent>();
m_ecs->RegisterComponentType<HydraPointShadowSourceComponent>();
m_mesh_system = m_ecs->RegisterSystem<HydraMeshSystem>();
m_transform_system = m_ecs->RegisterSystem<HydraTransformSystem>();
@@ -239,6 +242,8 @@ void HydraEngine::_InitialiseSystems()
m_light_system = m_ecs->RegisterSystem<HydraLightSystem>();
m_directional_shadow_system = m_ecs->RegisterSystem<HydraDirectionalShadowSourceSystem>();
m_spot_shadow_system = m_ecs->RegisterSystem<HydraSpotShadowSourceSystem>();
m_point_shadow_system = m_ecs->RegisterSystem<HydraPointShadowSourceSystem>();
HydraSignature mesh_sig;
HydraSignature trans_sig;
@@ -247,6 +252,7 @@ void HydraEngine::_InitialiseSystems()
HydraSignature light_sig;
HydraSignature directional_shadow_sig;
HydraSignature spot_shadow_sig;
HydraSignature point_shadow_sig;
mesh_sig.set(m_ecs->GetComponentType<HydraMeshComponent>(),true);
trans_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(),true);
@@ -264,6 +270,10 @@ void HydraEngine::_InitialiseSystems()
spot_shadow_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(), true);
spot_shadow_sig.set(m_ecs->GetComponentType<HydraSpotShadowSourceComponent>(), true);
point_shadow_sig.set(m_ecs->GetComponentType<HydraLightComponent>(), true);
point_shadow_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(), true);
point_shadow_sig.set(m_ecs->GetComponentType<HydraPointShadowSourceComponent>(), true);
m_ecs->SetSystemSignature<HydraMeshSystem>(mesh_sig);
m_ecs->SetSystemSignature<HydraTransformSystem>(trans_sig);
m_ecs->SetSystemSignature<HydraRenderSystem>(render_sig);
@@ -271,6 +281,7 @@ void HydraEngine::_InitialiseSystems()
m_ecs->SetSystemSignature<HydraLightSystem>(light_sig);
m_ecs->SetSystemSignature<HydraDirectionalShadowSourceSystem>(directional_shadow_sig);
m_ecs->SetSystemSignature<HydraSpotShadowSourceSystem>(spot_shadow_sig);
m_ecs->SetSystemSignature<HydraPointShadowSourceSystem>(point_shadow_sig);
}
@@ -305,9 +316,15 @@ void HydraEngine::_InitialiseSystems()
HydraID update_spot_shadow_id = m_task_scheduler->CreateTask<HydraUpdateSystemTask>(HydraThreadAffinity::General, shadow_barrier);
HydraUpdateSystemTask* update_spot_shadow_task = static_cast<HydraUpdateSystemTask*>(m_task_scheduler->GetTask(update_spot_shadow_id));
update_spot_shadow_task->Initialise(m_delta_t, m_spot_shadow_system);
HydraID update_point_shadow_id = m_task_scheduler->CreateTask<HydraUpdateSystemTask>(HydraThreadAffinity::General, shadow_barrier);
HydraUpdateSystemTask* update_point_shadow_task = static_cast<HydraUpdateSystemTask*>(m_task_scheduler->GetTask(update_point_shadow_id));
update_point_shadow_task->Initialise(m_delta_t, m_point_shadow_system);
m_task_scheduler->StartTask(update_shadow_id);
m_task_scheduler->StartTask(update_spot_shadow_id);
m_task_scheduler->StartTask(update_point_shadow_id);
m_task_scheduler->WaitForBarrier(shadow_barrier);
m_shadow_buffer_manager->UpdateShadowBuffer();
+2 -1
View File
@@ -28,6 +28,7 @@ class HydraLightSystem;
class HydraDirectionalShadowSourceSystem;
class HydraSpotShadowSourceSystem;
class HydraShadowBufferManager;
class HydraPointShadowSourceSystem;
class CLASS_DEFINE HydraEngine : public HydraObject
{
@@ -98,7 +99,7 @@ private:
std::shared_ptr<HydraLightSystem> m_light_system;
std::shared_ptr<HydraDirectionalShadowSourceSystem> m_directional_shadow_system;
std::shared_ptr<HydraSpotShadowSourceSystem> m_spot_shadow_system;
std::shared_ptr<HydraPointShadowSourceSystem> m_point_shadow_system;
bool m_running = true;
float m_delta_t = 0.0f;