Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::submesh_pose_mat4 Struct Reference

#include <model.h>

Classes

struct  transform_index
 Maps submesh index to a list of transform indices. Key: submesh_index, Value: list of indices into the transforms array. More...
 

Public Member Functions

void clear ()
 Clears all data.
 
void reserve (size_t count)
 Reserves space for submeshes.
 
template<typename SubmeshIndices >
auto add_transform (const SubmeshIndices &submesh_indices, const math::mat4 &transform, bool active) -> uint32_t
 Adds a transform and maps multiple submesh indices to it. All submesh indices in the vector will reference the same transform.
 
auto add_transform (const math::mat4 &transform) -> uint32_t
 Adds a transform to the shared pool without mapping any submesh to it.
 
void map_submesh (uint32_t submesh_index, uint32_t trans_index, bool active, bool casts_shadow)
 Maps a single submesh index to a pooled transform with per-instance flags.
 
auto get_transform_count (uint32_t submesh_index) const -> size_t
 Gets the number of transform instances for a specific submesh.
 
auto get_transform (uint32_t submesh_index, size_t instance_index) const -> const math::mat4 *
 Gets a specific transform for a submesh by its instance index.
 
auto has_transforms (uint32_t submesh_index) const -> bool
 Checks if a submesh has any transforms.
 
auto get_transform_active (uint32_t submesh_index, size_t instance_index) const -> bool
 Checks if a transform is active.
 
auto get_transform_casts_shadow (uint32_t submesh_index, size_t instance_index) const -> bool
 Checks if an instance casts shadows.
 

Public Attributes

std::vector< math::mat4 > transforms
 Shared pool of unique transforms. Multiple submeshes can reference the same transform by index.
 
hpp::small_vector< hpp::small_vector< transform_index > > submesh_to_transform_indices
 

Detailed Description

Definition at line 56 of file model.h.

Member Function Documentation

◆ add_transform() [1/2]

auto unravel::submesh_pose_mat4::add_transform ( const math::mat4 & transform) -> uint32_t
inline

Adds a transform to the shared pool without mapping any submesh to it.

Parameters
transformThe transform to add.
Returns
The index of the transform in the transforms array.

Definition at line 121 of file model.h.

◆ add_transform() [2/2]

template<typename SubmeshIndices >
auto unravel::submesh_pose_mat4::add_transform ( const SubmeshIndices & submesh_indices,
const math::mat4 & transform,
bool active ) -> uint32_t
inline

Adds a transform and maps multiple submesh indices to it. All submesh indices in the vector will reference the same transform.

Parameters
submesh_indicesSubmesh indices that should use this transform.
transformThe transform to add.
Returns
The index of the transform in the transforms array.

Definition at line 102 of file model.h.

◆ clear()

void unravel::submesh_pose_mat4::clear ( )
inline

Clears all data.

Definition at line 79 of file model.h.

◆ get_transform()

auto unravel::submesh_pose_mat4::get_transform ( uint32_t submesh_index,
size_t instance_index ) const -> const math::mat4*
inline

Gets a specific transform for a submesh by its instance index.

Parameters
submesh_indexThe index of the submesh.
instance_indexThe instance index (0 to get_transform_count()-1).
Returns
Pointer to the transform, or nullptr if invalid.

Definition at line 164 of file model.h.

◆ get_transform_active()

auto unravel::submesh_pose_mat4::get_transform_active ( uint32_t submesh_index,
size_t instance_index ) const -> bool
inline

Checks if a transform is active.

Parameters
submesh_indexThe index of the submesh.
instance_indexThe instance index (0 to get_transform_count()-1).
Returns
True if the transform is active, false otherwise.

Definition at line 198 of file model.h.

◆ get_transform_casts_shadow()

auto unravel::submesh_pose_mat4::get_transform_casts_shadow ( uint32_t submesh_index,
size_t instance_index ) const -> bool
inline

Checks if an instance casts shadows.

Parameters
submesh_indexThe index of the submesh.
instance_indexThe instance index (0 to get_transform_count()-1).
Returns
True if the instance casts shadows, false otherwise.

Definition at line 217 of file model.h.

◆ get_transform_count()

auto unravel::submesh_pose_mat4::get_transform_count ( uint32_t submesh_index) const -> size_t
inline

Gets the number of transform instances for a specific submesh.

Parameters
submesh_indexThe index of the submesh.
Returns
The number of transforms for this submesh.

Definition at line 149 of file model.h.

◆ has_transforms()

auto unravel::submesh_pose_mat4::has_transforms ( uint32_t submesh_index) const -> bool
inline

Checks if a submesh has any transforms.

Parameters
submesh_indexThe index of the submesh.
Returns
True if the submesh has transforms, false otherwise.

Definition at line 186 of file model.h.

◆ map_submesh()

void unravel::submesh_pose_mat4::map_submesh ( uint32_t submesh_index,
uint32_t trans_index,
bool active,
bool casts_shadow )
inline

Maps a single submesh index to a pooled transform with per-instance flags.

Parameters
submesh_indexThe submesh index to map.
trans_indexIndex of the transform in the pool (see add_transform).
activeWhether this instance is rendered at all.
casts_shadowWhether this instance is rendered into shadow passes.

Definition at line 135 of file model.h.

◆ reserve()

void unravel::submesh_pose_mat4::reserve ( size_t count)
inline

Reserves space for submeshes.

Parameters
countNumber of submeshes to reserve space for.

Definition at line 89 of file model.h.

Member Data Documentation

◆ submesh_to_transform_indices

hpp::small_vector<hpp::small_vector<transform_index> > unravel::submesh_pose_mat4::submesh_to_transform_indices

Definition at line 74 of file model.h.

◆ transforms

std::vector<math::mat4> unravel::submesh_pose_mat4::transforms

Shared pool of unique transforms. Multiple submeshes can reference the same transform by index.

Definition at line 62 of file model.h.


The documentation for this struct was generated from the following file: