Skip to content

Commit 0ba08ae

Browse files
hoffstadthoffstadt-nasa
authored andcommitted
chore: renderer internal cleanup
1 parent 7914c1b commit 0ba08ae

6 files changed

Lines changed: 2648 additions & 2510 deletions

File tree

editor/app.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,13 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
476476

477477
for(uint32_t i = 0; i < PL_ARRAYSIZE(atProbeLocations); i++)
478478
{
479-
gptRenderer->create_environment_probe(ptAppData->ptComponentLibrary, "Probe", atProbeLocations[i], &ptProbe);
479+
plEntity tProbeEntity = gptRenderer->create_environment_probe(ptAppData->ptComponentLibrary, "Probe", atProbeLocations[i], &ptProbe);
480480
ptProbe->fRange = 30.0f;
481481
ptProbe->uResolution = 128;
482482
ptProbe->uSamples = 1024;
483483
ptProbe->uInterval = 6;
484484
ptProbe->tFlags |= PL_ENVIRONMENT_PROBE_FLAGS_INCLUDE_SKY;
485+
gptRenderer->add_probe_to_scene(ptAppData->ptScene, tProbeEntity);
485486
}
486487

487488
gptRenderer->load_skybox_from_panorama(ptAppData->ptScene, "/environments/sky.hdr", 1024);
@@ -504,6 +505,12 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
504505
// gptModelLoader->load_gltf(ptAppData->ptComponentLibrary, "/gltf/BoxTextured/glTF/BoxTextured.gltf", &tModelTranslation, &tLoaderData0);
505506
// gptModelLoader->load_gltf(ptAppData->ptComponentLibrary, "C:/Users/Jonathan Hoffstadt/Documents/Models/BistroExteriorGltf/bistro_exterior.gltf", NULL, &tLoaderData0);
506507
gptRenderer->add_drawable_objects_to_scene(ptAppData->ptScene, tLoaderData0.uObjectCount, tLoaderData0.atObjects);
508+
509+
plMaterialComponent* ptMaterials = NULL;
510+
const plEntity* ptMaterialEntities = NULL;
511+
const uint32_t uMaterialCount = gptEcs->get_components(ptAppData->ptComponentLibrary, gptMaterial->get_ecs_type_key(), (void**)&ptMaterials, &ptMaterialEntities);
512+
gptRenderer->add_materials_to_scene(ptAppData->ptScene, uMaterialCount, ptMaterialEntities);
513+
507514
gptModelLoader->free_data(&tLoaderData0);
508515
gptRenderer->finalize_scene(ptAppData->ptScene);
509516

editor/editor.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,12 @@ pl__show_editor_window(plAppData* ptAppData)
10961096
gptRenderer->add_drawable_objects_to_scene(ptAppData->ptScene, tLoaderData0.uObjectCount, tLoaderData0.atObjects);
10971097
gptModelLoader->free_data(&tLoaderData0);
10981098

1099+
plMaterialComponent* ptMaterials = NULL;
1100+
const plEntity* ptMaterialEntities = NULL;
1101+
const uint32_t uMaterialCount = gptEcs->get_components(ptAppData->ptCompLibrary, gptMaterial->get_ecs_type_key(), (void**)&ptMaterials, &ptMaterialEntities);
1102+
gptRenderer->add_materials_to_scene(ptAppData->ptScene, uMaterialCount, ptMaterialEntities);
1103+
1104+
10991105
gptRenderer->finalize_scene(ptAppData->ptScene);
11001106
}
11011107

@@ -1337,11 +1343,13 @@ pl__create_scene(plAppData* ptAppData)
13371343
ptSLightTransform->tTranslation = pl_create_vec3(0.0f, 4.0f, -1.18f);
13381344

13391345
plEnvironmentProbeComponent* ptProbe = nullptr;
1340-
gptRenderer->create_environment_probe(ptAppData->ptCompLibrary, "Main Probe", pl_create_vec3(0.0f, 3.0f, 0.0f), &ptProbe);
1346+
plEntity tProbeEntity = gptRenderer->create_environment_probe(ptAppData->ptCompLibrary, "Main Probe", pl_create_vec3(0.0f, 3.0f, 0.0f), &ptProbe);
13411347
ptProbe->fRange = 30.0f;
13421348
ptProbe->uResolution = 128;
13431349
ptProbe->tFlags |= PL_ENVIRONMENT_PROBE_FLAGS_INCLUDE_SKY;
13441350

1351+
gptRenderer->add_probe_to_scene(ptAppData->ptScene, tProbeEntity);
1352+
13451353
}
13461354

13471355
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)