Point lights

This commit is contained in:
Confideo-IOM
2026-08-28 16:36:25 +01:00
parent 30538ae7ab
commit e3d37e3f8a
60 changed files with 458 additions and 184 deletions
+21 -5
View File
@@ -26,6 +26,7 @@
#include "../ecs/systems/HydraPointShadowSourceSystem.h"
#include "../ecs/systems/HydraPhysicsSystem.h"
#include "../ecs/systems/HydraTickActorsSystem.h"
#include "../ecs/systems/HydraShadowCasterSystem.h"
#include "../ecs/components/HydraPositionComponent.h"
#include "../ecs/components/HydraMeshComponent.h"
@@ -38,6 +39,7 @@
#include "../ecs/components/HydraPointShadowSourceComponent.h"
#include "../ecs/components/HydraPhysicsComponent.h"
#include "../ecs/components/HydraTickComponent.h"
#include "../ecs/components/HydraShadowCasterComponent.h"
#include "../camera/HydraCamera.h"
#include "../actor/HydraActorManager.h"
@@ -58,6 +60,7 @@
#include "../task/ecs/HydraUpdateSystemTask.hpp"
#include "../task/ecs/HydraInitialiseComponentsTask.hpp"
#include "../task/ecs/HydraDeleteComponentsTask.hpp"
#include "../task/buffer/HydraShutdownBufferManagerTask.hpp"
#include "../task/buffer/HydraInitialiseTextureManagerTask.hpp"
#include "../task/buffer/HydraInitialiseShadowBufferTask.hpp"
@@ -210,7 +213,7 @@ void HydraEngine::_CreateManagers()
void HydraEngine::_InitialiseManagers()
{
m_task_scheduler->Initialise(1);
m_task_scheduler->Initialise(4);
HydraID create_window_task_id = m_task_scheduler->CreateTask<HydraInitialiseWindowManagerTask>(HydraThreadAffinity::Render);
m_task_scheduler->WaitForTask(create_window_task_id);
@@ -245,6 +248,7 @@ void HydraEngine::_InitialiseSystems()
m_ecs->RegisterComponentType<HydraPointShadowSourceComponent>();
m_ecs->RegisterComponentType<HydraPhysicsComponent>();
m_ecs->RegisterComponentType<HydraTickComponent>();
m_ecs->RegisterComponentType<HydraShadowCasterComponent>();
m_mesh_system = m_ecs->RegisterSystem<HydraMeshSystem>();
m_transform_system = m_ecs->RegisterSystem<HydraTransformSystem>();
@@ -256,6 +260,7 @@ void HydraEngine::_InitialiseSystems()
m_point_shadow_system = m_ecs->RegisterSystem<HydraPointShadowSourceSystem>();
m_physics_system = m_ecs->RegisterSystem<HydraPhysicsSystem>();
m_tick_system = m_ecs->RegisterSystem<HydraTickActorsSystem>();
m_shadow_caster_system = m_ecs->RegisterSystem<HydraShadowCasterSystem>();
HydraSignature mesh_sig;
HydraSignature trans_sig;
@@ -267,6 +272,7 @@ void HydraEngine::_InitialiseSystems()
HydraSignature point_shadow_sig;
HydraSignature physics_sig;
HydraSignature tick_sig;
HydraSignature shadow_caster_sig;
mesh_sig.set(m_ecs->GetComponentType<HydraMeshComponent>(),true);
trans_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(),true);
@@ -293,6 +299,8 @@ void HydraEngine::_InitialiseSystems()
tick_sig.set(m_ecs->GetComponentType<HydraTickComponent>(), true);
shadow_caster_sig.set(m_ecs->GetComponentType<HydraShadowCasterComponent>(), true);
m_ecs->SetSystemSignature<HydraMeshSystem>(mesh_sig);
m_ecs->SetSystemSignature<HydraTransformSystem>(trans_sig);
m_ecs->SetSystemSignature<HydraRenderSystem>(render_sig);
@@ -303,9 +311,10 @@ void HydraEngine::_InitialiseSystems()
m_ecs->SetSystemSignature<HydraPointShadowSourceSystem>(point_shadow_sig);
m_ecs->SetSystemSignature<HydraPhysicsSystem>(physics_sig);
m_ecs->SetSystemSignature<HydraTickActorsSystem>(tick_sig);
m_ecs->SetSystemSignature<HydraShadowCasterSystem>(shadow_caster_sig);
}
void HydraEngine::_UpdateSystems()
void HydraEngine::_UpdateSystems(bool fixed_update)
{
//Update physics system with any changes from the transform system
@@ -350,8 +359,10 @@ void HydraEngine::_InitialiseSystems()
m_task_scheduler->StartTask(update_spot_shadow_id);
m_task_scheduler->StartTask(update_point_shadow_id);
m_task_scheduler->WaitForBarrier(shadow_barrier);
m_tick_system->FixedUpdate(m_fixed_delta_t);
if(fixed_update)
{
m_tick_system->FixedUpdate(m_fixed_delta_t);
}
m_shadow_buffer_manager->UpdateShadowBuffer();
}
@@ -426,6 +437,9 @@ void HydraEngine::_GameLoop()
fpsFrameCount++;
HydraID delete_components_id = m_task_scheduler->CreateTask<HydraDeleteComponentsTask>(HydraThreadAffinity::General);
m_task_scheduler->WaitForTask(delete_components_id);
HydraID processInputID = m_task_scheduler->CreateTask<HydraProcessInputTask>(HydraThreadAffinity::Render, barrierID);
HydraProcessInputTask* m_input_task = static_cast<HydraProcessInputTask*>(m_task_scheduler->GetTask(processInputID));
m_input_task->Initialise(fixed_tick);
@@ -441,11 +455,13 @@ void HydraEngine::_GameLoop()
if(fixed_tick)
{
m_game->FixedUpdate(m_delta_t);
}
m_game->Update(m_delta_t);
_UpdateSystems();
_UpdateSystems(fixed_tick);
+3 -1
View File
@@ -31,6 +31,7 @@ class HydraShadowBufferManager;
class HydraPointShadowSourceSystem;
class HydraPhysicsSystem;
class HydraTickActorsSystem;
class HydraShadowCasterSystem;
class CLASS_DEFINE HydraEngine : public HydraObject
{
@@ -74,7 +75,7 @@ private:
void _CreateManagers();
void _InitialiseManagers();
void _InitialiseSystems();
void _UpdateSystems();
void _UpdateSystems(bool fixed_update);
void _GameLoop();
void _Shutdown();
@@ -108,6 +109,7 @@ private:
std::shared_ptr<HydraPointShadowSourceSystem> m_point_shadow_system;
std::shared_ptr<HydraPhysicsSystem> m_physics_system;
std::shared_ptr<HydraTickActorsSystem> m_tick_system;
std::shared_ptr<HydraShadowCasterSystem> m_shadow_caster_system;
bool m_running = true;
float m_delta_t = 0.0f;
float m_fixed_delta_t = 0.0f;
+8 -1
View File
@@ -8,7 +8,14 @@ HydraEngine *const HydraObject::GetEngine()
void HydraObject::DebugLog(std::string log_entry)
{
std::cout << log_entry + "\r\n";
#ifdef __unix__ /* __unix__ is usually defined by compilers targeting Unix systems */
std::cout << log_entry + "\r\n";
#elif defined(_WIN32) || defined(WIN32) /* _Win32 is usually defined by compilers targeting 32 or 64 bit Windows systems */
OutputDebugString(log_entry.c_str());
#endif
}
void HydraObject::ClearLog()