3#include <Core/Asset/DataLoader.hpp>
4#include <Core/Asset/GeometryData.hpp>
5#include <Core/Geometry/StandardAttribNames.hpp>
7#include <IO/AssimpLoader/AssimpWrapper.hpp>
10#include <assimp/mesh.h>
36 const bool VERBOSE_MODE =
false );
41 void loadData(
const aiScene* scene,
46 inline bool sceneHasGeometry(
const aiScene* scene )
const;
49 uint sceneGeometrySize(
const aiScene* scene )
const;
52 void loadGeometryData(
const aiScene* scene,
59 void loadMeshFrame(
const aiNode* node,
60 const Core::Transform& parentFrame,
66 void loadMeshAttrib(
const aiMesh& mesh,
72 void fetchName(
const aiMesh& mesh,
84 void fetchAttribute( T* aiData,
87 Core::Geometry::MeshAttrib a )
const;
91 void fetchIndexLayer( aiFace* faces,
100void AssimpGeometryDataLoader::fetchAttribute( T* aiData,
103 Core::Geometry::MeshAttrib a )
const {
104 auto attribHandle = data.
addAttrib<
typename AssimpTypeWrapper<T>::Type>( getAttribName( a ) );
106 attribData.resize( size );
107#pragma omp parallel for
108 for (
int i = 0; i < size; ++i ) {
109 attribData.at( i ) = assimpToCore( aiData[i] );
115void AssimpGeometryDataLoader::fetchIndexLayer( aiFace* faces,
117 Core::Geometry::MultiIndexedGeometry& data )
const {
118 auto layer = std::make_unique<T>();
119 auto& indices = layer->collection();
120 indices.resize( numFaces );
121#pragma omp parallel for
122 for (
int i = 0; i < numFaces; ++i ) {
123 indices[i] = assimpToCore<typename T::IndexType>( faces[i].mIndices, faces[i].mNumIndices );
125 data.addLayer(
std::move( layer ),
false,
"indices" );
Utils::AttribHandle< T > addAttrib(const std::string &name)
Utils::AttribManager & vertexAttribs()
AbstractGeometry with per-vertex attributes and layers of indices. Each layer represents a different ...
Attrib< T >::Container & getDataWithLock(const AttribHandle< T > &h)
Get the locked data container from the attrib handle.
void unlock(const AttribHandle< T > &h)
Unlock the handle data.
hepler function to manage enum as underlying types in VariableSet