Conversation
Add CMake support to embed asset files into generated embedded_assets.h/.cpp and compile them into the executable. Created cmake/embed_resources.cmake and updated src/CMakeLists.txt to generate/compile embedded assets (textures and shaders) instead of copying runtime files. Updated code to load resources from memory: changed loadHUDIcon signature to accept PNG data/size and use stbi_load_from_memory, switched Renderer to populate textures from embedded PNGs, updated ToolModelGenerator to generate from embedded PNG data, and made ShaderClass read shader sources from embedded data. Removed runtime shader/asset copy steps and filesystem-based texture resolution. Includes small API changes (function signatures) and added embedded_assets.h includes where needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new CMake-based system for embedding asset files (textures and shaders) directly into the binary, eliminating the need to load these resources from the filesystem at runtime. It updates the codebase to load all relevant assets from memory, simplifying deployment and improving portability. The changes touch the build system, asset loading logic, and the interface for asset-related functions.
Key changes include:
Build system and asset embedding:
embed_resources.cmake) for converting asset files (textures and shaders) into C++ arrays, and generating corresponding header and source files at build time. (cmake/embed_resources.cmake,src/CMakeLists.txt, [1] [2]src/CMakeLists.txt,.clangd, [1] [2] [3]src/CMakeLists.txt, src/CMakeLists.txtL47-L76)Codebase refactoring for embedded assets:
Renderer.cpp, tool model generation inToolModelGenerator.cpp, and shader loading inShaderClass.cpp. (src/core/Renderer.cpp,src/rendering/ToolModelGenerator.cpp,src/rendering/opengl/ShaderClass.cpp, [1] [2] [3]src/core/MainGlobals.cpp,src/core/MainGlobals.h, [1] [2] [3]Interface and header changes:
src/core/MainGlobals.h,src/rendering/ToolModelGenerator.h, [1] [2]General code clean-up:
src/core/Renderer.cpp, src/core/Renderer.cppL89)Source file includes:
embedded_assets.hwhere needed. (src/core/MainGlobals.cpp,src/core/Renderer.cpp,src/rendering/ToolModelGenerator.cpp,src/rendering/opengl/ShaderClass.cpp, [1] [2] [3] [4]