From a2f0f7c7a45ba8b30984fb135b8b54f11fb119f8 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 8 Mar 2026 09:33:17 +0100 Subject: feat: Implement dual-mode asset loading and update documentation This commit introduces a dual-mode asset loading system to enhance developer workflow and optimize release builds. Key changes include: - **Dual-Mode Asset Loading:** Assets are now loaded from disk during development (when is OFF) for faster iteration, particularly for heavy assets like and files. For release builds ( ON), all assets are embedded directly into the binary, ensuring a single, self-contained executable. - **Explicit Asset Typing:** Replaced generic asset type with specific types (, , , , ) in and the enum in for clearer categorization and more robust processing. - **Build System Integration:** Modified to pass a flag to in development builds. - **Asset Packer Updates:** now generates file paths for disk-loaded assets and embeds data for others based on the build mode. - **Asset Manager Enhancements:** includes new logic in for loading and caching disk-based assets and updates to for proper memory deallocation. - **Documentation:** Updated to reflect the new asset nomenclature and dual-mode loading strategy. - **Project Rules:** Added a concise rule to mandating top-level documentation updates for medium/large sub-system changes. handoff(Gemini): Implemented dual-mode asset loading and updated documentation. --- cmake/DemoCodegen.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmake/DemoCodegen.cmake') diff --git a/cmake/DemoCodegen.cmake b/cmake/DemoCodegen.cmake index 32cb06c..4d0d271 100644 --- a/cmake/DemoCodegen.cmake +++ b/cmake/DemoCodegen.cmake @@ -239,11 +239,16 @@ add_custom_target(generate_demo_data DEPENDS ${GEN_DEMO_H}.data_stamp) # assets.h is written via copy_if_different so its mtime only changes when the # enum content changes (e.g. new asset added). This prevents unrelated # translation units (audio, 3d, …) from recompiling on every shader edit. +set(ASSET_PACKER_FLAGS "") +if(NOT DEMO_STRIP_ALL) + set(ASSET_PACKER_FLAGS "--disk_load") +endif() + set(GEN_DEMO_H_STAMP ${GEN_DEMO_H}.gen_stamp) add_custom_command( OUTPUT ${GEN_DEMO_H_STAMP} ${GEN_DEMO_CC} COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/generated - COMMAND ${ASSET_PACKER_CMD} ${WORKSPACE_ASSETS} ${GEN_DEMO_H}.new ${GEN_DEMO_CC} + COMMAND ${ASSET_PACKER_CMD} ${WORKSPACE_ASSETS} ${GEN_DEMO_H}.new ${GEN_DEMO_CC} ${ASSET_PACKER_FLAGS} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GEN_DEMO_H}.new ${GEN_DEMO_H} COMMAND ${CMAKE_COMMAND} -E touch ${GEN_DEMO_H_STAMP} DEPENDS ${ASSET_PACKER_DEPENDS} ${WORKSPACE_ASSETS} -- cgit v1.2.3