Skip to content

Commit a40b86a

Browse files
committed
WIP
1 parent 8e118e4 commit a40b86a

3 files changed

Lines changed: 23 additions & 20 deletions

File tree

editor/app.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,24 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
438438
plTransformComponent* ptSecondaryCameraTransform = (plTransformComponent* )gptEcs->add_component(ptAppData->ptComponentLibrary, gptEcs->get_ecs_type_key_transform(), ptAppData->tSecondaryCamera);
439439
ptSecondaryCameraTransform->tTranslation = pl_create_vec3(-4.012f, 2.984f, -1.109f);
440440

441+
plEnvironmentProbeComponent* ptProbe = NULL;
442+
plVec3 atProbeLocations[] = {
443+
pl_create_vec3(0.0f, 3.0f, 0.0f),
444+
// pl_create_vec3(-8.7f, 1.5f, 0.0f),
445+
// pl_create_vec3(8.8f, 1.5f, 0.0f),
446+
};
447+
448+
for(uint32_t i = 0; i < PL_ARRAYSIZE(atProbeLocations); i++)
449+
{
450+
plEntity tProbeEntity = gptRenderer->create_environment_probe(ptAppData->ptComponentLibrary, "Probe", atProbeLocations[i], &ptProbe);
451+
ptProbe->fRange = 30.0f;
452+
ptProbe->uResolution = 128;
453+
ptProbe->uSamples = 1024;
454+
ptProbe->uInterval = 6;
455+
ptProbe->tFlags |= PL_ENVIRONMENT_PROBE_FLAGS_INCLUDE_SKY;
456+
gptRenderer->add_probe_to_scene(ptAppData->ptScene, tProbeEntity);
457+
}
458+
441459
// create lights
442460
plLightComponent* ptLight = NULL;
443461
// plEntity tDirectionLight = gptRenderer->create_directional_light(ptAppData->ptComponentLibrary, "direction light", pl_create_vec3(0.425f, -1.0f, -0.384f), &ptLight);
@@ -453,7 +471,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
453471
plEntity tPointLight = gptRenderer->create_point_light(ptAppData->ptComponentLibrary, "point light", pl_create_vec3(9.316f, 1.497f, -1.042f), &ptLight);
454472
ptLight->uShadowResolution = 512;
455473
ptLight->tColor = (plVec3){0.0f, 1.0f, 0.0f};
456-
ptLight->tFlags |= PL_LIGHT_FLAG_CAST_SHADOW | PL_LIGHT_FLAG_VISUALIZER;
474+
// ptLight->tFlags |= PL_LIGHT_FLAG_CAST_SHADOW | PL_LIGHT_FLAG_VISUALIZER;
457475
plTransformComponent* ptPLightTransform = (plTransformComponent* )gptEcs->add_component(ptAppData->ptComponentLibrary, gptEcs->get_ecs_type_key_transform(), tPointLight);
458476
ptPLightTransform->tTranslation = pl_create_vec3(9.316f, 1.497f, -1.042f);
459477

@@ -463,7 +481,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
463481
ptLight->fRange = 10.0f;
464482
ptLight->fRadius = 0.025f;
465483
ptLight->fIntensity = 20.0f;
466-
ptLight->tFlags |= PL_LIGHT_FLAG_CAST_SHADOW | PL_LIGHT_FLAG_VISUALIZER;
484+
// ptLight->tFlags |= PL_LIGHT_FLAG_CAST_SHADOW | PL_LIGHT_FLAG_VISUALIZER;
467485
plTransformComponent* ptSLightTransform = (plTransformComponent* )gptEcs->add_component(ptAppData->ptComponentLibrary, gptEcs->get_ecs_type_key_transform(), tSpotLight);
468486
ptSLightTransform->tTranslation = pl_create_vec3(0.0f, 3.27f, -1.5f);
469487

@@ -504,23 +522,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
504522
// gptRenderer->add_materials_to_scene(ptAppData->ptScene, uMaterialCount, ptMaterialEntities);
505523

506524

507-
plEnvironmentProbeComponent* ptProbe = NULL;
508-
plVec3 atProbeLocations[] = {
509-
pl_create_vec3(0.0f, 3.0f, 0.0f),
510-
// pl_create_vec3(-8.7f, 1.5f, 0.0f),
511-
// pl_create_vec3(8.8f, 1.5f, 0.0f),
512-
};
513525

514-
for(uint32_t i = 0; i < PL_ARRAYSIZE(atProbeLocations); i++)
515-
{
516-
plEntity tProbeEntity = gptRenderer->create_environment_probe(ptAppData->ptComponentLibrary, "Probe", atProbeLocations[i], &ptProbe);
517-
ptProbe->fRange = 30.0f;
518-
ptProbe->uResolution = 128;
519-
ptProbe->uSamples = 1024;
520-
ptProbe->uInterval = 6;
521-
ptProbe->tFlags |= PL_ENVIRONMENT_PROBE_FLAGS_INCLUDE_SKY;
522-
gptRenderer->add_probe_to_scene(ptAppData->ptScene, tProbeEntity);
523-
}
524526

525527
bool bResult0 = gptRenderer->add_drawable_objects_to_scene(ptAppData->ptScene, tLoaderData0.uObjectCount, tLoaderData0.atObjects);
526528
bool bResult1 = gptRenderer->add_drawable_objects_to_scene(ptAppData->ptScene, tLoaderData1.uObjectCount, tLoaderData1.atObjects);

extensions/pl_renderer_ext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3680,7 +3680,7 @@ pl_renderer_render_view(plView* ptView, plCamera* ptCamera, plCamera* ptCullCame
36803680
plDeferredLightingPassInfo tDeferredLightingPassInfo = {
36813681
.tBG2 = ptView->tLightingBindGroup,
36823682
.ptArea = &tArea,
3683-
.uView = ptView->uIndex,
3683+
// .uView = ptView->uIndex,
36843684
.uProbe = 0
36853685
};
36863686

extensions/pl_renderer_internal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,7 @@ pl__renderer_create_probe_data(plScene* ptScene, plEntity tProbeHandle)
26042604
{
26052605
{ .uSlot = 0, .tBuffer = tProbeData.atViewBuffers[i], .szBufferRange = sizeof(plGpuViewData) },
26062606
{ .uSlot = 1, .tBuffer = tProbeData.atView2Buffers[i], .szBufferRange = sizeof(plGpuViewData) * 6 },
2607-
{ .uSlot = 2, .tBuffer = ptScene->atLightBuffer[i], .szBufferRange = sizeof(plGpuLight) * pl_sb_size(ptScene->sbtLightData)},
2607+
{ .uSlot = 2, .tBuffer = ptScene->atLightBuffer[i], .szBufferRange = gptGfx->get_buffer(gptData->ptDevice, ptScene->atLightBuffer[i])->tDesc.szByteSize},
26082608
{ .uSlot = 3, .tBuffer = ptScene->atDLightShadowDataBuffer[i], .szBufferRange = gptGfx->get_buffer(gptData->ptDevice, ptScene->atDLightShadowDataBuffer[i])->tDesc.szByteSize},
26092609
{ .uSlot = 4, .tBuffer = ptScene->atLightShadowDataBuffer[i], .szBufferRange = sizeof(plGpuLightShadow) * pl_sb_size(ptScene->sbtLightShadowData)},
26102610
{ .uSlot = 5, .tBuffer = ptScene->atGPUProbeDataBuffers[i], .szBufferRange = sizeof(plGpuProbe) * pl_sb_size(ptScene->sbtGPUProbeData)},
@@ -3264,6 +3264,7 @@ pl__render_view_deferred_lighting_pass(plScene* ptScene, plRenderEncoder* ptScen
32643264
plDynamicBinding tLightingDynamicData = pl__allocate_dynamic_data(ptDevice);
32653265
plGpuDynDeferredLighting* ptLightingDynamicData = (plGpuDynDeferredLighting*)tLightingDynamicData.pcData;
32663266
ptLightingDynamicData->uGlobalIndex = ptInfo->uView;
3267+
// ptLightingDynamicData->uGlobalIndex = 0;
32673268
ptLightingDynamicData->iLightIndex = (int)uLightIndex;
32683269
gptGfx->reset_draw_stream(ptStream, 1);
32693270
if(ptScene->sbtLightData[uLightIndex].iType == PL_LIGHT_TYPE_DIRECTIONAL)

0 commit comments

Comments
 (0)