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

Outlines a collection of bones that influence a given set of faces/vertices in the mesh. More...

#include <mesh.h>

Public Types

using bone_index_map_t = std::map<uint32_t, uint32_t>
 

Public Member Functions

 bone_palette (uint32_t paletteSize)
 Constructs a bone palette with the given size.
 
auto get_skinning_matrices (const std::vector< math::transform > &node_transforms, const skin_bind_data &bind_data) const -> const std::vector< math::mat4 > &
 Gathers the bone/palette information and matrices ready for drawing the skinned mesh.
 
auto get_skinning_matrices (const std::vector< math::mat4 > &node_transforms, const skin_bind_data &bind_data) const -> const std::vector< math::mat4 > &
 
void compute_palette_fit (bone_index_map_t &input, int32_t &current_space, int32_t &common_base, int32_t &additional_bones)
 Determines the relevant "fit" information that can be used to discover if and how the specified combination of bones will fit into this palette.
 
void assign_bones (bone_index_map_t &bones, std::vector< uint32_t > &faces)
 Assigns the specified bones (and faces) to this bone palette.
 
void assign_bones (std::vector< bool > &bones, std::vector< uint32_t > &faces)
 
void assign_bones (const std::vector< uint32_t > &bones)
 Assigns the specified bones to this bone palette.
 
auto translate_bone_to_palette (uint32_t bone_index) const -> uint32_t
 Translates the specified bone index into its associated position in the palette.
 
auto get_maximum_blend_index () const -> int32_t
 Retrieves the maximum vertex blend index for this palette.
 
auto get_maximum_size () const -> uint32_t
 Retrieves the maximum size of the palette.
 
auto get_data_group () const -> uint32_t
 Retrieves the identifier of the data group assigned to the submesh of the mesh reserved for this bone palette.
 
auto get_influenced_faces () -> std::vector< uint32_t > &
 Retrieves the list of faces assigned to this palette.
 
auto get_bones () const -> const std::vector< uint32_t > &
 Retrieves the indices of the bones referenced by this palette.
 
void set_maximum_blend_index (int index)
 Sets the maximum vertex blend index for this palette.
 
void set_data_group (uint32_t group)
 Sets the identifier of the data group assigned to the submesh of the mesh reserved for this bone palette.
 
void clear_influenced_faces ()
 Clears out the temporary face influences array.
 

Protected Attributes

bone_index_map_t bones_lut_
 < Sorted list of bones in this palette.
 
std::vector< uint32_t > bones_
 List of faces assigned to this palette.
 
std::vector< uint32_t > faces_
 The data group identifier used to separate the mesh data into submeshes relevant tothis bone palette.
 
uint32_t data_group_id_
 The maximum size of the palette.
 
uint32_t maximum_size_
 The maximum vertex blend index for this palette.
 
int32_t maximum_blend_index_
 

Detailed Description

Outlines a collection of bones that influence a given set of faces/vertices in the mesh.

Definition at line 172 of file mesh.h.

Member Typedef Documentation

◆ bone_index_map_t

using unravel::bone_palette::bone_index_map_t = std::map<uint32_t, uint32_t>

Definition at line 175 of file mesh.h.

Constructor & Destructor Documentation

◆ bone_palette()

unravel::bone_palette::bone_palette ( uint32_t paletteSize)

Constructs a bone palette with the given size.

Class constructor.

Parameters
paletteSizeThe maximum size of the palette.

Definition at line 2516 of file mesh.cpp.

Member Function Documentation

◆ assign_bones() [1/3]

void unravel::bone_palette::assign_bones ( bone_index_map_t & bones,
std::vector< uint32_t > & faces )

Assigns the specified bones (and faces) to this bone palette.

Parameters
bonesThe bones to assign.
facesThe faces influenced by these bones.

Definition at line 2572 of file mesh.cpp.

◆ assign_bones() [2/3]

void unravel::bone_palette::assign_bones ( const std::vector< uint32_t > & bones)

Assigns the specified bones to this bone palette.

Parameters
bonesThe bones to assign.

Definition at line 2628 of file mesh.cpp.

◆ assign_bones() [3/3]

void unravel::bone_palette::assign_bones ( std::vector< bool > & bones,
std::vector< uint32_t > & faces )

Definition at line 2597 of file mesh.cpp.

◆ clear_influenced_faces()

void unravel::bone_palette::clear_influenced_faces ( )

Clears out the temporary face influences array.

Definition at line 2726 of file mesh.cpp.

◆ compute_palette_fit()

void unravel::bone_palette::compute_palette_fit ( bone_index_map_t & input,
int32_t & current_space,
int32_t & common_base,
int32_t & additional_bones )

Determines the relevant "fit" information that can be used to discover if and how the specified combination of bones will fit into this palette.

Parameters
inputThe input bone index map.
current_spaceThe current space available in the palette.
common_baseThe common base index.
additional_bonesThe number of additional bones required.

Definition at line 2651 of file mesh.cpp.

◆ get_bones()

auto unravel::bone_palette::get_bones ( ) const -> const std::vector<uint32_t>&

Retrieves the indices of the bones referenced by this palette.

Returns
const std::vector<uint32_t>& The list of bone indices.

Definition at line 2731 of file mesh.cpp.

◆ get_data_group()

auto unravel::bone_palette::get_data_group ( ) const -> uint32_t

Retrieves the identifier of the data group assigned to the submesh of the mesh reserved for this bone palette.

Returns
uint32_t The data group identifier.

Definition at line 2696 of file mesh.cpp.

◆ get_influenced_faces()

auto unravel::bone_palette::get_influenced_faces ( ) -> std::vector<uint32_t>&

Retrieves the list of faces assigned to this palette.

Returns
std::vector<uint32_t>& The list of faces.

Definition at line 2721 of file mesh.cpp.

◆ get_maximum_blend_index()

auto unravel::bone_palette::get_maximum_blend_index ( ) const -> int32_t

Retrieves the maximum vertex blend index for this palette.

Returns
int32_t The maximum vertex blend index.

Definition at line 2706 of file mesh.cpp.

◆ get_maximum_size()

auto unravel::bone_palette::get_maximum_size ( ) const -> uint32_t

Retrieves the maximum size of the palette.

Returns
uint32_t The maximum size of the palette.

Definition at line 2716 of file mesh.cpp.

◆ get_skinning_matrices() [1/2]

auto unravel::bone_palette::get_skinning_matrices ( const std::vector< math::mat4 > & node_transforms,
const skin_bind_data & bind_data ) const -> const std::vector<math::mat4>&

Definition at line 2547 of file mesh.cpp.

◆ get_skinning_matrices() [2/2]

auto unravel::bone_palette::get_skinning_matrices ( const std::vector< math::transform > & node_transforms,
const skin_bind_data & bind_data ) const -> const std::vector<math::mat4>&

Gathers the bone/palette information and matrices ready for drawing the skinned mesh.

Parameters
node_transformsThe node transforms.
bind_dataThe skin bind data.
compute_inverse_transposeWhether to compute the inverse transpose of the matrices.
Returns
std::vector<math::transform> The skinning matrices.

Definition at line 2523 of file mesh.cpp.

◆ set_data_group()

void unravel::bone_palette::set_data_group ( uint32_t group)

Sets the identifier of the data group assigned to the submesh of the mesh reserved for this bone palette.

Parameters
groupThe data group identifier.

Definition at line 2701 of file mesh.cpp.

◆ set_maximum_blend_index()

void unravel::bone_palette::set_maximum_blend_index ( int index)

Sets the maximum vertex blend index for this palette.

Parameters
indexThe maximum vertex blend index.

Definition at line 2711 of file mesh.cpp.

◆ translate_bone_to_palette()

auto unravel::bone_palette::translate_bone_to_palette ( uint32_t bone_index) const -> uint32_t

Translates the specified bone index into its associated position in the palette.

Parameters
bone_indexThe bone index.
Returns
uint32_t The position in the palette, or -1 if not found.

Definition at line 2688 of file mesh.cpp.

Member Data Documentation

◆ bones_

std::vector<uint32_t> unravel::bone_palette::bones_
protected

List of faces assigned to this palette.

Definition at line 295 of file mesh.h.

◆ bones_lut_

bone_index_map_t unravel::bone_palette::bones_lut_
protected

< Sorted list of bones in this palette.

Main palette of indices that reference the bones outlined in the main skin binding data.

Definition at line 293 of file mesh.h.

◆ data_group_id_

uint32_t unravel::bone_palette::data_group_id_
protected

The maximum size of the palette.

Definition at line 299 of file mesh.h.

◆ faces_

std::vector<uint32_t> unravel::bone_palette::faces_
protected

The data group identifier used to separate the mesh data into submeshes relevant tothis bone palette.

Definition at line 297 of file mesh.h.

◆ maximum_blend_index_

int32_t unravel::bone_palette::maximum_blend_index_
protected

Definition at line 303 of file mesh.h.

◆ maximum_size_

uint32_t unravel::bone_palette::maximum_size_
protected

The maximum vertex blend index for this palette.

Definition at line 301 of file mesh.h.


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