Class MaterialCache

Class Documentation

class legion::rendering::MaterialCache

Data cache for creating, storing and managing materials.

Public Static Functions

static material_handle create_material(const std::string &name, const shader_handle &shader)

Create a new material with a certain name and shader. If a material already exists with that name it’ll return a handle to the already existing material.

Return

material_handle Handle to the newly created material or the already existing material. Handle may be invalid if the function failed.

static material_handle create_material(const std::string &name, const filesystem::view &shaderFile, shader_import_settings settings = default_shader_settings)

Create a new material with a certain name and shader. If a new material is created it will also load the shader if it wasn’t loaded before using the shader cache. If a material already exists with that name it’ll return a handle to the already existing material.

Return

material_handle Handle to the newly created material or the already existing material. Handle may be invalid if the function failed. ShaderCache

static material_handle get_material(const std::string &name)

Get a handle to a material with a certain name.

Return

material_handle Handle to a material attached to the given name, may be invalid if there is no material attached to that name yet.

static std::pair<async::rw_spinlock&, std::unordered_map<id_type, material>&> get_all_materials()