Skip to content

Commit 91c98bd

Browse files
committed
WIP
1 parent 51eb283 commit 91c98bd

32 files changed

Lines changed: 1036 additions & 634 deletions

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ jobs:
188188
if not exist ../out/pl_shader_variant_ext.dll exit 1
189189
if not exist ../out/pl_dds_ext.dll exit 1
190190
if not exist ../out/pl_dxt_ext.dll exit 1
191+
if not exist ../out/pl_material_ext.dll exit 1
192+
if not exist ../out/pl_script_ext.dll exit 1
191193
cd ..
192194
193195
- name: Package Pilot Light
@@ -393,6 +395,8 @@ jobs:
393395
test -f ./out/pl_shader_variant_ext.dylib || exit 1
394396
test -f ./out/pl_dds_ext.dylib || exit 1
395397
test -f ./out/pl_dxt_ext.dylib || exit 1
398+
test -f ./out/pl_material_ext.dylib || exit 1
399+
test -f ./out/pl_script_ext.dylib || exit 1
396400
397401
- name: Package Pilot Light
398402
run: |
@@ -609,6 +613,8 @@ jobs:
609613
test -f ./out/pl_shader_variant_ext.so || exit 1
610614
test -f ./out/pl_dds_ext.so || exit 1
611615
test -f ./out/pl_dxt_ext.so || exit 1
616+
test -f ./out/pl_material_ext.so || exit 1
617+
test -f ./out/pl_script_ext.so || exit 1
612618
613619
- name: Package Pilot Light
614620
run: |

docs/changelog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Below is the change log for typical users. Minor and older changes stripped
66
away, please see git history for details.
77

8-
- v0.5.4 (2025-xx-xx) add ACES & Reinhard tonemapping
8+
- v0.6.0 (2025-xx-xx) add ACES & Reinhard tonemapping
99
add exposure, contrast, brightness, & saturation controls
1010
fix long standing shadow mapping viewport technique issue
1111
- v0.5.3 (2025-08-01) fix pl_ds.h hm32 reset (v1.0.1)

docs/version.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
v0.5.4 WIP
1+
v0.6.0 WIP
22

33
-----------------------------------------------------------------------------
44
Versioning
@@ -36,7 +36,7 @@ the API is complete. It just means we won't break what currently exists.
3636
* Data Registry v1.0.0 (pl.h)
3737
* Memory v1.0.2 (pl.h)
3838
* Extension Registry v1.1.0 (pl.h)
39-
* IO v1.1.0 (pl.h)
39+
* IO v1.1.1 (pl.h)
4040
* Window v1.0.0 (pl.h)
4141
* Library v1.0.2 (pl.h)
4242

@@ -81,11 +81,11 @@ the API is complete. It just means we won't break what currently exists.
8181
* Date & Time v1.0.0 (pl_datetime_ext.h)
8282
* Compression v1.0.0 (pl_compress_ext.h)
8383
* Virtual File System v1.0.0 (pl_vfs_ext.h)
84+
* ECS v1.0.0 (pl_ecs_ext.h)
8485

8586
## Nearly Stable Extensions
8687

8788
* Resource v0.2.2 (pl_resource_ext.h)
88-
* ECS v0.3.1 (pl_ecs_ext.h)
8989
* Bvh v0.2.0 (pl_bvh_ext.h)
9090
* Physics v0.2.0 (pl_physics_ext.h)
9191
* Collision v0.2.0 (pl_collision_ext.h)
@@ -103,3 +103,4 @@ the API is complete. It just means we won't break what currently exists.
103103
* Renderer v0.2.1 (pl_renderer_ext.h)
104104
* Dear ImGui v0.1.0 (pl_dear_imgui_ext.h)
105105
* Animation v0.1.0 (pl_animation_ext.h)
106+
* Material v0.1.0 (pl_material_ext.h)

editor/app.c

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Index of this file:
6161

6262
// unstable extensions
6363
#include "pl_ecs_ext.h"
64+
#include "pl_material_ext.h"
6465
#include "pl_mesh_ext.h"
6566
#include "pl_camera_ext.h"
6667
#include "pl_animation_ext.h"
@@ -76,6 +77,7 @@ Index of this file:
7677
#include "pl_shader_variant_ext.h"
7778
#include "pl_vfs_ext.h"
7879
#include "pl_compress_ext.h"
80+
#include "pl_script_ext.h"
7981

8082
// shaders
8183
#include "pl_shader_interop_renderer.h" // PL_MESH_FORMAT_FLAG_XXXX
@@ -120,6 +122,8 @@ const plVfsI* gptVfs = NULL;
120122
const plPakI* gptPak = NULL;
121123
const plDateTimeI* gptDateTime = NULL;
122124
const plCompressI* gptCompress = NULL;
125+
const plMaterialI* gptMaterial = NULL;
126+
const plScriptI* gptScript = NULL;
123127

124128
#define PL_ALLOC(x) gptMemory->tracked_realloc(NULL, (x), __FILE__, __LINE__)
125129
#define PL_REALLOC(x, y) gptMemory->tracked_realloc((x), (y), __FILE__, __LINE__)
@@ -390,10 +394,12 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
390394

391395
gptEcs->initialize((plEcsInit){0});
392396
gptRenderer->register_ecs_system();
397+
gptScript->register_ecs_system();
393398
gptCamera->register_ecs_system();
394399
gptAnimation->register_ecs_system();
395400
gptMesh->register_ecs_system();
396401
gptPhysics->register_ecs_system();
402+
gptMaterial->register_ecs_system();
397403
gptEcs->finalize();
398404
ptAppData->ptComponentLibrary = gptEcs->get_default_library();
399405

@@ -403,14 +409,13 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
403409
};
404410
ptAppData->ptScene = gptRenderer->create_scene(tSceneInit);
405411
ptAppData->ptView = gptRenderer->create_view(ptAppData->ptScene, ptIO->tMainViewportSize);
406-
ptAppData->ptSecondaryView = gptRenderer->create_view(ptAppData->ptScene, (plVec2){500.0f, 500.0f});
407412

408413
// create main camera
409414
plCamera* ptMainCamera = NULL;
410415
ptAppData->tMainCamera = gptCamera->create_perspective(ptAppData->ptComponentLibrary, "main camera", pl_create_vec3(-4.012f, 2.984f, -1.109f), PL_PI_3, ptIO->tMainViewportSize.x / ptIO->tMainViewportSize.y, 0.1f, 48.0f, true, &ptMainCamera);
411416
gptCamera->set_pitch_yaw(ptMainCamera, -0.465f, 1.341f);
412417
gptCamera->update(ptMainCamera);
413-
gptEcs->attach_script(ptAppData->ptComponentLibrary, "pl_script_camera", PL_SCRIPT_FLAG_PLAYING | PL_SCRIPT_FLAG_RELOADABLE, ptAppData->tMainCamera, NULL);
418+
gptScript->attach(ptAppData->ptComponentLibrary, "pl_script_camera", PL_SCRIPT_FLAG_PLAYING | PL_SCRIPT_FLAG_RELOADABLE, ptAppData->tMainCamera, NULL);
414419

415420
// create secondary camera
416421
plCamera* ptSecondaryCamera = NULL;
@@ -530,7 +535,8 @@ pl_app_shutdown(plAppData* ptAppData)
530535
gptConsole->cleanup();
531536

532537
gptRenderer->cleanup_view(ptAppData->ptView);
533-
gptRenderer->cleanup_view(ptAppData->ptSecondaryView);
538+
if(ptAppData->ptSecondaryView)
539+
gptRenderer->cleanup_view(ptAppData->ptSecondaryView);
534540
gptRenderer->cleanup_scene(ptAppData->ptScene);
535541

536542
gptEcs->cleanup();
@@ -615,7 +621,7 @@ pl_app_update(plAppData* ptAppData)
615621

616622
// run ecs system
617623
pl_begin_cpu_sample(gptProfile, 0, "Run ECS");
618-
gptEcs->run_script_update_system(ptAppData->ptComponentLibrary);
624+
gptScript->run_update_system(ptAppData->ptComponentLibrary);
619625
gptAnimation->run_animation_update_system(ptAppData->ptComponentLibrary, ptIO->fDeltaTime);
620626
gptPhysics->update(ptIO->fDeltaTime, ptAppData->ptComponentLibrary);
621627
gptEcs->run_transform_update_system(ptAppData->ptComponentLibrary);
@@ -700,19 +706,22 @@ pl_app_update(plAppData* ptAppData)
700706
plLightComponent* ptLights = NULL;
701707
const uint32_t uLightCount = gptEcs->get_components(ptAppData->ptComponentLibrary, gptRenderer->get_ecs_type_key_light(), (void**)&ptLights, NULL);
702708
gptRenderer->debug_draw_lights(ptAppData->ptView, ptLights, uLightCount);
703-
gptRenderer->debug_draw_lights(ptAppData->ptSecondaryView, ptLights, uLightCount);
709+
if(ptAppData->ptSecondaryView)
710+
gptRenderer->debug_draw_lights(ptAppData->ptSecondaryView, ptLights, uLightCount);
704711
}
705712

706713
if(ptAppData->bDrawAllBoundingBoxes)
707714
{
708715
gptRenderer->debug_draw_all_bound_boxes(ptAppData->ptView);
709-
gptRenderer->debug_draw_all_bound_boxes(ptAppData->ptSecondaryView);
716+
if(ptAppData->ptSecondaryView)
717+
gptRenderer->debug_draw_all_bound_boxes(ptAppData->ptSecondaryView);
710718
}
711719

712720
if(ptAppData->bShowSkybox)
713721
{
714722
gptRenderer->show_skybox(ptAppData->ptView);
715-
gptRenderer->show_skybox(ptAppData->ptSecondaryView);
723+
if(ptAppData->ptSecondaryView)
724+
gptRenderer->show_skybox(ptAppData->ptSecondaryView);
716725
}
717726

718727
if(ptAppData->bShowBVH)
@@ -724,7 +733,8 @@ pl_app_update(plAppData* ptAppData)
724733
if(ptAppData->bShowGrid)
725734
{
726735
gptRenderer->show_grid(ptAppData->ptView);
727-
gptRenderer->show_grid(ptAppData->ptSecondaryView);
736+
if(ptAppData->ptSecondaryView)
737+
gptRenderer->show_grid(ptAppData->ptSecondaryView);
728738
}
729739

730740
// render scene
@@ -839,7 +849,18 @@ pl__show_editor_window(plAppData* ptAppData)
839849
gptUI->checkbox("Editor Attached", &ptAppData->bEditorAttached);
840850
gptUI->checkbox("Show Debug Lights", &ptAppData->bShowDebugLights);
841851
gptUI->checkbox("Show Bounding Boxes", &ptAppData->bDrawAllBoundingBoxes);
842-
gptUI->checkbox("Secondary View", &ptAppData->bSecondaryViewActive);
852+
if(gptUI->checkbox("Secondary View", &ptAppData->bSecondaryViewActive))
853+
{
854+
if(ptAppData->bSecondaryViewActive)
855+
{
856+
ptAppData->ptSecondaryView = gptRenderer->create_view(ptAppData->ptScene, (plVec2){500.0f, 500.0f});
857+
}
858+
else
859+
{
860+
gptRenderer->cleanup_view(ptAppData->ptSecondaryView);
861+
ptAppData->ptSecondaryView = NULL;
862+
}
863+
}
843864

844865
gptUI->vertical_spacing();
845866

@@ -1061,6 +1082,8 @@ pl__load_apis(plApiRegistryI* ptApiRegistry)
10611082
gptPak = pl_get_api_latest(ptApiRegistry, plPakI);
10621083
gptDateTime = pl_get_api_latest(ptApiRegistry, plDateTimeI);
10631084
gptCompress = pl_get_api_latest(ptApiRegistry, plCompressI);
1085+
gptMaterial = pl_get_api_latest(ptApiRegistry, plMaterialI);
1086+
gptScript = pl_get_api_latest(ptApiRegistry, plScriptI);
10641087
}
10651088

10661089

editor/editor.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
8989
gptPak = pl_get_api_latest(ptApiRegistry, plPakI);
9090
gptDateTime = pl_get_api_latest(ptApiRegistry, plDateTimeI);
9191
gptCompress = pl_get_api_latest(ptApiRegistry, plCompressI);
92+
gptMaterial = pl_get_api_latest(ptApiRegistry, plMaterialI);
93+
gptScript = pl_get_api_latest(ptApiRegistry, plScriptI);
9294

9395
ImPlot::SetCurrentContext((ImPlotContext*)ptDataRegistry->get_data("implot"));
9496

@@ -145,6 +147,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
145147
gptPak = pl_get_api_latest(ptApiRegistry, plPakI);
146148
gptDateTime = pl_get_api_latest(ptApiRegistry, plDateTimeI);
147149
gptCompress = pl_get_api_latest(ptApiRegistry, plCompressI);
150+
gptMaterial = pl_get_api_latest(ptApiRegistry, plMaterialI);
148151

149152
// this path is taken only during first load, so we
150153
// allocate app memory here
@@ -242,6 +245,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plAppData* ptAppData)
242245
// initialize ecs component library
243246
gptEcs->initialize({});
244247
gptRenderer->register_ecs_system();
248+
gptScript->register_ecs_system();
245249
gptAnimation->register_ecs_system();
246250
gptCamera->register_ecs_system();
247251
gptMesh->register_ecs_system();
@@ -439,7 +443,7 @@ pl_app_update(plAppData* ptAppData)
439443

440444
// run ecs system
441445
pl_begin_cpu_sample(gptProfile, 0, "Run ECS");
442-
gptEcs->run_script_update_system(ptAppData->ptCompLibrary);
446+
gptScript->run_update_system(ptAppData->ptCompLibrary);
443447
gptAnimation->run_animation_update_system(ptAppData->ptCompLibrary, ptIO->fDeltaTime);
444448
gptPhysics->update(ptIO->fDeltaTime, ptAppData->ptCompLibrary);
445449
gptEcs->run_transform_update_system(ptAppData->ptCompLibrary);

editor/editor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Index of this file:
7272
#include "pl_collision_ext.h"
7373
#include "pl_bvh_ext.h"
7474
#include "pl_shader_variant_ext.h"
75+
#include "pl_material_ext.h"
76+
#include "pl_script_ext.h"
7577

7678
// shaders
7779
#include "pl_shader_interop_renderer.h" // PL_MESH_FORMAT_FLAG_XXXX
@@ -122,6 +124,8 @@ const plVfsI* gptVfs = nullptr;
122124
const plPakI* gptPak = nullptr;
123125
const plDateTimeI* gptDateTime = nullptr;
124126
const plCompressI* gptCompress = nullptr;
127+
const plMaterialI* gptMaterial = nullptr;
128+
const plScriptI* gptScript = nullptr;
125129

126130
#define PL_ALLOC(x) gptMemory->tracked_realloc(nullptr, (x), __FILE__, __LINE__)
127131
#define PL_REALLOC(x, y) gptMemory->tracked_realloc((x), (y), __FILE__, __LINE__)

editor/editor_entities.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ pl__show_entity_components(plAppData* ptAppData, plScene* ptScene, plEntity tEnt
2727
const plEcsTypeKey tMeshComponentType = gptMesh->get_ecs_type_key_mesh();
2828
const plEcsTypeKey tObjectComponentType = gptRenderer->get_ecs_type_key_object();
2929
const plEcsTypeKey tHierarchyComponentType = gptEcs->get_ecs_type_key_hierarchy();
30-
const plEcsTypeKey tMaterialComponentType = gptRenderer->get_ecs_type_key_material();
30+
const plEcsTypeKey tMaterialComponentType = gptMaterial->get_ecs_type_key();
3131
const plEcsTypeKey tSkinComponentType = gptRenderer->get_ecs_type_key_skin();
3232
const plEcsTypeKey tCameraComponentType = gptCamera->get_ecs_type_key();
3333
const plEcsTypeKey tAnimationComponentType = gptAnimation->get_ecs_type_key_animation();
3434
const plEcsTypeKey tInverseKinematicsComponentType = gptAnimation->get_ecs_type_key_inverse_kinematics();
3535
const plEcsTypeKey tLightComponentType = gptRenderer->get_ecs_type_key_light();
3636
const plEcsTypeKey tEnvironmentProbeComponentType = gptRenderer->get_ecs_type_key_environment_probe();
3737
const plEcsTypeKey tHumanoidComponentType = gptAnimation->get_ecs_type_key_humanoid();
38-
const plEcsTypeKey tScriptComponentType = gptEcs->get_ecs_type_key_script();
38+
const plEcsTypeKey tScriptComponentType = gptScript->get_ecs_type_key();
3939
const plEcsTypeKey tRigidBodyComponentType = gptPhysics->get_ecs_type_key_rigid_body_physics();
4040
const plEcsTypeKey tForceFieldComponentType = gptPhysics->get_ecs_type_key_force_field();
4141

@@ -466,8 +466,6 @@ pl__show_entity_components(plAppData* ptAppData, plScene* ptScene, plEntity tEnt
466466
if(ImGui::InputFloat("Roughness", &ptMaterialComp->fRoughness)) bMaterialModified = true;
467467
if(ImGui::InputFloat("Metalness", &ptMaterialComp->fMetalness)) bMaterialModified = true;
468468
if(ImGui::InputFloat("Alpha Cutoff", &ptMaterialComp->fAlphaCutoff)) bMaterialModified = true;
469-
if(ImGui::InputFloat("Normal Map Strength", &ptMaterialComp->fNormalMapStrength)) bMaterialModified = true;
470-
if(ImGui::InputFloat("Occulusion Map Strength", &ptMaterialComp->fOcclusionMapStrength)) bMaterialModified = true;
471469
if(ImGui::InputFloat4("Base Factor", ptMaterialComp->tBaseColor.d)) bMaterialModified = true;
472470
if(ImGui::InputFloat4("Emmissive Factor", ptMaterialComp->tEmissiveColor.d)) bMaterialModified = true;
473471

0 commit comments

Comments
 (0)