@@ -78,7 +78,6 @@ Index of this file:
7878#include "pl_compress_ext.h"
7979#include "pl_script_ext.h"
8080#include "pl_terrain_ext.h"
81- #include "pl_terrain_processor_ext.h"
8281
8382// shaders
8483#include "pl_shader_interop_renderer.h" // PL_MESH_FORMAT_FLAG_XXXX
@@ -125,7 +124,6 @@ const plCompressI* gptCompress = NULL;
125124const plMaterialI * gptMaterial = NULL ;
126125const plScriptI * gptScript = NULL ;
127126const plTerrainI * gptTerrain = NULL ;
128- const plTerrainProcessorI * gptTerrainProcessor = NULL ;
129127
130128#define PL_ALLOC (x ) gptMemory->tracked_realloc(NULL, (x), __FILE__, __LINE__)
131129#define PL_REALLOC (x , y ) gptMemory->tracked_realloc((x), (y), __FILE__, __LINE__)
@@ -251,6 +249,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
251249 gptVfs -> mount_directory ("/gltf" , "../data/glTF-Sample-Assets-main/Models" , PL_VFS_MOUNT_FLAGS_NONE );
252250 gptVfs -> mount_directory ("/fonts" , "../data/pilotlight-assets-master/fonts" , PL_VFS_MOUNT_FLAGS_NONE );
253251 gptVfs -> mount_directory ("/environments" , "../data/pilotlight-assets-master/environments" , PL_VFS_MOUNT_FLAGS_NONE );
252+ gptVfs -> mount_directory ("/textures" , "../data/pilotlight-assets-master/terrain" , PL_VFS_MOUNT_FLAGS_NONE );
254253 gptVfs -> mount_directory ("/shaders" , "../shaders" , PL_VFS_MOUNT_FLAGS_NONE );
255254 gptVfs -> mount_directory ("/shader-temp" , "../shader-temp" , PL_VFS_MOUNT_FLAGS_NONE );
256255
@@ -424,24 +423,37 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
424423 ptAppData -> ptScene = gptRenderer -> create_scene (tSceneInit );
425424 ptAppData -> ptView = gptRenderer -> create_view (ptAppData -> ptScene , ptIO -> tMainViewportSize );
426425
426+ // float fXOffset = -330.0f;
427+ // float fYOffset = 87.0f;
428+ // float fZOffset = -330.0f;
429+
430+ // float fXOffset = -30.0f;
431+ // float fYOffset = 0.1f;
432+ // float fZOffset = 0.0f;
433+
434+ float fXOffset = -30.0f ;
435+ float fYOffset = 0.1f ;
436+ float fZOffset = 0.0f ;
437+
427438 // create main camera
428439 plCamera * ptMainCamera = NULL ;
429- ptAppData -> tMainCamera = gptCamera -> create_perspective (ptAppData -> ptComponentLibrary , "main camera" , pl_create_vec3_d (-4.012 , 2.984 , -1.109 ), PL_PI_3 , ptIO -> tMainViewportSize .x / ptIO -> tMainViewportSize .y , 0.1f , 30.0f , true, & ptMainCamera );
430- gptCamera -> set_pitch_yaw (ptMainCamera , -0.465f , 1.341f );
440+ // ptAppData->tMainCamera = gptCamera->create_perspective(ptAppData->ptComponentLibrary, "main camera", pl_create_vec3_d(fXOffset -4.012, fYOffset + 2.984, fZOffset-1.109), PL_PI_3, ptIO->tMainViewportSize.x / ptIO->tMainViewportSize.y, 0.1f, 650.0f, true, &ptMainCamera);
441+ ptAppData -> tMainCamera = gptCamera -> create_perspective (ptAppData -> ptComponentLibrary , "main camera" , pl_create_vec3_d (fXOffset , fYOffset + 2.984 , fZOffset ), PL_PI_3 , ptIO -> tMainViewportSize .x / ptIO -> tMainViewportSize .y , 0.1f , 650.0f , true, & ptMainCamera );
442+ gptCamera -> set_pitch_yaw (ptMainCamera , 0.0f , PL_PI_2 );
431443 gptCamera -> update (ptMainCamera );
432444 gptScript -> attach (ptAppData -> ptComponentLibrary , "pl_script_camera" , PL_SCRIPT_FLAG_PLAYING | PL_SCRIPT_FLAG_RELOADABLE , ptAppData -> tMainCamera , NULL );
433445
434446 // create secondary camera
435447 plCamera * ptSecondaryCamera = NULL ;
436- ptAppData -> tSecondaryCamera = gptCamera -> create_perspective (ptAppData -> ptComponentLibrary , "secondary camera" , pl_create_vec3_d (-4.012f , 2.984f , -1.109f ), PL_PI_3 , 1.0f , 0.1f , 20.0f , true, & ptSecondaryCamera );
448+ ptAppData -> tSecondaryCamera = gptCamera -> create_perspective (ptAppData -> ptComponentLibrary , "secondary camera" , pl_create_vec3_d (fXOffset - 4.012f , fYOffset + 2.984f , fZOffset - 1.109f ), PL_PI_3 , 1.0f , 0.1f , 20.0f , true, & ptSecondaryCamera );
437449 gptCamera -> set_pitch_yaw (ptSecondaryCamera , -0.465f , 1.341f );
438450 gptCamera -> update (ptSecondaryCamera );
439451 plTransformComponent * ptSecondaryCameraTransform = (plTransformComponent * )gptEcs -> add_component (ptAppData -> ptComponentLibrary , gptEcs -> get_ecs_type_key_transform (), ptAppData -> tSecondaryCamera );
440- ptSecondaryCameraTransform -> tTranslation = pl_create_vec3 (-4.012f , 2.984f , -1.109f );
452+ ptSecondaryCameraTransform -> tTranslation = pl_create_vec3 (fXOffset - 4.012f , fYOffset + 2.984f , fZOffset - 1.109f );
441453
442454 plEnvironmentProbeComponent * ptProbe = NULL ;
443455 plVec3 atProbeLocations [] = {
444- pl_create_vec3 (0.0f , 3.0f , 0.0f ),
456+ pl_create_vec3 (fXOffset + 0.0f , fYOffset + 3.0f , fZOffset + 0.0f ),
445457 // pl_create_vec3(-8.7f, 1.5f, 0.0f),
446458 // pl_create_vec3(8.8f, 1.5f, 0.0f),
447459 };
@@ -459,34 +471,35 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
459471
460472 // create lights
461473 plLightComponent * ptLight = NULL ;
462- plEntity tDirectionLight = gptRenderer -> create_directional_light (ptAppData -> ptComponentLibrary , "direction light" , pl_create_vec3 (0.425f , -1.0f , -0.384f ), & ptLight );
474+ // plEntity tDirectionLight = gptRenderer->create_directional_light(ptAppData->ptComponentLibrary, "direction light", pl_create_vec3(0.425f, -1.0f, -0.384f), &ptLight);
475+ plEntity tDirectionLight = gptRenderer -> create_directional_light (ptAppData -> ptComponentLibrary , "direction light" , pl_create_vec3 (0.0f , -1.0f , 0.0f ), & ptLight );
463476 ptLight -> uCascadeCount = 4 ;
464477 ptLight -> fIntensity = 18.0f ;
465478 ptLight -> uShadowResolution = 1024 * 2 ;
466- ptLight -> afCascadeSplits [0 ] = 0.05f ;
467- ptLight -> afCascadeSplits [1 ] = 0.15f ;
468- ptLight -> afCascadeSplits [2 ] = 0.25f ;
479+ ptLight -> afCascadeSplits [0 ] = 0.005f ;
480+ ptLight -> afCascadeSplits [1 ] = 0.020f ;
481+ ptLight -> afCascadeSplits [2 ] = 0.10f ;
469482 ptLight -> afCascadeSplits [3 ] = 1.00f ;
470483 ptLight -> tFlags |= PL_LIGHT_FLAG_CAST_SHADOW | PL_LIGHT_FLAG_VISUALIZER ;
471484
472- plEntity tPointLight = gptRenderer -> create_point_light (ptAppData -> ptComponentLibrary , "point light" , pl_create_vec3 (9.316f , 1.497f , -1.042f ), & ptLight );
485+ plEntity tPointLight = gptRenderer -> create_point_light (ptAppData -> ptComponentLibrary , "point light" , pl_create_vec3 (fXOffset + 9.316f , fYOffset + 1.497f , fZOffset - 1.042f ), & ptLight );
473486 ptLight -> uShadowResolution = 512 ;
474487 ptLight -> tColor = (plVec3 ){0.0f , 1.0f , 0.0f };
475488 ptLight -> tFlags |= PL_LIGHT_FLAG_CAST_SHADOW | PL_LIGHT_FLAG_VISUALIZER ;
476489 plTransformComponent * ptPLightTransform = (plTransformComponent * )gptEcs -> add_component (ptAppData -> ptComponentLibrary , gptEcs -> get_ecs_type_key_transform (), tPointLight );
477- ptPLightTransform -> tTranslation = pl_create_vec3 (9.316f , 1.497f , -1.042f );
490+ ptPLightTransform -> tTranslation = pl_create_vec3 (fXOffset + 9.316f , fYOffset + 1.497f , fZOffset - 1.042f );
478491
479- plEntity tSpotLight = gptRenderer -> create_spot_light (ptAppData -> ptComponentLibrary , "spot light" , pl_create_vec3 (0.0f , 3.27f , -1.5f ), pl_create_vec3 (0.0 , -0.390f , 0.368f ), & ptLight );
492+ plEntity tSpotLight = gptRenderer -> create_spot_light (ptAppData -> ptComponentLibrary , "spot light" , pl_create_vec3 (fXOffset + 0.0f , fYOffset + 3.27f , fZOffset - 1.5f ), pl_create_vec3 (0.0 , -0.390f , 0.368f ), & ptLight );
480493 ptLight -> uShadowResolution = 512 ;
481494 ptLight -> tColor = (plVec3 ){1.0f , 0.0f , 1.0f };
482495 ptLight -> fRange = 10.0f ;
483496 ptLight -> fRadius = 0.025f ;
484497 ptLight -> fIntensity = 20.0f ;
485498 ptLight -> tFlags |= PL_LIGHT_FLAG_CAST_SHADOW | PL_LIGHT_FLAG_VISUALIZER ;
486499 plTransformComponent * ptSLightTransform = (plTransformComponent * )gptEcs -> add_component (ptAppData -> ptComponentLibrary , gptEcs -> get_ecs_type_key_transform (), tSpotLight );
487- ptSLightTransform -> tTranslation = pl_create_vec3 (0.0f , 3.27f , -1.5f );
500+ ptSLightTransform -> tTranslation = pl_create_vec3 (fXOffset + 0.0f , fYOffset + 3.27f , fZOffset - 1.5f );
488501
489- plEntity tPointLight2 = gptRenderer -> create_point_light (ptAppData -> ptComponentLibrary , "point light2" , pl_create_vec3 (-6.316f , 1.497f , -1.042f ), & ptLight );
502+ plEntity tPointLight2 = gptRenderer -> create_point_light (ptAppData -> ptComponentLibrary , "point light2" , pl_create_vec3 (fXOffset - 6.316f , fYOffset + 1.497f , fZOffset - 1.042f ), & ptLight );
490503 ptLight -> tColor = (plVec3 ){1.0f , 1.0f , 1.0f };
491504 ptLight -> tFlags |= PL_LIGHT_FLAG_VISUALIZER ;
492505
@@ -499,11 +512,11 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
499512
500513 plModelLoaderData tLoaderData0 = {0 };
501514 plModelLoaderData tLoaderData1 = {0 };
502- plMat4 tModelTranslation = pl_mat4_translate_xyz (0.0f , 0.0f , 0.0f );
515+ plMat4 tModelTranslation = pl_mat4_translate_xyz (fXOffset , fYOffset , fZOffset );
503516 gptModelLoader -> load_gltf (ptAppData -> ptComponentLibrary , "/models/gltf/humanoid/model.gltf" , & tModelTranslation , & tLoaderData1 );
504517 // gptModelLoader->load_gltf(ptAppData->ptComponentLibrary, "/models/gltf/humanoid/floor.gltf", &tModelTranslation, &tLoaderData1);
505518 gptModelLoader -> load_gltf (ptAppData -> ptComponentLibrary , "/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf" , & tModelTranslation , & tLoaderData0 );
506- gptModelLoader -> load_gltf (ptAppData -> ptComponentLibrary , "/gltf/Sponza/glTF/Sponza.gltf" , & tModelTranslation , & tLoaderData0 );
519+ // gptModelLoader->load_gltf(ptAppData->ptComponentLibrary, "/gltf/Sponza/glTF/Sponza.gltf", &tModelTranslation, &tLoaderData0);
507520 // gptModelLoader->load_gltf(ptAppData->ptComponentLibrary, "/models/gltf/sort.gltf", &tModelTranslation, &tLoaderData0);
508521 // plMat4 tRotation = pl_mat4_rotate_xyz(-PL_PI_2, 0.0f, 1.0f, 0.0f);
509522 // gptModelLoader->load_gltf(ptAppData->ptComponentLibrary, "/gltf/CarConcept/glTF/CarConcept.gltf", &tRotation, &tLoaderData0);
@@ -1229,7 +1242,6 @@ pl__load_apis(plApiRegistryI* ptApiRegistry)
12291242 gptMaterial = pl_get_api_latest (ptApiRegistry , plMaterialI );
12301243 gptScript = pl_get_api_latest (ptApiRegistry , plScriptI );
12311244 gptTerrain = pl_get_api_latest (ptApiRegistry , plTerrainI );
1232- gptTerrainProcessor = pl_get_api_latest (ptApiRegistry , plTerrainProcessorI );
12331245}
12341246
12351247
0 commit comments