3#include <Core/Asset/DataLoader.hpp>
4#include <Core/Asset/GeometryData.hpp>
5#include <Core/Geometry/StandardAttribNames.hpp>
7#include <IO/AssimpLoader/AssimpWrapper.hpp>
9#include <assimp/mesh.h>
34 const bool VERBOSE_MODE =
false );
39 void loadData(
const aiScene* scene,
44 inline bool sceneHasGeometry(
const aiScene* scene )
const;
47 uint sceneGeometrySize(
const aiScene* scene )
const;
50 void loadGeometryData(
const aiScene* scene,
57 void loadMeshFrame(
const aiNode* node,
58 const Core::Transform& parentFrame,
64 void loadMeshAttrib(
const aiMesh& mesh,
70 void fetchName(
const aiMesh& mesh,
82 void fetchAttribute( T* aiData,
85 Core::Geometry::MeshAttrib a )
const;
89 void fetchIndexLayer( aiFace* faces,
98void AssimpGeometryDataLoader::fetchAttribute( T* aiData,
101 Core::Geometry::MeshAttrib a )
const {
102 auto attribHandle = data.
addAttrib<
typename AssimpTypeWrapper<T>::Type>( getAttribName( a ) );
104 attribData.resize( size );
105#pragma omp parallel for
106 for (
int i = 0; i < size; ++i ) {
107 attribData.at( i ) = assimpToCore( aiData[i] );
113void AssimpGeometryDataLoader::fetchIndexLayer( aiFace* faces,
115 Core::Geometry::MultiIndexedGeometry& data )
const {
116 auto layer = std::make_unique<T>();
117 auto& indices = layer->collection();
118 indices.resize( numFaces );
119#pragma omp parallel for
120 for (
int i = 0; i < numFaces; ++i ) {
121 indices[i] = assimpToCore<typename T::IndexType>( faces[i].mIndices, faces[i].mNumIndices );
123 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