cgv
Loading...
Searching...
No Matches
adaptive_skinned_mesh.h
1#pragma once
2
3#include <cgv/media/mesh/dynamic_mesh.h>
4
5#include "../lib_begin.h"
6
7namespace cgv {
8 namespace media {
9 namespace mesh {
10
15template <typename T = float>
16class CGV_API adaptive_skinned_mesh : public dynamic_mesh<T>
17{
18public:
19 using typename simple_mesh_base::idx_type;
20 using typename simple_mesh_base::idx2_type;
21 using typename simple_mesh_base::idx3_type;
22 using typename simple_mesh_base::idx4_type;
23 using typename simple_mesh_base::mat_type;
24 using typename simple_mesh<T>::vec2_type;
25 using typename simple_mesh<T>::vec3_type;
26 using typename simple_mesh<T>::mesh_type;
27 using typename simple_mesh<T>::mat3_type;
30 unsigned nr_shapes = 0;
32 std::vector<std::vector<T>> joint_regressors;
34 std::vector<std::vector<vec3_type>> alternative_joint_regressors;
36 std::vector<vec3_type> joint_locations;
37protected:
39 std::vector<vec3_type> shaped_positions;
41 void compute_rotation_matrices(const std::vector<vec3_type>& pose, std::vector<mat3_type>& rotation_matrices);
43 std::vector<T> compute_pose_correction_vector(const std::vector<mat3_type>& rotation_matrices) const;
45 void compute_alternative_joint_regressors();
47 void compute_joint_locations(const std::vector<vec3_type>& P);
48public:
50 size_t get_nr_shapes() const { return nr_shapes; }
52 size_t get_nr_pose_corrections() const { return this->get_nr_blend_shapes() - get_nr_shapes(); }
54 void shape_mesh(const std::vector<T>& shape, bool use_parallel_implementation = false);
56 void pose_mesh(const vec3_type& translation, const std::vector<vec3_type>& pose, bool apply_pose_correction = true, bool apply_lbs = true, bool use_parallel_implementation = false);
57};
58 }
59 }
60}
61
62#include <cgv/config/lib_end.h>
complete implementation of method actions that only call one method when entering a node
Definition action.h:113
matrix of fixed size dimensions
Definition fmat.h:23
A vector with zero based index.
Definition fvec.h:27
simple class to hold the material properties of a phong material
Extension of dynamic_mesh that supports regression of joint locations from shaped mesh as well as pos...
std::vector< vec3_type > shaped_positions
storage for positions after applying the shape blend shapes
std::vector< std::vector< T > > joint_regressors
per joint for each mesh position a weight used to regress the joint locations
size_t get_nr_pose_corrections() const
return number of pose correction blend shapes
std::vector< std::vector< vec3_type > > alternative_joint_regressors
alternative representation of joint regressors with one vector per joint and base mesh/shape
size_t get_nr_shapes() const
return the number of blend shapes used to for shape adaptation
std::vector< vec3_type > joint_locations
regressed joint locations
The dynamic_mesh provides interpolation between several blend shapes of a mesh.
lbs_source_mode
Which source to use for the Linear Blend Skinning.
the cgv namespace
Definition print.h:11