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
@@ -37,8 +37,9 @@ void HydraPointShadowSourceSystem::InitialiseComponent(HydraID entity_id)
light_comp.shadow_map_id = shadow_id;
light_comp.shadow_caster = 1;
shadow_comp.shadow_id = shadow_id;
_InitialiseShadowMap(entity_id);
shadow_comp.entity_id = entity_id;
//shadow_comp.shadow_id = shadow_id;
//_InitialiseShadowMap(entity_id);
}
void HydraPointShadowSourceSystem::UpdateSystem(float delta_t_seconds)
@@ -51,7 +52,7 @@ void HydraPointShadowSourceSystem::UpdateSystem(float delta_t_seconds)
void HydraPointShadowSourceSystem::DestroyComponent(HydraID entity_id)
{
HydraEngine *engine = GetEngine();
HydraEngine *engine = GetEngine();
HydraECS *ecs = engine->ECS();
HydraPointShadowSourceComponent& shadow_comp = ecs->GetComponent<HydraPointShadowSourceComponent>(entity_id);
GetEngine()->ShadowBufferManager()->DeletePointShadow(shadow_comp.shadow_id);
@@ -85,7 +86,7 @@ void HydraPointShadowSourceSystem::_UpdateShadowMap(HydraID entity_id)
//GL_TEXTURE_CUBE_MAP_NEGATIVE_X - right
shad_comp.light_space_view[1] = glm::lookAt(light_pos, light_pos + glm::vec3(-1.0, 0.0, 0.0), glm::vec3(0.0, 1.0, 0.0));
//GL_TEXTURE_CUBE_MAP_POSITIVE_Y - Up
shad_comp.light_space_view[2] = glm::lookAt(light_pos, light_pos + glm::vec3(0.0, 1.0, 0.0), glm::vec3(0.0, 0.0, 1.0));
shad_comp.light_space_view[2] = glm::lookAt(light_pos, light_pos + glm::vec3(0.0, 1.0, 0.0), glm::vec3(0.0, 0.0, -1.0));
//GL_TEXTURE_CUBE_MAP_NEGATIVE_Y - down
shad_comp.light_space_view[3] = glm::lookAt(light_pos, light_pos + glm::vec3(0.0, -1.0, 0.0), glm::vec3(0.0, 0.0, 1.0));
//GL_TEXTURE_CUBE_MAP_POSITIVE_Z - back
@@ -101,22 +102,22 @@ void HydraPointShadowSourceSystem::_UpdateShadowMap(HydraID entity_id)
void HydraPointShadowSourceSystem::_InitialiseShadowMap(HydraID entity_id)
{
HydraEngine *engine = GetEngine();
HydraECS *ecs = engine->ECS();
HydraTextureBufferManager *tex_man = engine->TextureBufferManager();
HydraPointShadowSourceComponent &shad_comp = ecs->GetComponent<HydraPointShadowSourceComponent>(entity_id);
HydraLightComponent &light_comp = ecs->GetComponent<HydraLightComponent>(entity_id);
// HydraEngine *engine = GetEngine();
// HydraECS *ecs = engine->ECS();
// HydraTextureBufferManager *tex_man = engine->TextureBufferManager();
// HydraPointShadowSourceComponent &shad_comp = ecs->GetComponent<HydraPointShadowSourceComponent>(entity_id);
// HydraLightComponent &light_comp = ecs->GetComponent<HydraLightComponent>(entity_id);
shad_comp.entity_id = entity_id;
// shad_comp.entity_id = entity_id;
HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler();
// HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler();
uint32_t depth_texture_id = 0;
HydraID create_framebuffer_task_id = task_scheduler->CreateTask<HydraCreateCubemapShadowFrameBuffer>(HydraThreadAffinity::Render);
HydraCreateCubemapShadowFrameBuffer *fb_task = static_cast<HydraCreateCubemapShadowFrameBuffer *>(task_scheduler->GetTask(create_framebuffer_task_id));
fb_task->Initialise(&shad_comp.shadow_texture_id, &depth_texture_id, &shad_comp.frame_buffer_id);
// uint32_t depth_texture_id = 0;
// HydraID create_framebuffer_task_id = task_scheduler->CreateTask<HydraCreateCubemapShadowFrameBuffer>(HydraThreadAffinity::Render);
// HydraCreateCubemapShadowFrameBuffer *fb_task = static_cast<HydraCreateCubemapShadowFrameBuffer *>(task_scheduler->GetTask(create_framebuffer_task_id));
// fb_task->Initialise(&shad_comp.shadow_texture_id, &depth_texture_id, &shad_comp.frame_buffer_id);
task_scheduler->WaitForTask(create_framebuffer_task_id);
shad_comp.shadow_texture_id = depth_texture_id;
// task_scheduler->WaitForTask(create_framebuffer_task_id);
// shad_comp.shadow_texture_id = depth_texture_id;
}