2008-05-09 17:24:28 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
2012-02-03 03:38:30 +00:00
|
|
|
Open Asset Import Library (assimp)
|
2008-05-09 17:24:28 +00:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2015-06-28 19:48:25 +00:00
|
|
|
Copyright (c) 2006-2015, assimp team
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
|
|
with or without modification, are permitted provided that the following
|
|
|
|
conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
* Neither the name of the assimp team, nor the names of its
|
2008-05-09 17:24:28 +00:00
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
2012-02-03 03:38:30 +00:00
|
|
|
written permission of the assimp team.
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
/** @file Implementation of the post processing step to join identical vertices
|
|
|
|
* for all imported meshes
|
|
|
|
*/
|
|
|
|
|
2015-04-15 23:00:17 +00:00
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
#ifndef ASSIMP_BUILD_NO_JOINVERTICES_PROCESS
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2008-09-27 16:46:05 +00:00
|
|
|
#include "JoinVerticesProcess.h"
|
|
|
|
#include "ProcessHelper.h"
|
2010-01-28 21:17:25 +00:00
|
|
|
#include "Vertex.h"
|
2015-06-28 19:48:25 +00:00
|
|
|
#include "TinyFormatter.h"
|
|
|
|
#include <stdio.h>
|
2015-04-15 23:00:17 +00:00
|
|
|
#include <boost/static_assert.hpp>
|
2008-09-27 16:46:05 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
using namespace Assimp;
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Constructor to be privately used by Importer
|
|
|
|
JoinVerticesProcess::JoinVerticesProcess()
|
|
|
|
{
|
|
|
|
// nothing to do here
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Destructor, private as well
|
|
|
|
JoinVerticesProcess::~JoinVerticesProcess()
|
|
|
|
{
|
|
|
|
// nothing to do here
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Returns whether the processing step is present in the given flag field.
|
|
|
|
bool JoinVerticesProcess::IsActive( unsigned int pFlags) const
|
|
|
|
{
|
|
|
|
return (pFlags & aiProcess_JoinIdenticalVertices) != 0;
|
|
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Executes the post processing step on the given imported data.
|
|
|
|
void JoinVerticesProcess::Execute( aiScene* pScene)
|
|
|
|
{
|
2008-05-13 23:26:52 +00:00
|
|
|
DefaultLogger::get()->debug("JoinVerticesProcess begin");
|
|
|
|
|
2008-07-30 23:00:25 +00:00
|
|
|
// get the total number of vertices BEFORE the step is executed
|
|
|
|
int iNumOldVertices = 0;
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
if (!DefaultLogger::isNullLogger()) {
|
|
|
|
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) {
|
|
|
|
iNumOldVertices += pScene->mMeshes[a]->mNumVertices;
|
|
|
|
}
|
2008-07-30 23:00:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// execute the step
|
|
|
|
int iNumVertices = 0;
|
2009-08-18 16:17:27 +00:00
|
|
|
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
iNumVertices += ProcessMesh( pScene->mMeshes[a],a);
|
|
|
|
|
|
|
|
// if logging is active, print detailed statistics
|
2008-07-30 23:00:25 +00:00
|
|
|
if (!DefaultLogger::isNullLogger())
|
|
|
|
{
|
2009-08-18 16:17:27 +00:00
|
|
|
if (iNumOldVertices == iNumVertices)
|
|
|
|
{
|
|
|
|
DefaultLogger::get()->debug("JoinVerticesProcess finished ");
|
|
|
|
} else
|
2008-07-30 23:00:25 +00:00
|
|
|
{
|
|
|
|
char szBuff[128]; // should be sufficiently large in every case
|
|
|
|
sprintf(szBuff,"JoinVerticesProcess finished | Verts in: %i out: %i | ~%.1f%%",
|
|
|
|
iNumOldVertices,
|
|
|
|
iNumVertices,
|
|
|
|
((iNumOldVertices - iNumVertices) / (float)iNumOldVertices) * 100.f);
|
|
|
|
DefaultLogger::get()->info(szBuff);
|
|
|
|
}
|
2008-05-13 23:26:52 +00:00
|
|
|
}
|
2008-10-19 11:32:33 +00:00
|
|
|
|
|
|
|
pScene->mFlags |= AI_SCENE_FLAGS_NON_VERBOSE_FORMAT;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Unites identical vertices in the given mesh
|
2008-07-30 23:00:25 +00:00
|
|
|
int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2011-02-03 14:14:09 +00:00
|
|
|
BOOST_STATIC_ASSERT( AI_MAX_NUMBER_OF_COLOR_SETS == 8);
|
|
|
|
BOOST_STATIC_ASSERT( AI_MAX_NUMBER_OF_TEXTURECOORDS == 8);
|
2008-07-30 23:00:25 +00:00
|
|
|
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
// Return early if we don't have any positions
|
2010-01-28 21:17:25 +00:00
|
|
|
if (!pMesh->HasPositions() || !pMesh->HasFaces()) {
|
2008-07-30 23:00:25 +00:00
|
|
|
return 0;
|
2010-01-28 21:17:25 +00:00
|
|
|
}
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
|
|
|
// We'll never have more vertices afterwards.
|
2008-05-05 12:36:31 +00:00
|
|
|
std::vector<Vertex> uniqueVertices;
|
|
|
|
uniqueVertices.reserve( pMesh->mNumVertices);
|
|
|
|
|
2010-07-11 23:07:11 +00:00
|
|
|
// For each vertex the index of the vertex it was replaced by.
|
|
|
|
// Since the maximal number of vertices is 2^31-1, the most significand bit can be used to mark
|
|
|
|
// whether a new vertex was created for the index (true) or if it was replaced by an existing
|
|
|
|
// unique vertex (false). This saves an additional std::vector<bool> and greatly enhances
|
|
|
|
// branching performance.
|
2010-07-16 11:44:31 +00:00
|
|
|
BOOST_STATIC_ASSERT(AI_MAX_VERTICES == 0x7fffffff);
|
2008-05-05 12:36:31 +00:00
|
|
|
std::vector<unsigned int> replaceIndex( pMesh->mNumVertices, 0xffffffff);
|
|
|
|
|
2010-01-28 21:17:25 +00:00
|
|
|
// A little helper to find locally close vertices faster.
|
|
|
|
// Try to reuse the lookup table from the last step.
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
const static float epsilon = 1e-5f;
|
2011-06-09 14:29:32 +00:00
|
|
|
// float posEpsilonSqr;
|
2010-01-28 21:17:25 +00:00
|
|
|
SpatialSort* vertexFinder = NULL;
|
|
|
|
SpatialSort _vertexFinder;
|
|
|
|
|
|
|
|
typedef std::pair<SpatialSort,float> SpatPair;
|
2009-03-11 22:56:16 +00:00
|
|
|
if (shared) {
|
2010-01-28 21:17:25 +00:00
|
|
|
std::vector<SpatPair >* avf;
|
2008-09-27 16:46:05 +00:00
|
|
|
shared->GetProperty(AI_SPP_SPATIAL_SORT,avf);
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
if (avf) {
|
2010-01-28 21:17:25 +00:00
|
|
|
SpatPair& blubb = (*avf)[meshIndex];
|
|
|
|
vertexFinder = &blubb.first;
|
2011-06-09 14:29:32 +00:00
|
|
|
// posEpsilonSqr = blubb.second;
|
2008-09-27 16:46:05 +00:00
|
|
|
}
|
|
|
|
}
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
if (!vertexFinder) {
|
2010-01-28 21:17:25 +00:00
|
|
|
// bad, need to compute it.
|
2008-09-27 16:46:05 +00:00
|
|
|
_vertexFinder.Fill(pMesh->mVertices, pMesh->mNumVertices, sizeof( aiVector3D));
|
2009-03-11 22:56:16 +00:00
|
|
|
vertexFinder = &_vertexFinder;
|
2011-06-09 14:29:32 +00:00
|
|
|
// posEpsilonSqr = ComputePositionEpsilon(pMesh);
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2010-01-28 21:17:25 +00:00
|
|
|
// Squared because we check against squared length of the vector difference
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
static const float squareEpsilon = epsilon * epsilon;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2010-01-28 21:17:25 +00:00
|
|
|
// Again, better waste some bytes than a realloc ...
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
std::vector<unsigned int> verticesFound;
|
|
|
|
verticesFound.reserve(10);
|
|
|
|
|
2010-01-28 21:17:25 +00:00
|
|
|
// Run an optimized code path if we don't have multiple UVs or vertex colors.
|
|
|
|
// This should yield false in more than 99% of all imports ...
|
2011-02-03 14:14:09 +00:00
|
|
|
const bool complex = ( pMesh->GetNumColorChannels() > 0 || pMesh->GetNumUVChannels() > 1);
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
|
|
|
// Now check each vertex if it brings something new to the table
|
2010-01-28 21:17:25 +00:00
|
|
|
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
2008-05-05 12:36:31 +00:00
|
|
|
// collect the vertex data
|
2010-01-28 21:17:25 +00:00
|
|
|
Vertex v(pMesh,a);
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// collect all vertices that are close enough to the given position
|
2010-07-11 23:07:11 +00:00
|
|
|
vertexFinder->FindIdenticalPositions( v.position, verticesFound);
|
2008-05-05 12:36:31 +00:00
|
|
|
unsigned int matchIndex = 0xffffffff;
|
2010-01-28 21:17:25 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// check all unique vertices close to the position if this vertex is already present among them
|
2010-01-28 21:17:25 +00:00
|
|
|
for( unsigned int b = 0; b < verticesFound.size(); b++) {
|
|
|
|
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
const unsigned int vidx = verticesFound[b];
|
|
|
|
const unsigned int uidx = replaceIndex[ vidx];
|
2010-07-11 23:07:11 +00:00
|
|
|
if( uidx & 0x80000000)
|
2008-05-05 12:36:31 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
const Vertex& uv = uniqueVertices[ uidx];
|
|
|
|
// Position mismatch is impossible - the vertex finder already discarded all non-matching positions
|
|
|
|
|
|
|
|
// We just test the other attributes even if they're not present in the mesh.
|
|
|
|
// In this case they're initialized to 0 so the comparision succeeds.
|
|
|
|
// By this method the non-present attributes are effectively ignored in the comparision.
|
2010-01-28 21:17:25 +00:00
|
|
|
if( (uv.normal - v.normal).SquareLength() > squareEpsilon)
|
2008-05-05 12:36:31 +00:00
|
|
|
continue;
|
2010-01-28 21:17:25 +00:00
|
|
|
if( (uv.texcoords[0] - v.texcoords[0]).SquareLength() > squareEpsilon)
|
2008-05-05 12:36:31 +00:00
|
|
|
continue;
|
2010-01-28 21:17:25 +00:00
|
|
|
if( (uv.tangent - v.tangent).SquareLength() > squareEpsilon)
|
2008-05-05 12:36:31 +00:00
|
|
|
continue;
|
2010-01-28 21:17:25 +00:00
|
|
|
if( (uv.bitangent - v.bitangent).SquareLength() > squareEpsilon)
|
2008-05-05 12:36:31 +00:00
|
|
|
continue;
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
|
|
|
// Usually we won't have vertex colors or multiple UVs, so we can skip from here
|
2010-01-28 21:17:25 +00:00
|
|
|
// Actually this increases runtime performance slightly, at least if branch
|
|
|
|
// prediction is on our side.
|
|
|
|
if (complex){
|
2011-02-03 14:14:09 +00:00
|
|
|
// manually unrolled because continue wouldn't work as desired in an inner loop,
|
|
|
|
// also because some compilers seem to fail the task. Colors and UV coords
|
|
|
|
// are interleaved since the higher entries are most likely to be
|
|
|
|
// zero and thus useless. By interleaving the arrays, vertices are,
|
|
|
|
// on average, rejected earlier.
|
|
|
|
|
|
|
|
if( (uv.texcoords[1] - v.texcoords[1]).SquareLength() > squareEpsilon)
|
|
|
|
continue;
|
2010-01-28 21:17:25 +00:00
|
|
|
if( GetColorDifference( uv.colors[0], v.colors[0]) > squareEpsilon)
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
continue;
|
2011-02-03 14:14:09 +00:00
|
|
|
|
|
|
|
if( (uv.texcoords[2] - v.texcoords[2]).SquareLength() > squareEpsilon)
|
|
|
|
continue;
|
2010-01-28 21:17:25 +00:00
|
|
|
if( GetColorDifference( uv.colors[1], v.colors[1]) > squareEpsilon)
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
continue;
|
2011-02-03 14:14:09 +00:00
|
|
|
|
|
|
|
if( (uv.texcoords[3] - v.texcoords[3]).SquareLength() > squareEpsilon)
|
|
|
|
continue;
|
2010-01-28 21:17:25 +00:00
|
|
|
if( GetColorDifference( uv.colors[2], v.colors[2]) > squareEpsilon)
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
continue;
|
2011-02-03 14:14:09 +00:00
|
|
|
|
|
|
|
if( (uv.texcoords[4] - v.texcoords[4]).SquareLength() > squareEpsilon)
|
|
|
|
continue;
|
2010-01-28 21:17:25 +00:00
|
|
|
if( GetColorDifference( uv.colors[3], v.colors[3]) > squareEpsilon)
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
continue;
|
|
|
|
|
2011-02-03 14:14:09 +00:00
|
|
|
if( (uv.texcoords[5] - v.texcoords[5]).SquareLength() > squareEpsilon)
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
continue;
|
2011-02-03 14:14:09 +00:00
|
|
|
if( GetColorDifference( uv.colors[4], v.colors[4]) > squareEpsilon)
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
continue;
|
2011-02-03 14:14:09 +00:00
|
|
|
|
|
|
|
if( (uv.texcoords[6] - v.texcoords[6]).SquareLength() > squareEpsilon)
|
|
|
|
continue;
|
|
|
|
if( GetColorDifference( uv.colors[5], v.colors[5]) > squareEpsilon)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( (uv.texcoords[7] - v.texcoords[7]).SquareLength() > squareEpsilon)
|
|
|
|
continue;
|
|
|
|
if( GetColorDifference( uv.colors[6], v.colors[6]) > squareEpsilon)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( GetColorDifference( uv.colors[7], v.colors[7]) > squareEpsilon)
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
continue;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// we're still here -> this vertex perfectly matches our given vertex
|
|
|
|
matchIndex = uidx;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// found a replacement vertex among the uniques?
|
|
|
|
if( matchIndex != 0xffffffff)
|
|
|
|
{
|
|
|
|
// store where to found the matching unique vertex
|
2010-07-11 23:07:11 +00:00
|
|
|
replaceIndex[a] = matchIndex | 0x80000000;
|
2008-09-27 16:46:05 +00:00
|
|
|
}
|
|
|
|
else
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
// no unique vertex matches it upto now -> so add it
|
2008-06-01 12:46:17 +00:00
|
|
|
replaceIndex[a] = (unsigned int)uniqueVertices.size();
|
2008-05-05 12:36:31 +00:00
|
|
|
uniqueVertices.push_back( v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-28 21:17:25 +00:00
|
|
|
if (!DefaultLogger::isNullLogger() && DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
|
2010-05-10 13:59:29 +00:00
|
|
|
DefaultLogger::get()->debug((Formatter::format(),
|
|
|
|
"Mesh ",meshIndex,
|
|
|
|
" (",
|
|
|
|
(pMesh->mName.length ? pMesh->mName.data : "unnamed"),
|
|
|
|
") | Verts in: ",pMesh->mNumVertices,
|
|
|
|
" out: ",
|
|
|
|
uniqueVertices.size(),
|
|
|
|
" | ~",
|
|
|
|
((pMesh->mNumVertices - uniqueVertices.size()) / (float)pMesh->mNumVertices) * 100.f,
|
|
|
|
"%"
|
|
|
|
));
|
2008-07-30 23:00:25 +00:00
|
|
|
}
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// replace vertex data with the unique data sets
|
2008-06-01 12:46:17 +00:00
|
|
|
pMesh->mNumVertices = (unsigned int)uniqueVertices.size();
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
2010-01-28 21:17:25 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// NOTE - we're *not* calling Vertex::SortBack() because it would check for
|
|
|
|
// presence of every single vertex component once PER VERTEX. And our CPU
|
|
|
|
// dislikes branches, even if they're easily predictable.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// Position
|
|
|
|
delete [] pMesh->mVertices;
|
|
|
|
pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
|
|
|
|
for( unsigned int a = 0; a < pMesh->mNumVertices; a++)
|
2010-01-28 21:17:25 +00:00
|
|
|
pMesh->mVertices[a] = uniqueVertices[a].position;
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// Normals, if present
|
|
|
|
if( pMesh->mNormals)
|
|
|
|
{
|
|
|
|
delete [] pMesh->mNormals;
|
|
|
|
pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
|
2010-01-28 21:17:25 +00:00
|
|
|
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
|
|
|
pMesh->mNormals[a] = uniqueVertices[a].normal;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
// Tangents, if present
|
|
|
|
if( pMesh->mTangents)
|
|
|
|
{
|
|
|
|
delete [] pMesh->mTangents;
|
|
|
|
pMesh->mTangents = new aiVector3D[pMesh->mNumVertices];
|
2010-01-28 21:17:25 +00:00
|
|
|
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
|
|
|
pMesh->mTangents[a] = uniqueVertices[a].tangent;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
// Bitangents as well
|
|
|
|
if( pMesh->mBitangents)
|
|
|
|
{
|
|
|
|
delete [] pMesh->mBitangents;
|
|
|
|
pMesh->mBitangents = new aiVector3D[pMesh->mNumVertices];
|
2010-01-28 21:17:25 +00:00
|
|
|
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) {
|
|
|
|
pMesh->mBitangents[a] = uniqueVertices[a].bitangent;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
// Vertex colors
|
2010-01-28 21:17:25 +00:00
|
|
|
for( unsigned int a = 0; pMesh->HasVertexColors(a); a++)
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
delete [] pMesh->mColors[a];
|
|
|
|
pMesh->mColors[a] = new aiColor4D[pMesh->mNumVertices];
|
2010-01-28 21:17:25 +00:00
|
|
|
for( unsigned int b = 0; b < pMesh->mNumVertices; b++) {
|
|
|
|
pMesh->mColors[a][b] = uniqueVertices[b].colors[a];
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
// Texture coords
|
2010-01-28 21:17:25 +00:00
|
|
|
for( unsigned int a = 0; pMesh->HasTextureCoords(a); a++)
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
delete [] pMesh->mTextureCoords[a];
|
|
|
|
pMesh->mTextureCoords[a] = new aiVector3D[pMesh->mNumVertices];
|
2010-01-28 21:17:25 +00:00
|
|
|
for( unsigned int b = 0; b < pMesh->mNumVertices; b++) {
|
|
|
|
pMesh->mTextureCoords[a][b] = uniqueVertices[b].texcoords[a];
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// adjust the indices in all faces
|
|
|
|
for( unsigned int a = 0; a < pMesh->mNumFaces; a++)
|
|
|
|
{
|
|
|
|
aiFace& face = pMesh->mFaces[a];
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
for( unsigned int b = 0; b < face.mNumIndices; b++) {
|
2010-07-11 23:07:11 +00:00
|
|
|
face.mIndices[b] = replaceIndex[face.mIndices[b]] & ~0x80000000;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// adjust bone vertex weights.
|
2009-03-11 22:56:16 +00:00
|
|
|
for( int a = 0; a < (int)pMesh->mNumBones; a++)
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
aiBone* bone = pMesh->mBones[a];
|
|
|
|
std::vector<aiVertexWeight> newWeights;
|
|
|
|
newWeights.reserve( bone->mNumWeights);
|
|
|
|
|
|
|
|
for( unsigned int b = 0; b < bone->mNumWeights; b++)
|
|
|
|
{
|
|
|
|
const aiVertexWeight& ow = bone->mWeights[b];
|
|
|
|
// if the vertex is a unique one, translate it
|
2010-07-11 23:07:11 +00:00
|
|
|
if( !(replaceIndex[ow.mVertexId] & 0x80000000))
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
aiVertexWeight nw;
|
|
|
|
nw.mVertexId = replaceIndex[ow.mVertexId];
|
|
|
|
nw.mWeight = ow.mWeight;
|
|
|
|
newWeights.push_back( nw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-11 22:56:16 +00:00
|
|
|
if (newWeights.size() > 0) {
|
|
|
|
// kill the old and replace them with the translated weights
|
|
|
|
delete [] bone->mWeights;
|
|
|
|
bone->mNumWeights = (unsigned int)newWeights.size();
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-03-11 22:56:16 +00:00
|
|
|
bone->mWeights = new aiVertexWeight[bone->mNumWeights];
|
|
|
|
memcpy( bone->mWeights, &newWeights[0], bone->mNumWeights * sizeof( aiVertexWeight));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
/* NOTE:
|
|
|
|
*
|
|
|
|
* In the algorithm above we're assuming that there are no vertices
|
|
|
|
* with a different bone weight setup at the same position. That wouldn't
|
|
|
|
* make sense, but it is not absolutely impossible. SkeletonMeshBuilder
|
|
|
|
* for example generates such input data if two skeleton points
|
|
|
|
* share the same position. Again this doesn't make sense but is
|
|
|
|
* reality for some model formats (MD5 for example uses these special
|
|
|
|
* nodes as attachment tags for its weapons).
|
|
|
|
*
|
|
|
|
* Then it is possible that a bone has no weights anymore .... as a quick
|
|
|
|
* workaround, we're just removing these bones. If they're animated,
|
|
|
|
* model geometry might be modified but at least there's no risk of a crash.
|
|
|
|
*/
|
|
|
|
delete bone;
|
|
|
|
--pMesh->mNumBones;
|
2010-01-28 21:17:25 +00:00
|
|
|
for (unsigned int n = a; n < pMesh->mNumBones; ++n) {
|
2009-03-11 22:56:16 +00:00
|
|
|
pMesh->mBones[n] = pMesh->mBones[n+1];
|
2010-01-28 21:17:25 +00:00
|
|
|
}
|
2009-03-11 22:56:16 +00:00
|
|
|
|
|
|
|
--a;
|
|
|
|
DefaultLogger::get()->warn("Removing bone -> no weights remaining");
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-07-30 23:00:25 +00:00
|
|
|
return pMesh->mNumVertices;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2009-04-24 20:53:24 +00:00
|
|
|
|
2009-08-18 16:17:27 +00:00
|
|
|
#endif // !! ASSIMP_BUILD_NO_JOINVERTICES_PROCESS
|