3 #include <Core/Animation/HandleWeight.hpp>
4 #include <Core/Animation/Pose.hpp>
5 #include <Core/Animation/SkinningData.hpp>
6 #include <Core/Asset/HandleData.hpp>
7 #include <Core/Geometry/TopologicalMesh.hpp>
8 #include <Core/Geometry/TriangleMesh.hpp>
9 #include <Core/Math/DualQuaternion.hpp>
10 #include <Core/Utils/Index.hpp>
12 #include <Engine/Data/Material.hpp>
13 #include <Engine/Scene/Component.hpp>
14 #include <Engine/Scene/ComponentMessenger.hpp>
57 m_skinningType( type ),
58 m_normalSkinning( APPROX ),
60 m_forceUpdate( false ),
62 m_weightType( STANDARD ),
63 m_showingWeights( false ) {}
65 ~SkinningComponent()
override {}
70 virtual void initialize()
override;
91 void setSkinningType( SkinningType type );
97 void setNormalSkinning( NormalSkinning normalSkinning );
107 const std::string& getMeshName()
const;
111 void setMeshName(
const std::string& name ) { m_meshName = name; }
114 const std::string& getSkeletonName()
const;
127 void showWeights(
bool on );
130 bool isShowingWeights();
133 void showWeightsType( WeightType type );
136 WeightType getWeightsType();
139 void setWeightBone( uint bone );
153 m_loadedBindMatrices = m;
158 void setupIO(
const std::string&
id );
161 void createWeightMatrix();
164 template <
typename T>
167 template <
typename T>
171 std::string m_meshName;
174 std::string m_skelName;
183 Getter<Core::Animation::Skeleton> m_skeletonGetter;
186 SkinningType m_skinningType;
189 NormalSkinning m_normalSkinning;
198 Getter<Core::Utils::Index> m_renderObjectReader;
201 bool m_meshIsPoly {
false };
204 bool m_meshIsQuad {
false };
207 ReadWrite<Core::Geometry::TriangleMesh> m_triMeshWriter;
210 ReadWrite<Core::Geometry::PolyMesh> m_polyMeshWriter;
213 ReadWrite<Core::Geometry::QuadMesh> m_quadMeshWriter;
221 std::map<std::string, std::vector<std::pair<uint, Scalar>>> m_loadedWeights;
226 std::map<std::string, Core::Transform> m_loadedBindMatrices;
229 std::shared_ptr<Data::Material> m_baseMaterial;
232 std::shared_ptr<Data::Material> m_weightMaterial;
235 Core::Vector3Array m_baseUV;
238 Core::Vector3Array m_weightsUV;
244 WeightType m_weightType;
247 bool m_showingWeights;
A component is an element that can be updated by a system. It is also linked to some other components...
An entity is an scene element. It ties together components with a transform.
The SkinningComponent class is responsible for applying Geometric Skinning Methods on an animated obj...
void setPerBoneMatrix(std::map< std::string, Core::Transform > &&m)
SkinningType
The Geometric Skinning Method.
@ COR
Center of Rotation skinning.
@ DQS
Dual Quaternion Skinning.
void setMeshName(const std::string &name)
SkinningType getSkinningType() const
Returns the current skinning method.
const Core::Animation::SkinningRefData * getSkinningRefData() const
Returns the reference skinning data.
WeightType
The skinning weight type.
NormalSkinning getNormalSkinning() const
Returns the current method used to skin the normal, tangent and binormal vectors.
const Core::Animation::SkinningFrameData * getSkinningFrameData() const
Returns the current Pose data.
void setPerBoneWeight(std::map< std::string, std::vector< std::pair< uint, Scalar >>> &&w)
NormalSkinning
How to skin the normal, tangent and binormal vectors.
Skinning data that get set at startup including the "reference state".
std::function< T *(void)> ReadWrite
Function pointer for a read/write getter.
std::function< const T *(void)> Getter
Function pointer for a getter function.