From 6a9ccf2016016cf71b3c3fd0a458f20e436e9273 Mon Sep 17 00:00:00 2001 From: Alexandr Arutjunov Date: Mon, 26 Sep 2016 13:01:38 +0300 Subject: [PATCH] [+] Flag for scene for supporting formats where more than one face can reference to one vertex. --- code/ValidateDataStructure.cpp | 5 +++-- include/assimp/scene.h | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/code/ValidateDataStructure.cpp b/code/ValidateDataStructure.cpp index fd6867012..44e361f71 100644 --- a/code/ValidateDataStructure.cpp +++ b/code/ValidateDataStructure.cpp @@ -1,4 +1,4 @@ -/* +/* --------------------------------------------------------------------------- Open Asset Import Library (assimp) --------------------------------------------------------------------------- @@ -408,7 +408,8 @@ void ValidateDSProcess::Validate( const aiMesh* pMesh) // the MSB flag is temporarily used by the extra verbose // mode to tell us that the JoinVerticesProcess might have // been executed already. - if ( !(this->mScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT ) && abRefList[face.mIndices[a]]) + if ( !(this->mScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT ) && !(this->mScene->mFlags & AI_SCENE_FLAGS_ALLOW_SHARED) && + abRefList[face.mIndices[a]]) { ReportError("aiMesh::mVertices[%i] is referenced twice - second " "time by aiMesh::mFaces[%i]::mIndices[%i]",face.mIndices[a],i,a); diff --git a/include/assimp/scene.h b/include/assimp/scene.h index 398f712b4..80542a67b 100644 --- a/include/assimp/scene.h +++ b/include/assimp/scene.h @@ -1,4 +1,4 @@ -/* +/* --------------------------------------------------------------------------- Open Asset Import Library (assimp) --------------------------------------------------------------------------- @@ -266,6 +266,13 @@ struct aiNode */ #define AI_SCENE_FLAGS_TERRAIN 0x10 + /** + * Specifies that the scene data can be shared between structures. For example: + * one vertex in few faces. \ref AI_SCENE_FLAGS_NON_VERBOSE_FORMAT can not be + * used for this because \ref AI_SCENE_FLAGS_NON_VERBOSE_FORMAT has internal + * meaning about postprocessing steps. + */ +#define AI_SCENE_FLAGS_ALLOW_SHARED 0x20 // ------------------------------------------------------------------------------- /** The root structure of the imported data.