![]() |
Lysa
0.0
Lysa 3D Engine
|
Lysa provides two complementary binary file formats for shipping game data:
.assets) : a self-contained scene file that bundles meshes, materials, textures, and an optional animation library exported from a 3D tool such as Blender..rpack) : a flat archive that replaces the entire app:// virtual file system at runtime, bundling shaders, scripts, fonts, and any other game resource into a single distributable file.Both formats are read-only at runtime and accessed through the same lysa::VirtualFS API as plain files, so no loading code changes when switching between loose files and packed assets.
An assets pack is a binary file that represents a complete 3D scene or a reusable mesh library. It is designed for fast, copy-minimal GPU upload:
Assets packs are produced from glTF files by the gltf2lysa command-line converter, which is typically invoked automatically by the Lysa Blender add-on (tools/blender/blender_lysa_addon.py).
From Blender, the add-on exports the scene as a .glb file and then calls:
| Argument | Description |
|---|---|
-v | Verbose output |
-t <n> | Number of parallel compression threads (0 = auto-detect) |
-f <format> | BCn compression format for colour textures: bc1, bc2, bc3, or bc7 (default) |
The resulting .assets file is placed in the project's res/models/ directory and referenced via the app:// URI scheme.
Call the template function lysa::AssetsPack::load with your node types. It returns a shared pointer to a synthetic root node containing the full scene tree.
The three template parameters let the engine instantiate the correct node classes for your scene graph layer:
The lysa::AssetsPack::load function:
AsyncQueue.AnimationLibrary and attaches an AnimationPlayer node to the root.A resources pack replaces the app:// virtual file system at runtime. When configured, every VFS read : shaders, fonts, scripts, .assets files, images : is transparently served from the pack instead of the host file system. The application code does not change at all.
The format is a simple flat archive: a fixed binary header, a directory of path/offset/size entries, and a data blob containing the raw resource bytes.
Resources packs are built with the rpack_builder command-line tool, which reads a plain-text file list and writes a .rpack binary:
| Option | Description |
|---|---|
-o, --output | Path of the .rpack file to create (required) |
-l, --list | Text file containing resource paths, one per line, relative to --base (required) |
-b, --base | Base directory on disk that all listed paths are relative to (default: .) |
-v, --verbose | Print each resource being added and a final size summary |
Lines starting with # and empty lines in the file list are ignored. Paths must be shorter than 256 characters.
Step 1 : generate the file list with the provided Python helper tools/gen_pack_list.py:
gen_pack_list.py walks the lib/, shaders/, and res/ directories and emits one path per line for every file matching the extensions .lua, .spv, .dxil, .jpg, .png, .json, .ttf, and .assets. Edit the script or write your own if your project uses a different layout.
Step 2 : build the pack:
Verbose output lists every resource added and prints a final summary:
Set VirtualFSConfiguration::appPackFile in the engine configuration before constructing lysa::Lysa:
When appPackFile is set, every app:// read is transparently redirected to the pack. The pack is opened once at startup; reads stream directly from the file via ResourcesPackStreambuf without loading resources into a temporary CPU buffer.
When appPackFile is empty (the default), the VFS reads from the host file system relative to VirtualFSConfiguration::appDirectory (defaults to .), which is the normal workflow during development.
ResourcesPack exposes a standard stream interface through openStream(), which returns a ResourcesPackStreambuf backed by a bounded region of the pack file. This is the same interface used internally when loading assets packs from within a resources pack:
The streambuf uses a 4 KB read buffer by default and seeks the underlying file on demand, so large resources are never fully loaded into memory unless the caller explicitly reads them all.
Development : use loose files for fast iteration:
Distribution : bundle everything into a single resources pack:
No other code changes are needed: the VFS, AssetsPack::load, and all resource managers work identically in both modes.