Merge branch 'master' into raise-cmake-minimum-version-to-3.0
commit
a254690ba0
|
@ -1,7 +1,7 @@
|
|||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=@CMAKE_INSTALL_PREFIX@/
|
||||
libdir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_LIB_INSTALL_DIR@
|
||||
includedir=@CMAKE_INSTALL_PREFIX@/../include/@ASSIMP_INCLUDE_INSTALL_DIR@
|
||||
includedir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_INCLUDE_INSTALL_DIR@
|
||||
|
||||
Name: @CMAKE_PROJECT_NAME@
|
||||
Description: Import various well-known 3D model formats in an uniform manner.
|
||||
|
|
|
@ -252,35 +252,39 @@ MACRO(ADD_ASSIMP_IMPORTER name)
|
|||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# if this variable is set to TRUE, the user can manually disable exporters by setting
|
||||
# ASSIMP_BUILD_XXX_EXPORTER to FALSE for each exporter
|
||||
# if this variable is set to FALSE, the user can manually enable exporters by setting
|
||||
# ASSIMP_BUILD_XXX_EXPORTER to TRUE for each exporter
|
||||
OPTION(ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT "default value of all ASSIMP_BUILD_XXX_EXPORTER values" TRUE)
|
||||
if (NOT ASSIMP_NO_EXPORT)
|
||||
|
||||
# macro to add the CMake Option ADD_ASSIMP_IMPORTER_<name> which enables compile of loader
|
||||
# this way selective loaders can be compiled (reduces filesize + compile time)
|
||||
MACRO(ADD_ASSIMP_EXPORTER name)
|
||||
IF (ASSIMP_NO_EXPORT)
|
||||
set(ASSIMP_EXPORTER_ENABLED FALSE)
|
||||
ELSEIF (ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT)
|
||||
set(ASSIMP_EXPORTER_ENABLED TRUE)
|
||||
IF (DEFINED ASSIMP_BUILD_${name}_EXPORTER AND NOT ASSIMP_BUILD_${name}_EXPORTER)
|
||||
# if this variable is set to TRUE, the user can manually disable exporters by setting
|
||||
# ASSIMP_BUILD_XXX_EXPORTER to FALSE for each exporter
|
||||
# if this variable is set to FALSE, the user can manually enable exporters by setting
|
||||
# ASSIMP_BUILD_XXX_EXPORTER to TRUE for each exporter
|
||||
OPTION(ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT "default value of all ASSIMP_BUILD_XXX_EXPORTER values" TRUE)
|
||||
|
||||
# macro to add the CMake Option ADD_ASSIMP_IMPORTER_<name> which enables compile of loader
|
||||
# this way selective loaders can be compiled (reduces filesize + compile time)
|
||||
MACRO(ADD_ASSIMP_EXPORTER name)
|
||||
IF (ASSIMP_NO_EXPORT)
|
||||
set(ASSIMP_EXPORTER_ENABLED FALSE)
|
||||
ELSEIF (ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT)
|
||||
set(ASSIMP_EXPORTER_ENABLED TRUE)
|
||||
IF (DEFINED ASSIMP_BUILD_${name}_EXPORTER AND NOT ASSIMP_BUILD_${name}_EXPORTER)
|
||||
set(ASSIMP_EXPORTER_ENABLED FALSE)
|
||||
ENDIF ()
|
||||
ELSE ()
|
||||
set(ASSIMP_EXPORTER_ENABLED ${ASSIMP_BUILD_${name}_EXPORTER})
|
||||
ENDIF ()
|
||||
ELSE ()
|
||||
set(ASSIMP_EXPORTER_ENABLED ${ASSIMP_BUILD_${name}_EXPORTER})
|
||||
ENDIF ()
|
||||
|
||||
IF (ASSIMP_EXPORTER_ENABLED)
|
||||
SET(ASSIMP_EXPORTERS_ENABLED "${ASSIMP_EXPORTERS_ENABLED} ${name}")
|
||||
LIST(APPEND ASSIMP_EXPORTER_SRCS ${ARGN})
|
||||
SOURCE_GROUP(${name}_EXPORTER FILES ${ARGN})
|
||||
ELSE()
|
||||
SET(ASSIMP_EXPORTERS_DISABLED "${ASSIMP_EXPORTERS_DISABLED} ${name}")
|
||||
add_definitions(-DASSIMP_BUILD_NO_${name}_EXPORTER)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
IF (ASSIMP_EXPORTER_ENABLED)
|
||||
SET(ASSIMP_EXPORTERS_ENABLED "${ASSIMP_EXPORTERS_ENABLED} ${name}")
|
||||
LIST(APPEND ASSIMP_EXPORTER_SRCS ${ARGN})
|
||||
SOURCE_GROUP(${name}_EXPORTER FILES ${ARGN})
|
||||
ELSE()
|
||||
SET(ASSIMP_EXPORTERS_DISABLED "${ASSIMP_EXPORTERS_DISABLED} ${name}")
|
||||
add_definitions(-DASSIMP_BUILD_NO_${name}_EXPORTER)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
endif()
|
||||
|
||||
SET(ASSIMP_LOADER_SRCS "")
|
||||
SET(ASSIMP_IMPORTERS_ENABLED "") # list of enabled importers
|
||||
|
@ -307,11 +311,6 @@ ADD_ASSIMP_IMPORTER( 3DS
|
|||
3DS/3DSLoader.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( 3DS
|
||||
3DS/3DSExporter.h
|
||||
3DS/3DSExporter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( AC
|
||||
AC/ACLoader.cpp
|
||||
AC/ACLoader.h
|
||||
|
@ -329,20 +328,6 @@ ADD_ASSIMP_IMPORTER( ASSBIN
|
|||
Assbin/AssbinLoader.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( ASSBIN
|
||||
Assbin/AssbinExporter.h
|
||||
Assbin/AssbinExporter.cpp
|
||||
Assbin/AssbinFileWriter.h
|
||||
Assbin/AssbinFileWriter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( ASSXML
|
||||
Assxml/AssxmlExporter.h
|
||||
Assxml/AssxmlExporter.cpp
|
||||
Assxml/AssxmlFileWriter.h
|
||||
Assxml/AssxmlFileWriter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( B3D
|
||||
B3D/B3DImporter.cpp
|
||||
B3D/B3DImporter.h
|
||||
|
@ -362,11 +347,6 @@ ADD_ASSIMP_IMPORTER( COLLADA
|
|||
Collada/ColladaParser.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( COLLADA
|
||||
Collada/ColladaExporter.h
|
||||
Collada/ColladaExporter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( DXF
|
||||
DXF/DXFLoader.cpp
|
||||
DXF/DXFLoader.h
|
||||
|
@ -423,11 +403,6 @@ ADD_ASSIMP_IMPORTER( M3D
|
|||
M3D/m3d.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( M3D
|
||||
M3D/M3DExporter.h
|
||||
M3D/M3DExporter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( MD2
|
||||
MD2/MD2FileData.h
|
||||
MD2/MD2Loader.cpp
|
||||
|
@ -505,11 +480,6 @@ ADD_ASSIMP_IMPORTER( OBJ
|
|||
Obj/ObjTools.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( OBJ
|
||||
Obj/ObjExporter.h
|
||||
Obj/ObjExporter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( OGRE
|
||||
Ogre/OgreImporter.h
|
||||
Ogre/OgreStructs.h
|
||||
|
@ -529,11 +499,6 @@ ADD_ASSIMP_IMPORTER( OPENGEX
|
|||
OpenGEX/OpenGEXStructs.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( OPENGEX
|
||||
OpenGEX/OpenGEXExporter.cpp
|
||||
OpenGEX/OpenGEXExporter.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( PLY
|
||||
Ply/PlyLoader.cpp
|
||||
Ply/PlyLoader.h
|
||||
|
@ -541,11 +506,6 @@ ADD_ASSIMP_IMPORTER( PLY
|
|||
Ply/PlyParser.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( PLY
|
||||
Ply/PlyExporter.cpp
|
||||
Ply/PlyExporter.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( MS3D
|
||||
MS3D/MS3DLoader.cpp
|
||||
MS3D/MS3DLoader.h
|
||||
|
@ -635,14 +595,86 @@ ADD_ASSIMP_IMPORTER( FBX
|
|||
FBX/FBXCommon.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( FBX
|
||||
FBX/FBXExporter.h
|
||||
FBX/FBXExporter.cpp
|
||||
FBX/FBXExportNode.h
|
||||
FBX/FBXExportNode.cpp
|
||||
FBX/FBXExportProperty.h
|
||||
FBX/FBXExportProperty.cpp
|
||||
)
|
||||
if (NOT ASSIMP_NO_EXPORT)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( OBJ
|
||||
Obj/ObjExporter.h
|
||||
Obj/ObjExporter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( OPENGEX
|
||||
OpenGEX/OpenGEXExporter.cpp
|
||||
OpenGEX/OpenGEXExporter.h)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( PLY
|
||||
Ply/PlyExporter.cpp
|
||||
Ply/PlyExporter.h)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( 3DS
|
||||
3DS/3DSExporter.h
|
||||
3DS/3DSExporter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( ASSBIN
|
||||
Assbin/AssbinExporter.h
|
||||
Assbin/AssbinExporter.cpp
|
||||
Assbin/AssbinFileWriter.h
|
||||
Assbin/AssbinFileWriter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( ASSXML
|
||||
Assxml/AssxmlExporter.h
|
||||
Assxml/AssxmlExporter.cpp
|
||||
Assxml/AssxmlFileWriter.h
|
||||
Assxml/AssxmlFileWriter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER(M3D
|
||||
M3D/M3DExporter.h
|
||||
M3D/M3DExporter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER(COLLADA
|
||||
Collada/ColladaExporter.h
|
||||
Collada/ColladaExporter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( FBX
|
||||
FBX/FBXExporter.h
|
||||
FBX/FBXExporter.cpp
|
||||
FBX/FBXExportNode.h
|
||||
FBX/FBXExportNode.cpp
|
||||
FBX/FBXExportProperty.h
|
||||
FBX/FBXExportProperty.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( STL
|
||||
STL/STLExporter.h
|
||||
STL/STLExporter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( X
|
||||
X/XFileExporter.h
|
||||
X/XFileExporter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( X3D
|
||||
X3D/X3DExporter.cpp
|
||||
X3D/X3DExporter.hpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( GLTF
|
||||
glTF/glTFExporter.h
|
||||
glTF/glTFExporter.cpp
|
||||
glTF2/glTF2Exporter.h
|
||||
glTF2/glTF2Exporter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( 3MF
|
||||
3MF/D3MFExporter.h
|
||||
3MF/D3MFExporter.cpp)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( ASSJSON
|
||||
Assjson/cencode.c
|
||||
Assjson/cencode.h
|
||||
Assjson/json_exporter.cpp
|
||||
Assjson/mesh_splitter.cpp
|
||||
Assjson/mesh_splitter.h)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( STEP
|
||||
Step/StepExporter.h
|
||||
Step/StepExporter.cpp)
|
||||
|
||||
endif()
|
||||
|
||||
SET( PostProcessing_SRCS
|
||||
PostProcessing/CalcTangentsProcess.cpp
|
||||
|
@ -744,11 +776,6 @@ ADD_ASSIMP_IMPORTER( STL
|
|||
STL/STLLoader.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( STL
|
||||
STL/STLExporter.h
|
||||
STL/STLExporter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( TERRAGEN
|
||||
Terragen/TerragenLoader.cpp
|
||||
Terragen/TerragenLoader.h
|
||||
|
@ -767,11 +794,6 @@ ADD_ASSIMP_IMPORTER( X
|
|||
X/XFileParser.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( X
|
||||
X/XFileExporter.h
|
||||
X/XFileExporter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( X3D
|
||||
X3D/X3DImporter.cpp
|
||||
X3D/X3DImporter.hpp
|
||||
|
@ -792,11 +814,6 @@ ADD_ASSIMP_IMPORTER( X3D
|
|||
X3D/X3DVocabulary.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( X3D
|
||||
X3D/X3DExporter.cpp
|
||||
X3D/X3DExporter.hpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( GLTF
|
||||
glTF/glTFCommon.h
|
||||
glTF/glTFCommon.cpp
|
||||
|
@ -814,13 +831,6 @@ ADD_ASSIMP_IMPORTER( GLTF
|
|||
glTF2/glTF2Importer.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( GLTF
|
||||
glTF/glTFExporter.h
|
||||
glTF/glTFExporter.cpp
|
||||
glTF2/glTF2Exporter.h
|
||||
glTF2/glTF2Exporter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( 3MF
|
||||
3MF/D3MFImporter.h
|
||||
3MF/D3MFImporter.cpp
|
||||
|
@ -829,11 +839,6 @@ ADD_ASSIMP_IMPORTER( 3MF
|
|||
3MF/3MFXmlTags.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( 3MF
|
||||
3MF/D3MFExporter.h
|
||||
3MF/D3MFExporter.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( MMD
|
||||
MMD/MMDCpp14.h
|
||||
MMD/MMDImporter.cpp
|
||||
|
@ -844,14 +849,6 @@ ADD_ASSIMP_IMPORTER( MMD
|
|||
MMD/MMDVmdParser.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( ASSJSON
|
||||
Assjson/cencode.c
|
||||
Assjson/cencode.h
|
||||
Assjson/json_exporter.cpp
|
||||
Assjson/mesh_splitter.cpp
|
||||
Assjson/mesh_splitter.h
|
||||
)
|
||||
|
||||
# Workaround for issue #2406 - force problematic large file to be optimized to prevent string table overflow error
|
||||
# Used -Os instead of -O2 as previous issues had mentioned, since -Os is roughly speaking -O2, excluding any
|
||||
# optimizations that take up extra space. Given that the issue is a string table overflowing, -Os seemed appropriate
|
||||
|
@ -874,11 +871,6 @@ ADD_ASSIMP_IMPORTER( STEP
|
|||
Importer/StepFile/StepReaderGen.h
|
||||
)
|
||||
|
||||
ADD_ASSIMP_EXPORTER( STEP
|
||||
Step/StepExporter.h
|
||||
Step/StepExporter.cpp
|
||||
)
|
||||
|
||||
if ((NOT ASSIMP_NO_EXPORT) OR (NOT ASSIMP_EXPORTERS_ENABLED STREQUAL ""))
|
||||
SET( Exporter_SRCS
|
||||
Common/Exporter.cpp
|
||||
|
@ -1088,8 +1080,10 @@ ENDIF()
|
|||
MESSAGE(STATUS "Enabled importer formats:${ASSIMP_IMPORTERS_ENABLED}")
|
||||
MESSAGE(STATUS "Disabled importer formats:${ASSIMP_IMPORTERS_DISABLED}")
|
||||
|
||||
MESSAGE(STATUS "Enabled exporter formats:${ASSIMP_EXPORTERS_ENABLED}")
|
||||
MESSAGE(STATUS "Disabled exporter formats:${ASSIMP_EXPORTERS_DISABLED}")
|
||||
if (NOT ASSIMP_NO_EXPORT)
|
||||
MESSAGE(STATUS "Enabled exporter formats:${ASSIMP_EXPORTERS_ENABLED}")
|
||||
MESSAGE(STATUS "Disabled exporter formats:${ASSIMP_EXPORTERS_DISABLED}")
|
||||
endif()
|
||||
|
||||
SOURCE_GROUP( include\\assimp FILES ${PUBLIC_HEADERS} )
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <limits>
|
||||
#include <assimp/TinyFormatter.h>
|
||||
#include <assimp/Exceptional.h>
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace Assimp::Formatter;
|
||||
|
@ -94,7 +95,10 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene)
|
|||
bool isNecessary = false;
|
||||
for( unsigned int a = 0; a < pScene->mNumMeshes; ++a)
|
||||
if( pScene->mMeshes[a]->mNumBones > mMaxBoneCount )
|
||||
{
|
||||
isNecessary = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !isNecessary )
|
||||
{
|
||||
|
@ -155,7 +159,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
{
|
||||
// skip if not necessary
|
||||
if( pMesh->mNumBones <= mMaxBoneCount )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// necessary optimisation: build a list of all affecting bones for each vertex
|
||||
// TODO: (thom) maybe add a custom allocator here to avoid allocating tens of thousands of small arrays
|
||||
|
@ -165,7 +171,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
{
|
||||
const aiBone* bone = pMesh->mBones[a];
|
||||
for( unsigned int b = 0; b < bone->mNumWeights; ++b)
|
||||
{
|
||||
vertexBones[ bone->mWeights[b].mVertexId ].push_back( BoneWeight( a, bone->mWeights[b].mWeight));
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int numFacesHandled = 0;
|
||||
|
@ -189,7 +197,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
{
|
||||
// skip if the face is already stored in a submesh
|
||||
if( isFaceHandled[a] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const aiFace& face = pMesh->mFaces[a];
|
||||
// check every vertex if its bones would still fit into the current submesh
|
||||
|
@ -201,17 +211,27 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
unsigned int boneIndex = vb[c].first;
|
||||
// if the bone is already used in this submesh, it's ok
|
||||
if( isBoneUsed[boneIndex] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// if it's not used, yet, we would need to add it. Store its bone index
|
||||
if( std::find( newBonesAtCurrentFace.begin(), newBonesAtCurrentFace.end(), boneIndex) == newBonesAtCurrentFace.end() )
|
||||
{
|
||||
newBonesAtCurrentFace.push_back( boneIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newBonesAtCurrentFace.size() > mMaxBoneCount)
|
||||
{
|
||||
throw DeadlyImportError("SplitByBoneCountProcess: Single face requires more bones than specified max bone count!");
|
||||
}
|
||||
// leave out the face if the new bones required for this face don't fit the bone count limit anymore
|
||||
if( numBones + newBonesAtCurrentFace.size() > mMaxBoneCount )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// mark all new bones as necessary
|
||||
while( !newBonesAtCurrentFace.empty() )
|
||||
|
@ -219,7 +239,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
unsigned int newIndex = newBonesAtCurrentFace.back();
|
||||
newBonesAtCurrentFace.pop_back(); // this also avoids the deallocation which comes with a clear()
|
||||
if( isBoneUsed[newIndex] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
isBoneUsed[newIndex] = true;
|
||||
numBones++;
|
||||
|
@ -237,7 +259,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
// create a new mesh to hold this subset of the source mesh
|
||||
aiMesh* newMesh = new aiMesh;
|
||||
if( pMesh->mName.length > 0 )
|
||||
{
|
||||
newMesh->mName.Set( format() << pMesh->mName.data << "_sub" << poNewMeshes.size());
|
||||
}
|
||||
newMesh->mMaterialIndex = pMesh->mMaterialIndex;
|
||||
newMesh->mPrimitiveTypes = pMesh->mPrimitiveTypes;
|
||||
poNewMeshes.push_back( newMesh);
|
||||
|
@ -247,7 +271,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
newMesh->mNumFaces = static_cast<unsigned int>(subMeshFaces.size());
|
||||
newMesh->mVertices = new aiVector3D[newMesh->mNumVertices];
|
||||
if( pMesh->HasNormals() )
|
||||
{
|
||||
newMesh->mNormals = new aiVector3D[newMesh->mNumVertices];
|
||||
}
|
||||
if( pMesh->HasTangentsAndBitangents() )
|
||||
{
|
||||
newMesh->mTangents = new aiVector3D[newMesh->mNumVertices];
|
||||
|
@ -256,13 +282,17 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a )
|
||||
{
|
||||
if( pMesh->HasTextureCoords( a) )
|
||||
{
|
||||
newMesh->mTextureCoords[a] = new aiVector3D[newMesh->mNumVertices];
|
||||
}
|
||||
newMesh->mNumUVComponents[a] = pMesh->mNumUVComponents[a];
|
||||
}
|
||||
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a )
|
||||
{
|
||||
if( pMesh->HasVertexColors( a) )
|
||||
{
|
||||
newMesh->mColors[a] = new aiColor4D[newMesh->mNumVertices];
|
||||
}
|
||||
}
|
||||
|
||||
// and copy over the data, generating faces with linear indices along the way
|
||||
|
@ -285,7 +315,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
|
||||
newMesh->mVertices[nvi] = pMesh->mVertices[srcIndex];
|
||||
if( pMesh->HasNormals() )
|
||||
{
|
||||
newMesh->mNormals[nvi] = pMesh->mNormals[srcIndex];
|
||||
}
|
||||
if( pMesh->HasTangentsAndBitangents() )
|
||||
{
|
||||
newMesh->mTangents[nvi] = pMesh->mTangents[srcIndex];
|
||||
|
@ -294,12 +326,16 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++c )
|
||||
{
|
||||
if( pMesh->HasTextureCoords( c) )
|
||||
{
|
||||
newMesh->mTextureCoords[c][nvi] = pMesh->mTextureCoords[c][srcIndex];
|
||||
}
|
||||
}
|
||||
for( unsigned int c = 0; c < AI_MAX_NUMBER_OF_COLOR_SETS; ++c )
|
||||
{
|
||||
if( pMesh->HasVertexColors( c) )
|
||||
{
|
||||
newMesh->mColors[c][nvi] = pMesh->mColors[c][srcIndex];
|
||||
}
|
||||
}
|
||||
|
||||
nvi++;
|
||||
|
@ -316,7 +352,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
for( unsigned int a = 0; a < pMesh->mNumBones; ++a )
|
||||
{
|
||||
if( !isBoneUsed[a] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// create the new bone
|
||||
const aiBone* srcBone = pMesh->mBones[a];
|
||||
|
@ -340,7 +378,9 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
|
|||
{
|
||||
unsigned int newBoneIndex = mappedBoneIndex[ bonesOnThisVertex[b].first ];
|
||||
if( newBoneIndex != std::numeric_limits<unsigned int>::max() )
|
||||
{
|
||||
newMesh->mBones[newBoneIndex]->mNumWeights++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue