cgv
Loading...
Searching...
No Matches
cgv::media::mesh::dynamic_mesh< T > Class Template Reference

The dynamic_mesh provides interpolation between several blend shapes of a mesh. More...

#include <dynamic_mesh.h>

Inheritance diagram for cgv::media::mesh::dynamic_mesh< T >:
cgv::media::mesh::simple_mesh< float > cgv::media::mesh::simple_mesh_base cgv::media::colored_model

Classes

struct  blend_shape
 Captures where and how the blandshape data is stored. More...

Public Types

enum class  blend_shape_mode { direct , indexed , range_indexed }
 specifies how the blend shapes are stored More...
enum class  vertex_weight_mode { dense , sparse , fixed }
 specifies how vertex weights are stored More...
typedef cgv::math::fvec< T, 4 > vec4_type
 type of 4d vector
typedef cgv::math::fmat< T, 4, 4 > mat4_type
 linear transformation
typedef cgv::type::uint32_type idx_type
 define index type
typedef cgv::math::fvec< idx_type, 2 > idx2_type
 define index pair type
typedef cgv::math::fvec< idx_type, 3 > idx3_type
 define index triple type
typedef cgv::math::fvec< idx_type, 4 > idx4_type
 define index quadruple type
typedef illum::textured_surface_material mat_type
 define material type
Public Types inherited from cgv::media::mesh::simple_mesh< float >
using numeric_type
typedef simple_mesh< float > mesh_type
 type of axis aligned 3d box
typedef cgv::media::axis_aligned_box< float, 3 > box_type
 type of axis aligned 3d box
typedef cgv::math::fvec< float, 2 > vec2_type
 type of 2d vector
typedef cgv::math::fvec< float, 3 > vec3_type
 type of 3d vector
typedef cgv::math::fmat< float, 3, 3 > mat3_type
 linear transformation
Public Types inherited from cgv::media::mesh::simple_mesh_base
enum class  attribute_type {
  begin =0 , position =0 , texcoords =1 , normal =2 ,
  tangent =3 , color =4 , end =5
}
 different mesh attributes More...
enum  AttributeFlags {
  AF_position = 1 , AF_texcoords = 2 , AF_normal = 4 , AF_tangent = 8 ,
  AF_color = 16
}
typedef cgv::type::uint32_type idx_type
 define index type
typedef cgv::math::fvec< idx_type, 2 > idx2_type
 define index pair type
typedef cgv::math::fvec< idx_type, 3 > idx3_type
 define index triple type
typedef cgv::math::fvec< idx_type, 4 > idx4_type
 define index quadruple type
typedef illum::textured_surface_material mat_type
 define material type

Public Member Functions

additional positional attributes
void store_in_reference_positions ()
 store current positions in reference positions
void store_in_intermediate_positions ()
 store current positions in intermediate positions
const std::vector< vec3_type > & get_intermediate_positions () const
 return const reference to intermediate position vector
void recover_intermediate_positions ()
 copy intermediate positions to positions
blend shapes
uint32_t add_blend_shape (blend_shape_mode mode, idx_type nr_data, idx_type nr_indices=0)
 Add a new blend shape.
void add_blend_shape_data (const vec3_type &d)
 Add another data point to the data buffer.
void add_blend_shape_index (idx_type i)
 Add another index to the index buffer.
bool has_blend_shape_vector (idx_type bi, idx_type vi) const
 Query if a blend shape has a vertex with a given ID.
vec3_type get_blend_shape_vector (idx_type bi, idx_type vi) const
 Returns one vertex of one blend shape.
size_t get_nr_blend_shapes () const
 Return how many blend shapes this mesh has.
void apply_blend_shapes (const std::vector< T > &weights, idx_type blend_shape_offset=0, bool only_add=false, bool use_parallel_implementation=false)
 this function applies weights.size() number of blend shapes starting at offset blend_shape_offset and stores result in mesh position attribute
Public Member Functions inherited from cgv::media::mesh::simple_mesh< float >
 simple_mesh (const simple_mesh< float > &sm)
 copy constructor
 simple_mesh (simple_mesh< float > &&sm)
 move constructor
 simple_mesh (const std::string &conway_notation="")
 assignment operator
simple_mesh< float > & operator= (const simple_mesh< float > &sm)
 assignment operator
simple_mesh< float > & operator= (simple_mesh< float > &&sm)
 move assignment operator
uint32_t get_coord_size () const
 return the size of one coordinate in bytes
void clear ()
 clear simple mesh
idx_type new_position (const vec3_type &p)
 add a new position and return position index
idx_type get_nr_positions () const
 access to positions
vec3_type & position (idx_type pi)
const vec3_type & position (idx_type pi) const
const std::vector< vec3_type > & get_positions () const
std::vector< vec3_type > & ref_positions ()
idx_type new_normal (const vec3_type &n)
 add a new normal and return normal index
bool has_normals () const
 access to normals
idx_type get_nr_normals () const
vec3_type & normal (idx_type ni)
const vec3_type & normal (idx_type ni) const
const std::vector< vec3_type > & get_normals () const
idx_type new_tangent (const vec3_type &tc)
 add a new tangent and return tangent index
bool has_tangents () const
 access to tangents
idx_type get_nr_tangents () const
vec3_type & tangent (idx_type ti)
const vec3_type & tangent (idx_type ti) const
idx_type new_tex_coord (const vec2_type &tc)
 add a new texture coordinate and return texture coordinate index
bool has_tex_coords () const
 access to texture coordinates
idx_type get_nr_tex_coords () const
vec2_type & tex_coord (idx_type ti)
const vec2_type & tex_coord (idx_type ti) const
bool compute_face_normal (idx_type fi, vec3_type &nml, bool normalize=true) const
 compute the normal nml of a face and return whether this was possible
vec3_type compute_face_center (idx_type fi) const
 compute face center
void compute_face_normals (bool construct_normal_indices=true)
 compute per face normals (ensure that per corner normal indices are set correspondingly)
void compute_face_tangents (bool construct_tangent_indices=true)
 compute per face tangents (ensure that per corner tangent indices are set correspondingly)
void ambo ()
 Conway ambo operator.
void truncate (float lambda=0.33333f)
 Conway truncate operator.
void snub (float lambda=0.33333f)
 Conway snub operator.
void dual ()
 Conway dual operator.
void gyro (float lambda=0.3333f)
 Conway gyro operator.
void join ()
 Conway join operator.
void ortho ()
 Conway ortho operator.
void construct_conway_polyhedron (const std::string &conway_notation)
 construct new mesh according to Conway polyhedron notation: [a|t|s|d|g|j|o]*[T|C|O|D|I] which is evaluated from right to left and last capital letter is Platonic solid and lowercase letters are Conway operations
box_type compute_box () const
 compute the axis aligned bounding box
void compute_vertex_normals (bool use_parallel_implementation=true)
 compute vertex normals by averaging triangle normals
void construct (const obj_loader_generic< float > &loader, bool copy_grp_info, bool copy_material_info)
 construct from obj loader
bool read (const std::string &file_name)
 read simple mesh from file (currently only obj and stl are supported)
bool write (const std::string &file_name) const
 write simple mesh to file (currently only obj is supported)
unsigned extract_vertex_attribute_buffer (const std::vector< idx4_type > &unique_quadruples, bool include_tex_coords, bool include_normals, bool include_tangents, std::vector< float > &attrib_buffer, bool *include_colors_ptr=0, int *num_floats_in_vertex=nullptr) const
 Extract vertex attribute array and element array buffers for triangulation and edges in wireframe.
void transform (const mat3_type &linear_transformation, const vec3_type &translation)
 apply transformation to mesh
void transform (const mat3_type &linear_transform, const vec3_type &translation, const mat3_type &inverse_linear_transform)
 apply transformation to mesh with given inverse linear transformation
Public Member Functions inherited from cgv::media::mesh::simple_mesh_base
 simple_mesh_base ()
 default constructor
 simple_mesh_base (const simple_mesh_base &smb)
 copy constructor
 simple_mesh_base (simple_mesh_base &&smb)
 move constructor
simple_mesh_base & operator= (const simple_mesh_base &smb)
 assignment operator
simple_mesh_base & operator= (simple_mesh_base &&smb)
 move assignment operator
idx_type start_face ()
 Create a new empty face to which new corners are added.
idx_type new_corner (idx_type position_index, idx_type normal_index=-1, idx_type tex_coord_index=-1)
 Create a new corner with the given attributes.
idx_type c2p (idx_type ci) const
 return position index of corner
idx_type c2n (idx_type ci) const
 return normal index of corner
bool has_normal_indices () const
 return whether normal indices are stored
idx_type c2t (idx_type ci) const
 return texture index of corner
bool has_tex_coord_indices () const
 return whether texture coordinate indices are stored
idx_type get_nr_faces () const
 return the number of faces
idx_type get_nr_corners () const
 return the number of corners
idx_type begin_corner (idx_type fi) const
 Retrieve the vertex index of the first corner of a face.
idx_type end_corner (idx_type fi) const
 Retrieve index of the vertex which follows the end corner of a face.
idx_type face_degree (idx_type fi) const
 return number of edges/corners of face with index fi
size_t get_nr_materials () const
 return number of materials in mesh
idx_type new_material ()
 add a new material and return its index
const mat_type & get_material (size_t i) const
 return const reference to i-th material
mat_type & ref_material (size_t i)
 return reference to i-th material
const idx_type & material_index (idx_type fi) const
 return material index of given face
idx_type & material_index (idx_type fi)
 return reference to material index of given face
size_t get_nr_groups () const
 return number of face groups
const std::string & group_name (size_t i) const
 return the name of the i-th face group
std::string & group_name (size_t i)
 set a new group name
idx_type new_group (const std::string &name)
 add a new group and return its index
const idx_type & group_index (idx_type fi) const
 return group index of given face
idx_type & group_index (idx_type fi)
 return reference to group index of given face
void revert_face_orientation ()
 revert face orientation
void sort_faces (std::vector< idx_type > &perm, bool by_group=true, bool by_material=true) const
 Calculate a permutation of face indices which sorts them by group and/or material.
void merge_indices (std::vector< idx_type > &vertex_indices, std::vector< idx4_type > &unique_tuples, bool *include_tex_coords_ptr=0, bool *include_normals_ptr=0, bool *include_tangents_ptr=0) const
 Transforms n individual vertex attribute indices into one list of unique index n-tuples.
void extract_triangle_element_buffer (const std::vector< idx_type > &vertex_indices, std::vector< idx_type > &triangle_element_buffer, const std::vector< idx_type > *face_permutation_ptr=0, std::vector< idx3_type > *material_group_start_ptr=0) const
 Extract element array buffers for triangulation.
void extract_wireframe_element_buffer (const std::vector< idx_type > &vertex_indices, std::vector< idx_type > &edge_element_buffer) const
 Extract element array buffers for edges in wireframe.
idx_type extract_vertex_attribute_buffer_base (const std::vector< idx4_type > &unique_quadruples, AttributeFlags &flags, std::vector< uint8_t > &attrib_buffer) const
 extract vertex attribute buffer for the given flags and return size of vertex in bytes
void extract_triangle_indices (std::vector< idx3_type > &position_indices, std::vector< idx3_type > *tex_coord_indices=nullptr, std::vector< idx3_type > *normal_indices=nullptr, std::vector< idx3_type > *tangent_indices=nullptr) const
 Extract index lists of triangle positions and optional attributes.
idx_type compute_inv (std::vector< idx_type > &inv, bool link_non_manifold_edges=false, std::vector< idx_type > *p2c_ptr=0, std::vector< idx_type > *next_ptr=0, std::vector< idx_type > *prev_ptr=0, std::vector< idx_type > *unmatched=0, std::vector< idx_type > *non_manifold=0, std::vector< idx_type > *unmatched_elements=0, std::vector< idx_type > *non_manifold_elements=0) const
 Do inverse matching of half-edges.
idx_type compute_c2e (const std::vector< idx_type > &inv, std::vector< idx_type > &c2e, std::vector< idx_type > *e2c_ptr=0) const
 given the inv corners compute vector storing per corner the edge index and optionally per edge one corner index and return edge count (implementation assumes closed manifold connectivity)
void compute_c2f (std::vector< idx_type > &c2f) const
 compute index vector with per corner its face index
Public Member Functions inherited from cgv::media::colored_model
 colored_model ()
 construct colored model
 colored_model (const colored_model &cm)
 copy constructur
 colored_model (colored_model &&cm)
 move constructur
colored_model & operator= (const colored_model &cm)
 assignment operator
colored_model & operator= (colored_model &&cm)
 move assignment operator
virtual ~colored_model ()
 destruct colored model
bool has_colors () const
 check whether colors have been allocated
void set_color (size_t i, const void *col_ptr)
 set i-th color to color of type stored in storage
void set_color (size_t i, const rgb &col)
 set i-th color from color of type rgb
void set_color (size_t i, const rgb8 &col)
 set i-th color from color of type rgba
void set_color (size_t i, const rgba &col)
 set i-th color from color of type rgb8
void set_color (size_t i, const rgba8 &col)
 set i-th color from color of type rgba8
void put_color (size_t i, void *col_ptr) const
 set color of type stored in storage to i-th color
void put_color (size_t i, rgb &col) const
 set color of type rgb to i-th color
void put_color (size_t i, rgba &col) const
 set color of type rgba to i-th color
void put_color (size_t i, rgb8 &col) const
 set color of type rgb8 to i-th color
void put_color (size_t i, rgba8 &col) const
 set color of type rgba8 to i-th color
size_t get_nr_colors () const
 return number of allocated colors
void resize_colors (size_t nr_colors)
 resize the color storage to given number of colors
size_t get_color_size () const
 return the size of one allocated color in byte
ColorType get_color_storage_type () const
 return storage type of colors, if no colors are allocated CT_RGBA8 is returned
const void * get_color_data_ptr () const
const void * get_color_data_vector_ptr () const
void * ref_color_data_ptr ()
void * ref_color_data_vector_ptr ()
void ensure_colors (ColorType _color_type, size_t nr_colors=-1)
 ensure that colors are allocated and of given storage type
void destruct_colors ()
 destruct color storage

Protected Attributes

std::vector< vec3_type > reference_positions
 Storage for vertex positions in the bind-pose.
std::vector< vec3_type > intermediate_positions
 Storage for vertex positions after Linear Blend Skinning.
std::vector< vec3_type > blend_shape_data
 Storage for the blend shape vertices.
std::vector< uint32_t > blend_shape_indices
 Storage for the indices (if the blend shapes are defined by indices).
std::vector< blend_shape > blend_shapes
 Storage for all the blendshape definitions.
vertex_weight_mode weight_mode
 How the vertex weights are stored for this instance.
int32_t max_nr_weights_per_vertex = -1
 in case of fixed vertex_weight_mode the number of weights per vertex
std::vector< int32_t > joint_parents
 for each joint the index of the parent joint or -1 for root joints
std::vector< T > vertex_weight_data
 continuous storage of all vertex weights
std::vector< uint32_t > vertex_weight_indices
 continuous storage of vertex indices
std::vector< uint32_t > vertex_weight_index_begins
 for each vertex the first index in vertex_weight_data and vertex_weight_indices
Protected Attributes inherited from cgv::media::mesh::simple_mesh< float >
std::vector< vec3_type > positions
std::vector< vec3_type > normals
std::vector< vec3_type > tangents
std::vector< vec2_type > tex_coords
Protected Attributes inherited from cgv::media::mesh::simple_mesh_base
std::vector< idx_type > position_indices
std::vector< idx_type > tex_coord_indices
std::vector< idx_type > normal_indices
std::vector< idx_type > tangent_indices
std::vector< idx_type > faces
std::vector< idx_type > group_indices
std::vector< std::string > group_names
std::vector< idx_type > material_indices
std::vector< mat_type > materials
Protected Attributes inherited from cgv::media::colored_model
abst_color_storage * color_storage_ptr
 pointer to color storage

skinning

enum class  lbs_source_mode { reference , position , intermediate }
 Which source to use for the Linear Blend Skinning. More...
void set_vertex_weight_mode (vertex_weight_mode mode)
void begin_vertex_weight_vertex ()
idx_type vertex_weight_begin (idx_type vi) const
 return the begin index for vertex weights of given vertex
idx_type vertex_weight_end (idx_type vi) const
 return the end index for vertex weights of given vertex
T get_vertex_weight (idx_type vi, idx_type ji) const
 return the vertex weight of vertex vi and joint ji
void add_vertex_weight_data (T w)
void add_vertex_weight_index (idx_type i)
size_t get_nr_vertex_weights () const
size_t get_nr_vertex_weight_indices () const
idx_type get_nr_joints () const
std::vector< mat4_type > compute_joint_transformations (const std::vector< vec3_type > &reference_joint_locations, const vec3_type &translation, const std::vector< vec3_type > &target_spin_vectors) const
 compute joint transformations from reference joint locations, target translation and target spin vectors
std::vector< mat4_type > compute_joint_transformations (const std::vector< vec3_type > &reference_joint_locations, const vec3_type &translation, const std::vector< mat3_type > &target_rotations) const
 compute joint transformations from reference joint locations, target translation and target rotation matrices
const std::vector< int32_t > & get_joint_parents () const
 return const reference to joint parent vector
std::vector< int32_t > & ref_joint_parents ()
 return mutable reference to joint parent vector
void lbs (const std::vector< mat4_type > &joint_matrices, lbs_source_mode mode)
 perform linear blend skinning on reference positions or the current mesh position attribute

Additional Inherited Members

Static Public Member Functions inherited from cgv::media::mesh::simple_mesh_base
static std::string get_attribute_name (attribute_type attr)
static AttributeFlags get_attribute_flag (attribute_type attr)
Protected Member Functions inherited from cgv::media::mesh::simple_mesh< float >
bool has_attribute (attribute_type attr) const
const uint8_t * get_attribute_ptr (attribute_type attr, idx_type ai=0) const
size_t get_attribute_size (attribute_type attr) const
size_t get_attribute_offset (attribute_type attr) const
vec3_type compute_normal (const vec3_type &p0, const vec3_type &p1, const vec3_type &p2)

Detailed Description

template<typename T = float>
class cgv::media::mesh::dynamic_mesh< T >

The dynamic_mesh provides interpolation between several blend shapes of a mesh.

Template Parameters
TThe coordinate base-type

Definition at line 14 of file dynamic_mesh.h.

Member Typedef Documentation

◆ idx2_type

define index pair type

Definition at line 32 of file simple_mesh.h.

◆ idx3_type

define index triple type

Definition at line 34 of file simple_mesh.h.

◆ idx4_type

define index quadruple type

Definition at line 36 of file simple_mesh.h.

◆ idx_type

define index type

Definition at line 30 of file simple_mesh.h.

◆ mat4_type

template<typename T = float>
typedef cgv::math::fmat<T, 4, 4> cgv::media::mesh::dynamic_mesh< T >::mat4_type

linear transformation

Definition at line 29 of file dynamic_mesh.h.

◆ mat_type

define material type

Definition at line 38 of file simple_mesh.h.

◆ vec4_type

template<typename T = float>
typedef cgv::math::fvec<T, 4> cgv::media::mesh::dynamic_mesh< T >::vec4_type

type of 4d vector

Definition at line 25 of file dynamic_mesh.h.

Member Enumeration Documentation

◆ blend_shape_mode

template<typename T = float>
enum class cgv::media::mesh::dynamic_mesh::blend_shape_mode
strong

specifies how the blend shapes are stored

Enumerator
direct 

All blend shapes have a uniform dimension and stored successively.

indexed 

Blend shapes index into a shared data buffer.

range_indexed 

If the indices are numerically sorted then this mode allows to refer to respective ranges via a begin and end pair.

Definition at line 32 of file dynamic_mesh.h.

◆ lbs_source_mode

template<typename T = float>
enum class cgv::media::mesh::dynamic_mesh::lbs_source_mode
strong

Which source to use for the Linear Blend Skinning.

Enumerator
reference 

The reference positions.

position 

The current position attribute of the mesh.

intermediate 

The intermediate position attribute of the mesh.

Definition at line 172 of file dynamic_mesh.h.

◆ vertex_weight_mode

template<typename T = float>
enum class cgv::media::mesh::dynamic_mesh::vertex_weight_mode
strong

specifies how vertex weights are stored

Enumerator
dense 

number joints times number vertices weights are stored - no indices necessary

sparse 

per vertex varying number of indexed weights - vertex_weight_index_begins tells for each vertex the index of the first weight in vertex_weight_data, which is also the index of the first vertex index in vertex_weight_indices

fixed 

max_nr_weights_per_vertex are stored for each vertex with max_nr_weights_per_vertex times the number of vertices entries in vertex_weight_data and vertex_weight_indices.vertex_weight_index_begins is not used.If less than max_nr_weights_per_vertex are used the additional weights are set to 0.0 and the additional indices to 0.

Definition at line 65 of file dynamic_mesh.h.

Member Function Documentation

◆ add_blend_shape()

template<typename T>
uint32_t cgv::media::mesh::dynamic_mesh< T >::add_blend_shape ( blend_shape_mode mode,
idx_type nr_data,
idx_type nr_indices = 0 )

Add a new blend shape.

Parameters
[in]modeHow the blend shape data is stored and referenced
[in]nr_dataHow many data_points this blend shape will have
[in]nr_indicesHow many indices this blend shape will use
Returns
the index of the newly created blend shape

Definition at line 10 of file dynamic_mesh.cxx.

References blend_shape_data, blend_shape_indices, and blend_shapes.

◆ add_blend_shape_data()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::add_blend_shape_data ( const vec3_type & d)

Add another data point to the data buffer.

Definition at line 18 of file dynamic_mesh.cxx.

References blend_shape_data.

◆ add_blend_shape_index()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::add_blend_shape_index ( idx_type i)

Add another index to the index buffer.

Definition at line 23 of file dynamic_mesh.cxx.

References blend_shape_indices.

◆ add_vertex_weight_data()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::add_vertex_weight_data ( T w)

Definition at line 127 of file dynamic_mesh.cxx.

◆ add_vertex_weight_index()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::add_vertex_weight_index ( idx_type i)

Definition at line 132 of file dynamic_mesh.cxx.

◆ apply_blend_shapes()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::apply_blend_shapes ( const std::vector< T > & weights,
idx_type blend_shape_offset = 0,
bool only_add = false,
bool use_parallel_implementation = false )

this function applies weights.size() number of blend shapes starting at offset blend_shape_offset and stores result in mesh position attribute

If only_add is false, the position is initialized to the reference_position attribute - otherwise the blend shapes are just added to the current mesh position attribute.

Performs a weighted accumulation of blend shapes.

Parameters
[in]weightsthe respective weights for each blendshape
[in]blend_shape_offsetrelative to the first blend shape, where to begin applying the weighted accumulation
[in]only_addIf false then simple_mesh::positions will be initialized to the reference_position attribute. Otherwise the blend shapes are just added to the current mesh position attribute.

Definition at line 191 of file dynamic_mesh.cxx.

References blend_shape_data, blend_shape_indices, blend_shapes, direct, cgv::media::mesh::simple_mesh< float >::get_nr_positions(), indexed, range_indexed, and reference_positions.

◆ begin_vertex_weight_vertex()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::begin_vertex_weight_vertex ( )

Definition at line 81 of file dynamic_mesh.cxx.

◆ compute_joint_transformations() [1/2]

template<typename T>
std::vector< typename dynamic_mesh< T >::mat4_type > cgv::media::mesh::dynamic_mesh< T >::compute_joint_transformations ( const std::vector< vec3_type > & reference_joint_locations,
const vec3_type & translation,
const std::vector< mat3_type > & target_rotations ) const

compute joint transformations from reference joint locations, target translation and target rotation matrices

Definition at line 161 of file dynamic_mesh.cxx.

◆ compute_joint_transformations() [2/2]

template<typename T>
std::vector< typename dynamic_mesh< T >::mat4_type > cgv::media::mesh::dynamic_mesh< T >::compute_joint_transformations ( const std::vector< vec3_type > & reference_joint_locations,
const vec3_type & translation,
const std::vector< vec3_type > & target_spin_vectors ) const

compute joint transformations from reference joint locations, target translation and target spin vectors

Definition at line 152 of file dynamic_mesh.cxx.

References compute_joint_transformations().

Referenced by compute_joint_transformations().

◆ get_blend_shape_vector()

template<typename T>
dynamic_mesh< T >::vec3_type cgv::media::mesh::dynamic_mesh< T >::get_blend_shape_vector ( idx_type bi,
idx_type vi ) const

Returns one vertex of one blend shape.

Parameters
[in]biIndex of the desired blend shape
[in]viIndex of the desired vertex

Definition at line 50 of file dynamic_mesh.cxx.

References blend_shape_data, blend_shape_indices, blend_shapes, direct, cgv::media::mesh::simple_mesh< float >::get_nr_positions(), indexed, and range_indexed.

◆ get_intermediate_positions()

template<typename T>
const std::vector< typename dynamic_mesh< T >::vec3_type > & cgv::media::mesh::dynamic_mesh< T >::get_intermediate_positions ( ) const

return const reference to intermediate position vector

Definition at line 238 of file dynamic_mesh.cxx.

References intermediate_positions.

◆ get_joint_parents()

template<typename T>
const std::vector< int32_t > & cgv::media::mesh::dynamic_mesh< T >::get_joint_parents ( ) const

return const reference to joint parent vector

Definition at line 244 of file dynamic_mesh.cxx.

References joint_parents.

◆ get_nr_blend_shapes()

template<typename T>
size_t cgv::media::mesh::dynamic_mesh< T >::get_nr_blend_shapes ( ) const

Return how many blend shapes this mesh has.

Definition at line 71 of file dynamic_mesh.cxx.

References blend_shapes.

◆ get_nr_joints()

template<typename T>
dynamic_mesh< T >::idx_type cgv::media::mesh::dynamic_mesh< T >::get_nr_joints ( ) const

Definition at line 147 of file dynamic_mesh.cxx.

◆ get_nr_vertex_weight_indices()

template<typename T>
size_t cgv::media::mesh::dynamic_mesh< T >::get_nr_vertex_weight_indices ( ) const

Definition at line 142 of file dynamic_mesh.cxx.

◆ get_nr_vertex_weights()

template<typename T>
size_t cgv::media::mesh::dynamic_mesh< T >::get_nr_vertex_weights ( ) const

Definition at line 137 of file dynamic_mesh.cxx.

◆ get_vertex_weight()

template<typename T>
T cgv::media::mesh::dynamic_mesh< T >::get_vertex_weight ( idx_type vi,
idx_type ji ) const

return the vertex weight of vertex vi and joint ji

Definition at line 112 of file dynamic_mesh.cxx.

◆ has_blend_shape_vector()

template<typename T>
bool cgv::media::mesh::dynamic_mesh< T >::has_blend_shape_vector ( idx_type bi,
idx_type vi ) const

Query if a blend shape has a vertex with a given ID.

Parameters
[in]biIndex of the desired blend shape
[in]viIndex of the desired vertex

If the blend shape data is stored in blend_shape_mode::direct mode, this function will always return true as there is no indirection.

Definition at line 28 of file dynamic_mesh.cxx.

References blend_shape_indices, blend_shapes, direct, indexed, and range_indexed.

◆ lbs()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::lbs ( const std::vector< mat4_type > & joint_matrices,
lbs_source_mode mode )

perform linear blend skinning on reference positions or the current mesh position attribute

the joint matrices define per joint the transformation from reference positions or intermediate positions.

Definition at line 270 of file dynamic_mesh.cxx.

References dense, fixed, intermediate, intermediate_positions, joint_parents, position, reference_positions, sparse, vertex_weight_data, vertex_weight_index_begins, vertex_weight_indices, and weight_mode.

◆ recover_intermediate_positions()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::recover_intermediate_positions ( )

copy intermediate positions to positions

Definition at line 264 of file dynamic_mesh.cxx.

References intermediate_positions.

◆ ref_joint_parents()

template<typename T>
std::vector< int32_t > & cgv::media::mesh::dynamic_mesh< T >::ref_joint_parents ( )

return mutable reference to joint parent vector

Definition at line 249 of file dynamic_mesh.cxx.

References joint_parents.

◆ set_vertex_weight_mode()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::set_vertex_weight_mode ( vertex_weight_mode mode)

Definition at line 76 of file dynamic_mesh.cxx.

◆ store_in_intermediate_positions()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::store_in_intermediate_positions ( )

store current positions in intermediate positions

Definition at line 259 of file dynamic_mesh.cxx.

References intermediate_positions.

◆ store_in_reference_positions()

template<typename T>
void cgv::media::mesh::dynamic_mesh< T >::store_in_reference_positions ( )

store current positions in reference positions

Definition at line 254 of file dynamic_mesh.cxx.

References reference_positions.

◆ vertex_weight_begin()

template<typename T>
dynamic_mesh< T >::idx_type cgv::media::mesh::dynamic_mesh< T >::vertex_weight_begin ( idx_type vi) const

return the begin index for vertex weights of given vertex

Definition at line 86 of file dynamic_mesh.cxx.

References dense, fixed, max_nr_weights_per_vertex, sparse, vertex_weight_index_begins, and weight_mode.

◆ vertex_weight_end()

template<typename T>
dynamic_mesh< T >::idx_type cgv::media::mesh::dynamic_mesh< T >::vertex_weight_end ( idx_type vi) const

return the end index for vertex weights of given vertex

Definition at line 99 of file dynamic_mesh.cxx.

Member Data Documentation

◆ blend_shape_data

template<typename T = float>
std::vector<vec3_type> cgv::media::mesh::dynamic_mesh< T >::blend_shape_data
protected

Storage for the blend shape vertices.

Definition at line 47 of file dynamic_mesh.h.

Referenced by add_blend_shape(), add_blend_shape_data(), apply_blend_shapes(), and get_blend_shape_vector().

◆ blend_shape_indices

template<typename T = float>
std::vector<uint32_t> cgv::media::mesh::dynamic_mesh< T >::blend_shape_indices
protected

Storage for the indices (if the blend shapes are defined by indices).

Definition at line 49 of file dynamic_mesh.h.

Referenced by add_blend_shape(), add_blend_shape_index(), apply_blend_shapes(), get_blend_shape_vector(), and has_blend_shape_vector().

◆ blend_shapes

template<typename T = float>
std::vector<blend_shape> cgv::media::mesh::dynamic_mesh< T >::blend_shapes
protected

Storage for all the blendshape definitions.

Definition at line 61 of file dynamic_mesh.h.

Referenced by add_blend_shape(), apply_blend_shapes(), get_blend_shape_vector(), get_nr_blend_shapes(), and has_blend_shape_vector().

◆ intermediate_positions

template<typename T = float>
std::vector<vec3_type> cgv::media::mesh::dynamic_mesh< T >::intermediate_positions
protected

Storage for vertex positions after Linear Blend Skinning.

Definition at line 45 of file dynamic_mesh.h.

Referenced by get_intermediate_positions(), lbs(), recover_intermediate_positions(), and store_in_intermediate_positions().

◆ joint_parents

template<typename T = float>
std::vector<int32_t> cgv::media::mesh::dynamic_mesh< T >::joint_parents
protected

for each joint the index of the parent joint or -1 for root joints

Definition at line 86 of file dynamic_mesh.h.

Referenced by get_joint_parents(), lbs(), and ref_joint_parents().

◆ max_nr_weights_per_vertex

template<typename T = float>
int32_t cgv::media::mesh::dynamic_mesh< T >::max_nr_weights_per_vertex = -1
protected

in case of fixed vertex_weight_mode the number of weights per vertex

Definition at line 84 of file dynamic_mesh.h.

Referenced by vertex_weight_begin().

◆ reference_positions

template<typename T = float>
std::vector<vec3_type> cgv::media::mesh::dynamic_mesh< T >::reference_positions
protected

Storage for vertex positions in the bind-pose.

Definition at line 43 of file dynamic_mesh.h.

Referenced by apply_blend_shapes(), lbs(), and store_in_reference_positions().

◆ vertex_weight_data

template<typename T = float>
std::vector<T> cgv::media::mesh::dynamic_mesh< T >::vertex_weight_data
protected

continuous storage of all vertex weights

Definition at line 88 of file dynamic_mesh.h.

Referenced by lbs().

◆ vertex_weight_index_begins

template<typename T = float>
std::vector<uint32_t> cgv::media::mesh::dynamic_mesh< T >::vertex_weight_index_begins
protected

for each vertex the first index in vertex_weight_data and vertex_weight_indices

Definition at line 92 of file dynamic_mesh.h.

Referenced by lbs(), and vertex_weight_begin().

◆ vertex_weight_indices

template<typename T = float>
std::vector<uint32_t> cgv::media::mesh::dynamic_mesh< T >::vertex_weight_indices
protected

continuous storage of vertex indices

Definition at line 90 of file dynamic_mesh.h.

Referenced by lbs().

◆ weight_mode

template<typename T = float>
vertex_weight_mode cgv::media::mesh::dynamic_mesh< T >::weight_mode
protected

How the vertex weights are stored for this instance.

Definition at line 82 of file dynamic_mesh.h.

Referenced by lbs(), and vertex_weight_begin().


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