Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::model Class Reference

Structure describing a LOD group (set of meshes), LOD transitions, and their materials. More...

#include <model.h>

Inheritance diagram for unravel::model:
crtp_meta_type< model >

Classes

struct  submit_callbacks
 Callbacks for submitting the model for rendering. More...
 

Public Member Functions

auto is_valid () const -> bool
 Checks if the model is valid.
 
auto get_lod (uint32_t lod) const -> asset_handle< mesh >
 Gets the LOD (Level of Detail) mesh for the specified level.
 
void set_lod (asset_handle< mesh > mesh, uint32_t lod)
 Sets the LOD (Level of Detail) mesh for the specified level.
 
void set_material (asset_handle< material > material, uint32_t index)
 Sets the material for the specified index.
 
void set_material_instance (material::sptr material, uint32_t index)
 
auto get_lods () const -> const std::vector< asset_handle< mesh > > &
 Gets all the LOD meshes.
 
void set_lods (const std::vector< asset_handle< mesh > > &lods)
 Sets the LOD meshes.
 
auto get_materials () const -> const std::vector< asset_handle< material > > &
 Gets all the materials.
 
auto get_material_instances () const -> const std::vector< material::sptr > &
 
void set_materials (const std::vector< asset_handle< material > > &materials)
 Sets the materials.
 
void set_material_instances (const std::vector< material::sptr > &materials)
 
auto get_material (uint32_t index) const -> asset_handle< material >
 Gets the material for the specified index.
 
auto get_material_instance (uint32_t index) const -> material::sptr
 
auto get_or_emplace_material_instance (uint32_t index) -> material::sptr
 
auto get_lod_limits () const -> const std::vector< urange32_t > &
 Gets the LOD limits.
 
void set_lod_limits (const std::vector< urange32_t > &limits)
 Sets the LOD limits.
 
void submit (const math::mat4 &world_transform, const pose_mat4 &submesh_transforms, const pose_mat4 &bone_transforms, const std::vector< pose_mat4 > &skinning_matrices, unsigned int lod, const submit_callbacks &callbacks) const
 Submits the model for rendering.
 
- Public Member Functions inherited from crtp_meta_type< model >
virtual auto get_meta_type () const -> entt::meta_type
 
auto is () const -> bool
 
auto is (const entt::meta_type &type) const -> bool
 
virtual auto as_derived () -> entt::meta_any
 

Static Public Member Functions

static auto default_material () -> asset_handle< material > &
 Gets the default material.
 
static auto fallback_material () -> asset_handle< material > &
 Gets the fallback material.
 
- Static Public Member Functions inherited from crtp_meta_type< model >
static auto get_static_meta_type () -> entt::meta_type
 

Detailed Description

Structure describing a LOD group (set of meshes), LOD transitions, and their materials.

Definition at line 41 of file model.h.

Member Function Documentation

◆ default_material()

auto unravel::model::default_material ( ) -> asset_handle<material>&
static

Gets the default material.

Returns
A reference to the default material asset handle.

Definition at line 363 of file model.cpp.

◆ fallback_material()

auto unravel::model::fallback_material ( ) -> asset_handle<material>&
static

Gets the fallback material.

Returns
A reference to the fallback material asset handle.

Definition at line 369 of file model.cpp.

◆ get_lod()

auto unravel::model::get_lod ( uint32_t lod) const -> asset_handle<mesh>

Gets the LOD (Level of Detail) mesh for the specified level.

Parameters
lodThe level of detail.
Returns
The asset handle for the mesh at the specified LOD.

Definition at line 14 of file model.cpp.

◆ get_lod_limits()

auto unravel::model::get_lod_limits ( ) const -> const std::vector<urange32_t>&

Gets the LOD limits.

Returns
A constant reference to the vector of LOD limits.

Definition at line 183 of file model.cpp.

◆ get_lods()

auto unravel::model::get_lods ( ) const -> const std::vector<asset_handle<mesh>>&

Gets all the LOD meshes.

Returns
A constant reference to the vector of LOD meshes.

Definition at line 76 of file model.cpp.

◆ get_material()

auto unravel::model::get_material ( uint32_t index) const -> asset_handle<material>

Gets the material for the specified index.

Parameters
indexThe index.
Returns
The asset handle for the material of the specified index.

Definition at line 121 of file model.cpp.

◆ get_material_instance()

auto unravel::model::get_material_instance ( uint32_t index) const -> material::sptr

Definition at line 131 of file model.cpp.

◆ get_material_instances()

auto unravel::model::get_material_instances ( ) const -> const std::vector<material::sptr>&

Definition at line 105 of file model.cpp.

◆ get_materials()

auto unravel::model::get_materials ( ) const -> const std::vector<asset_handle<material>>&

Gets all the materials.

Returns
A constant reference to the vector of materials.

Definition at line 100 of file model.cpp.

◆ get_or_emplace_material_instance()

auto unravel::model::get_or_emplace_material_instance ( uint32_t index) -> material::sptr

Definition at line 151 of file model.cpp.

◆ is_valid()

bool unravel::model::is_valid ( ) const -> bool

Checks if the model is valid.

Returns
True if the model is valid, false otherwise.

Definition at line 9 of file model.cpp.

◆ set_lod()

void unravel::model::set_lod ( asset_handle< mesh > mesh,
uint32_t lod )

Sets the LOD (Level of Detail) mesh for the specified level.

Parameters
meshThe mesh to set.
lodThe level of detail.

Definition at line 44 of file model.cpp.

◆ set_lod_limits()

void unravel::model::set_lod_limits ( const std::vector< urange32_t > & limits)

Sets the LOD limits.

Parameters
limitsThe vector of LOD limits to set.

Definition at line 188 of file model.cpp.

◆ set_lods()

void unravel::model::set_lods ( const std::vector< asset_handle< mesh > > & lods)

Sets the LOD meshes.

Parameters
lodsThe vector of LOD meshes to set.

Definition at line 81 of file model.cpp.

◆ set_material()

void unravel::model::set_material ( asset_handle< material > material,
uint32_t index )

Sets the material for the specified index.

Parameters
materialThe material to set.
indexThe index to set the material at.

Definition at line 56 of file model.cpp.

◆ set_material_instance()

void unravel::model::set_material_instance ( material::sptr material,
uint32_t index )

Definition at line 66 of file model.cpp.

◆ set_material_instances()

void unravel::model::set_material_instances ( const std::vector< material::sptr > & materials)

Definition at line 116 of file model.cpp.

◆ set_materials()

void unravel::model::set_materials ( const std::vector< asset_handle< material > > & materials)

Sets the materials.

Parameters
materialsThe vector of materials to set.

Definition at line 111 of file model.cpp.

◆ submit()

void unravel::model::submit ( const math::mat4 & world_transform,
const pose_mat4 & submesh_transforms,
const pose_mat4 & bone_transforms,
const std::vector< pose_mat4 > & skinning_matrices,
unsigned int lod,
const submit_callbacks & callbacks ) const

Submits the model for rendering.

Parameters
world_transformThe world transform of the model.
bone_transformsThe bone transforms for skinned models.
lodThe level of detail to render.
callbacksThe submit callbacks.

Definition at line 193 of file model.cpp.


The documentation for this class was generated from the following files: