This commit is contained in:
Confideo-IOM
2026-08-18 16:23:20 +01:00
parent 282243a16b
commit 20c0794d10
66 changed files with 622 additions and 1144 deletions
@@ -36,13 +36,17 @@ void HydraDirectionalShadowSourceSystem::InitialiseComponent(HydraID entity_id)
HydraDirectionalShadowSourceComponent& shadow_comp = ecs->GetComponent<HydraDirectionalShadowSourceComponent>(entity_id);
//light_comp.shadow_map_id = shadow_id;
light_comp.shadow_caster = 1;
//shadow_comp.shadow_id = shadow_id;
shadow_comp.entity_id = entity_id;
HydraID shadow_id = GetEngine()->ShadowBufferManager()->AddDirectionalShadow(shadow_comp);
assert(shadow_id != INVALID_HYDRA_ID && "Add directional Shadow - out of shadows!");
light_comp.shadow_map_id = shadow_id;
light_comp.shadow_caster = 1;
shadow_comp.shadow_id = shadow_id;
_InitialiseShadowMap(entity_id);
//_InitialiseShadowMap(entity_id);
}
void HydraDirectionalShadowSourceSystem::DestroyComponent(HydraID entity_id)
@@ -50,8 +54,7 @@ void HydraDirectionalShadowSourceSystem::DestroyComponent(HydraID entity_id)
HydraEngine *engine = GetEngine();
HydraECS *ecs = engine->ECS();
HydraDirectionalShadowSourceComponent& shadow_comp = ecs->GetComponent<HydraDirectionalShadowSourceComponent>(entity_id);
GetEngine()->ShadowBufferManager()->DeleteDirectionalShadow(shadow_comp.shadow_id);
GetEngine()->ShadowBufferManager()->DeleteDirectionalShadow(shadow_comp.shadow_id);
}
void HydraDirectionalShadowSourceSystem::UpdateSystem(float delta_t_seconds)
@@ -110,24 +113,3 @@ void HydraDirectionalShadowSourceSystem::_UpdateShadowMap(HydraID entity_id)
}
void HydraDirectionalShadowSourceSystem::_InitialiseShadowMap(HydraID entity_id)
{
HydraEngine *engine = GetEngine();
HydraECS *ecs = engine->ECS();
HydraTextureBufferManager *tex_man = engine->TextureBufferManager();
HydraDirectionalShadowSourceComponent &shad_comp = ecs->GetComponent<HydraDirectionalShadowSourceComponent>(entity_id);
HydraLightComponent &light_comp = ecs->GetComponent<HydraLightComponent>(entity_id);
shad_comp.entity_id = entity_id;
HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler();
uint32_t depth_texture_id = 0;
HydraID create_framebuffer_task_id = task_scheduler->CreateTask<HydraCreateCascadeShadowFrameBuffer>(HydraThreadAffinity::Render);
HydraCreateCascadeShadowFrameBuffer *fb_task = static_cast<HydraCreateCascadeShadowFrameBuffer *>(task_scheduler->GetTask(create_framebuffer_task_id));
fb_task->Initialise(&depth_texture_id, &shad_comp.frame_buffer_id);
task_scheduler->WaitForTask(create_framebuffer_task_id);
shad_comp.shadow_texture_id = depth_texture_id;
}