Skip to main content

Module asset

Module asset 

Source
Expand description

Asset loading, caching, and GPU upload.

Each asset type provides a from_disk(path) constructor that in debug builds loads the source file and overwrites the binary cache, and in release builds loads the cache for faster startup.

§Types

TypeFile extensionCache extension
TextureFile.png, .jpg, ….otxtr
Mesh3DFile.obj, .stl.omesh
ShaderFile.glsl.oshdr

Also provides the attr sub-module for vertex and instance attribute descriptors used by meshes and instance buffers.

Modules§

attr
Vertex and instance attribute types.

Structs§

Mesh2DFile
CPU-side 2D mesh geometry — positions, UVs, colours, indices, layer, and centre.
Mesh3DFile
CPU-side 3D mesh geometry — positions, normals, UVs, colours, and indices.
ShaderFile
A shader loaded from disk (or cache), ready to compile.
TextureFile
A texture loaded from disk (or cache) with metadata.

Enums§

Center
Controls how 2D mesh positions are offset relative to their centre.
ShaderType
Whether a shader source is a vertex+fragment pipeline or a compute shader.