Resources & Assets¶
Doriax projects combine editor-managed resources with runtime pools and file helpers. Assets are authored or imported in the editor, copied and transformed during export, then loaded on demand by the runtime as needed.
Asset types¶
| Asset type | Formats | Loaded by |
|---|---|---|
| Textures | PNG, JPG, TGA, BMP, PSD, HDR, SVG | Texture, texture pools |
| 3D Models | GLTF, GLB, OBJ | Model, MeshSystem |
| Materials | Engine .material files (YAML) |
Material struct, linked from mesh submeshes |
| Audio | OGG, WAV, MP3, FLAC | SoundPool, Sound |
| Fonts | TTF, OTF | Font pool, Text components |
| Shaders | Shader data (engine format) | ShaderPool, RenderSystem |
| Scenes | YAML scene files | SceneManager |
| Bundles | YAML bundle files | BundleManager |
Loading assets at runtime¶
Most high-level objects accept a file path and load the resource automatically:
Vector images (SVG)¶
.svg files are treated as textures: they are rasterized to RGBA when loaded, so they
work anywhere a raster texture does — sprites, UI images, and material maps. Only the
features of the bundled rasterizer are drawn (basic shapes, paths, solid and gradient fills,
and strokes); there is no text or filter/effect support, so convert text to paths when
authoring.
By default an SVG is rasterized at its intrinsic size (the width/height or viewBox in
the file). Because a vector is resolution-independent, you can rasterize it larger for crisp
results on high-DPI displays or when the image is drawn bigger than its native size. The
rasterization scale is set per texture (2.0 = twice the intrinsic resolution) and has no
effect on raster images:
The scale can also be set directly on a Texture reference — svgScale in Lua,
setSvgScale() in C++ (see Texture):
The property is saved with the scene and applied in exported projects, and because the
scale is part of the texture's identity, different slots can use the same SVG at different
resolutions. This is what the editor's per-slot SVG Scale control edits; see
Properties — texture fields. The legacy path form
"ui/icon.svg?svgScale=4" is still accepted and absorbed into the property when the path
is set. The rasterized size is capped to a GPU-friendly limit, so very large scales are
rejected rather than allocated.
Material files¶
.material files store PBR parameters outside scene YAML so many meshes can reference
one definition. Each file lists colour factors, metallic/roughness scalars, and relative
texture paths — the same fields as the Material
struct.
In the editor, drag a material preview from Properties into the Resources Browser
to create a file, or drag an existing .material from the browser onto a mesh to link
it. Linked materials reload when the file changes. See
Resources Browser — Material files.
At runtime, linked materials are resolved when the scene loads; exported games bundle the referenced textures and material data like any other asset.
Runtime pools¶
Pools avoid loading the same resource data twice and centralize ownership. Objects that use the same file path share the underlying data.
| Pool | Managed resource |
|---|---|
TextureDataPool |
Raw decoded texture data (pixels) |
TexturePool |
GPU-side texture handles |
ModelPool |
Parsed 3D model and skeleton data |
ShaderPool |
Compiled shader programs |
SoundPool |
Loaded audio data |
FontPool |
Parsed font data |
Pools are managed internally. You normally interact with them through high-level objects
(Sprite, Model, Sound), but you can query pool state or pre-warm a pool
for level loading.
For C++ teardown code, Engine::clearUnusedPools() releases entries that are owned
only by their pool and preserves resources still referenced by active scenes or engine
objects. Engine::clearPools() empties every pool and destroys pooled GPU textures and
shaders, so reserve it for engine or graphics-view shutdown. If asynchronous model
loads may still be running, call MeshSystem::cancelAllAsyncModelLoads() before either
cleanup operation; cancellation waits for the active worker tasks to finish before it
returns.
The editor performs the safe sequence automatically when you switch projects: it quiesces project-specific background work, destroys the old scenes, and then clears unreferenced pool entries.
See Engine and MeshSystem for the complete C++ API.
File I/O¶
FileData is the abstract base for byte-level access; File reads and writes files on
disk and Data wraps an in-memory buffer. All three share readString, writeString,
read8/16/32, seek, pos, length, and eof.
File paths support both project-relative and absolute paths. On mobile and web,
write-accessible directories are separate from read-only resource paths — use
System.getUserDataPath() for player save data, and System.getAssetPath() for
read-only bundled assets.
User settings¶
UserSettings persists key/value pairs using each platform's native preferences
storage. It is suited for player preferences, audio/video settings, and small game
state. The API is typed — use the matching set…ForKey / get…ForKey pair for Bool,
Integer, Long, Float, Double, String, or Data:
Keep heavy save data (inventory, world state) in custom binary or JSON files. Reserve
UserSettings for small configuration.
Asset path best practices¶
| Guideline | Reason |
|---|---|
| Use lowercase file names | Avoids case-sensitivity issues on Linux and Android |
| No spaces in paths | Prevents build and script path parsing issues |
| Keep source and generated output separate | Generated export data should not be committed to version control |
| Use relative paths from the project root | Paths remain valid across different machines |
| Prefer GLTF for animated 3D assets | Carries mesh, materials, skeleton, animations, and morph targets |
| Compress textures for mobile and web | Keeps bundle sizes manageable |
Export and asset packaging¶
At export time, the editor copies and processes assets into the output directory. File formats may be converted, textures compressed, and shaders compiled for the target platform. The source project folder is not modified.
See Export Window for details on the export pipeline.