Asset Loaders
Specific documentation for MeshLoader, MaterialLoader, and TextureLoader.
Introduction
Nevo Engine uses specialized loader classes to handle the complexities of different file formats and to coordinate between the file system, the ResourceManager, and the GPU.
MeshLoader
The MeshLoader is responsible for loading 3D geometry from disk.
- Supported Formats: OBJ (
.obj) and GLTF/GLB (.glb,.gltf). - Process:
- Loads the file using
FileLoaderOBJorFileLoaderGLTF. - Populates an
IntermediateMesh(a platform-independent data structure). - Registers the mesh with the
ResourceManager, which involves creating GPU buffers (VAO, VBO, EBO) via theGraphicsFactory.
- Loads the file using
MaterialLoader
The MaterialLoader parses material definitions, which are typically stored as JSON files.
- Format: JSON files in the
materials/directory. - Responsibilities:
- Parses material properties (e.g.,
color,castShadows). - Identifies required shaders and, optionally, textures.
- Uses
ShaderLoaderandTextureLoaderto load any missing dependencies. - Registers the completed
Materialwith theResourceManager.
- Parses material properties (e.g.,
Material textures are optional. If no texture is specified, the shader uses the material color directly. If a texture is present, it is multiplied by the material color.
TextureLoader
The TextureLoader handles loading image files and uploading them to the GPU.
- Supported Formats: PNG (via
lodepng). - Process:
- Reads image data using
AssetLoader. - Decodes the image data.
- Creates a
GraphicsTextureon the GPU. - Registers the
Texturemetadata and GPU resource with theResourceManager.
- Reads image data using
SceneLoader
The SceneLoader (often used by the ComponentFactory) loads entire entity hierarchies and their components from JSON scene files. It coordinates the creation of entities and the addition of components by calling other specialized loaders as needed.
