3#include <Core/Asset/AssetData.hpp>
4#include <Core/Containers/AlignedStdVector.hpp>
5#include <Core/RaCore.hpp>
7#include <Core/Utils/Log.hpp>
29 Core::Transform m_frame { Core::Transform::Identity() };
47 enum HandleType { UNKNOWN = 1 << 0, POINT_CLOUD = 1 << 1, SKELETON = 1 << 2, CAGE = 1 << 3 };
66 inline HandleType getType()
const;
71 inline void setType(
const HandleType& type );
76 inline Core::Transform getFrame()
const;
81 inline void setFrame(
const Core::Transform& frame );
97 inline uint getVertexSize()
const;
102 inline void setVertexSize( uint size );
112 inline void recomputeAllIndices();
120 inline uint getComponentDataSize()
const;
180 inline void needEndNodes(
bool need );
189 inline bool isPointCloud()
const;
194 inline bool isSkeleton()
const;
199 inline bool isCage()
const;
204 inline bool hasComponents()
const;
209 inline bool hasEdges()
const;
214 inline bool hasFaces()
const;
219 inline bool needsEndNodes()
const;
225 inline int getIndexOf(
const std::string& name )
const;
231 inline void displayInfo()
const;
238 Core::Transform m_frame { Core::Transform::Identity() };
241 bool m_endNode {
false };
244 uint m_vertexSize { 0 };
253 Core::AlignedStdVector<HandleComponentData> m_component;
256 Core::AlignedStdVector<Core::Vector2ui> m_edge;
259 Core::AlignedStdVector<Core::VectorNui> m_face;
290 m_nameTable = nameTable;
294 return m_component.size();
307 const uint size = components.
size();
308 m_component.resize( size );
309#pragma omp parallel for
310 for (
int i = 0; i < int( size ); ++i ) {
311 m_component[i] = components[i];
316 CORE_ASSERT( ( i < m_component.size() ),
"Index i out of bound" );
317 return m_component[i];
321 CORE_ASSERT( ( i < m_component.size() ),
"Index i out of bound" );
322 return m_component[i];
334 const uint size = edgeList.
size();
335 m_edge.resize( size );
336#pragma omp parallel for
337 for (
int i = 0; i < int( size ); ++i ) {
338 m_edge[i] = edgeList[i];
351 const uint size = faceList.
size();
352 m_face.resize( size );
353#pragma omp parallel for
354 for (
int i = 0; i < int( size ); ++i ) {
355 m_face[i] = faceList[i];
362 m_nameTable[m_component[i].m_name] = i;
367 return ( m_type == POINT_CLOUD );
371 return ( m_type == SKELETON );
375 return ( m_type == CAGE );
379 return !m_component.empty();
383 return !m_edge.empty();
387 return !m_face.empty();
395 auto it = m_nameTable.
find( name );
396 if ( it == m_nameTable.
end() ) {
return -1; }
405 m_bindMeshes.
insert( name );
413 using namespace Core::Utils;
417 type =
"POINT CLOUD";
430 LOG( logINFO ) <<
"======== HANDLE INFO ========";
431 LOG( logINFO ) <<
" Name : " << m_name;
432 LOG( logINFO ) <<
" Type : " << type;
433 LOG( logINFO ) <<
" Element # : " << m_component.size();
434 LOG( logINFO ) <<
" Edge # : " << m_edge.size();
435 LOG( logINFO ) <<
" Face # : " << m_face.size();
436 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)
hepler function to manage enum as underlying types in VariableSet
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.