3 #include <Core/Asset/AssetData.hpp>
4 #include <Core/Containers/AlignedStdVector.hpp>
5 #include <Core/RaCore.hpp>
7 #include <Core/Utils/Log.hpp>
22 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
30 Core::Transform m_frame { Core::Transform::Identity() };
36 std::map<std::string, std::vector<std::pair<uint, Scalar>>>
m_weights;
45 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
50 enum HandleType { UNKNOWN = 1 << 0, POINT_CLOUD = 1 << 1, SKELETON = 1 << 2, CAGE = 1 << 3 };
52 HandleData(
const std::string& name =
"",
const HandleType& type = UNKNOWN );
64 inline void setName(
const std::string& name );
69 inline HandleType getType()
const;
74 inline void setType(
const HandleType& type );
79 inline Core::Transform getFrame()
const;
84 inline void setFrame(
const Core::Transform& frame );
89 inline void addBindMesh(
const std::string& name );
94 inline const std::set<std::string>& getBindMeshes()
const;
100 inline uint getVertexSize()
const;
105 inline void setVertexSize( uint size );
110 inline void setNameTable(
const std::map<std::string, uint>& nameTable );
115 inline void recomputeAllIndices();
123 inline uint getComponentDataSize()
const;
128 inline const Core::AlignedStdVector<HandleComponentData>& getComponentData()
const;
133 inline Core::AlignedStdVector<HandleComponentData>& getComponentData();
148 inline void setComponents(
const Core::AlignedStdVector<HandleComponentData>& components );
153 inline const Core::AlignedStdVector<Core::Vector2ui>& getEdgeData()
const;
158 inline Core::AlignedStdVector<Core::Vector2ui>& getEdgeData();
163 inline void setEdges(
const Core::AlignedStdVector<Core::Vector2ui>& edgeList );
168 inline const Core::AlignedStdVector<Core::VectorNui>& getFaceData()
const;
173 inline Core::AlignedStdVector<Core::VectorNui>& getFaceData();
178 inline void setFaces(
const Core::AlignedStdVector<Core::VectorNui>& faceList );
183 inline void needEndNodes(
bool need );
192 inline bool isPointCloud()
const;
197 inline bool isSkeleton()
const;
202 inline bool isCage()
const;
207 inline bool hasComponents()
const;
212 inline bool hasEdges()
const;
217 inline bool hasFaces()
const;
222 inline bool needsEndNodes()
const;
228 inline int getIndexOf(
const std::string& name )
const;
234 inline void displayInfo()
const;
241 Core::Transform m_frame { Core::Transform::Identity() };
244 bool m_endNode {
false };
247 uint m_vertexSize { 0 };
250 std::map<std::string, uint> m_nameTable;
253 std::set<std::string> m_bindMeshes;
256 Core::AlignedStdVector<HandleComponentData> m_component;
259 Core::AlignedStdVector<Core::Vector2ui> m_edge;
262 Core::AlignedStdVector<Core::VectorNui> m_face;
293 m_nameTable = nameTable;
297 return m_component.size();
310 const uint size = components.size();
311 m_component.resize( size );
312 #pragma omp parallel for
313 for (
int i = 0; i < int( size ); ++i ) {
314 m_component[i] = components[i];
319 CORE_ASSERT( ( i < m_component.size() ),
"Index i out of bound" );
320 return m_component[i];
324 CORE_ASSERT( ( i < m_component.size() ),
"Index i out of bound" );
325 return m_component[i];
337 const uint size = edgeList.size();
338 m_edge.resize( size );
339 #pragma omp parallel for
340 for (
int i = 0; i < int( size ); ++i ) {
341 m_edge[i] = edgeList[i];
354 const uint size = faceList.size();
355 m_face.resize( size );
356 #pragma omp parallel for
357 for (
int i = 0; i < int( size ); ++i ) {
358 m_face[i] = faceList[i];
365 m_nameTable[m_component[i].m_name] = i;
370 return ( m_type == POINT_CLOUD );
374 return ( m_type == SKELETON );
378 return ( m_type == CAGE );
382 return !m_component.empty();
386 return !m_edge.empty();
390 return !m_face.empty();
398 auto it = m_nameTable.find( name );
399 if ( it == m_nameTable.end() ) {
return -1; }
408 m_bindMeshes.insert( name );
416 using namespace Core::Utils;
420 type =
"POINT CLOUD";
433 LOG( logINFO ) <<
"======== HANDLE INFO ========";
434 LOG( logINFO ) <<
" Name : " << m_name;
435 LOG( logINFO ) <<
" Type : " << type;
436 LOG( logINFO ) <<
" Element # : " << m_component.size();
437 LOG( logINFO ) <<
" Edge # : " << m_edge.size();
438 LOG( logINFO ) <<
" Face # : " << m_face.size();
439 LOG( logINFO ) <<
" Need EndNodes ? : " << ( ( m_endNode ) ?
"YES" :
"NO" );
void setNameTable(const std::map< std::string, uint > &nameTable)
uint getVertexSize() const
uint getComponentDataSize() const
const Core::AlignedStdVector< HandleComponentData > & getComponentData() const
bool needsEndNodes() const
int getIndexOf(const std::string &name) const
void recomputeAllIndices()
void setFrame(const Core::Transform &frame)
void setEdges(const Core::AlignedStdVector< Core::Vector2ui > &edgeList)
bool isPointCloud() const
const Core::AlignedStdVector< Core::VectorNui > & getFaceData() const
void setType(const HandleType &type)
const std::set< std::string > & getBindMeshes() const
const Core::AlignedStdVector< Core::Vector2ui > & getEdgeData() const
HandleType getType() const
void needEndNodes(bool need)
void addBindMesh(const std::string &name)
void setFaces(const Core::AlignedStdVector< Core::VectorNui > &faceList)
const HandleComponentData & getComponent(const uint i) const
Core::Transform getFrame() const
void setComponents(const Core::AlignedStdVector< HandleComponentData > &components)
bool hasComponents() const
void setVertexSize(uint size)
void setName(const std::string &name)
std::map< std::string, Core::Transform > m_bindMatrices
Per skinned-mesh matrix from mesh space to bone space (local).
std::map< std::string, std::vector< std::pair< uint, Scalar > > > m_weights
Per skinned-mesh vertex weigths.
std::string m_name
Handle name.