2008-05-09 17:24:28 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
2008-05-22 10:20:31 +00:00
|
|
|
Open Asset Import Library (ASSIMP)
|
2008-05-09 17:24:28 +00:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Copyright (c) 2006-2008, ASSIMP Development Team
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
* Neither the name of the ASSIMP team, nor the names of its
|
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
|
|
|
written permission of the ASSIMP Development Team.
|
|
|
|
|
|
|
|
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 CPP-API class #Importer */
|
2008-07-22 22:52:16 +00:00
|
|
|
|
2008-10-13 16:45:48 +00:00
|
|
|
#include "AssimpPCH.h"
|
2008-05-05 12:36:31 +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
|
|
|
/* Uncomment this line to prevent Assimp from catching unknown exceptions.
|
|
|
|
*
|
|
|
|
* Note that any Exception except ImportErrorException may lead to
|
|
|
|
* undefined behaviour -> loaders could remain in an unusable state and
|
|
|
|
* further imports with the same Importer instance could fail/crash/burn ...
|
|
|
|
*/
|
|
|
|
#define ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// =======================================================================================
|
|
|
|
// Internal headers
|
|
|
|
// =======================================================================================
|
2008-05-05 12:36:31 +00:00
|
|
|
#include "BaseImporter.h"
|
|
|
|
#include "BaseProcess.h"
|
|
|
|
#include "DefaultIOStream.h"
|
|
|
|
#include "DefaultIOSystem.h"
|
2008-08-28 17:35:36 +00:00
|
|
|
#include "GenericProperty.h"
|
2008-09-27 16:46:05 +00:00
|
|
|
#include "ProcessHelper.h"
|
2008-11-02 16:58:31 +00:00
|
|
|
#include "ScenePreprocessor.h"
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// =======================================================================================
|
2008-06-22 10:09:26 +00:00
|
|
|
// Importers
|
2009-01-12 22:06:54 +00:00
|
|
|
// =======================================================================================
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_X_IMPORTER
|
2008-05-09 17:24:28 +00:00
|
|
|
# include "XFileImporter.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_3DS_IMPORTER
|
2008-05-09 17:24:28 +00:00
|
|
|
# include "3DSLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_MD3_IMPORTER
|
2008-05-09 17:24:28 +00:00
|
|
|
# include "MD3Loader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_MDL_IMPORTER
|
2008-05-09 17:24:28 +00:00
|
|
|
# include "MDLLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_MD2_IMPORTER
|
2008-05-09 17:24:28 +00:00
|
|
|
# include "MD2Loader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_PLY_IMPORTER
|
2008-05-09 17:24:28 +00:00
|
|
|
# include "PlyLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_ASE_IMPORTER
|
2008-05-09 17:24:28 +00:00
|
|
|
# include "ASELoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_OBJ_IMPORTER
|
2008-05-09 17:24:28 +00:00
|
|
|
# include "ObjFileImporter.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_HMP_IMPORTER
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "HMPLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_SMD_IMPORTER
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "SMDLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_MDC_IMPORTER
|
2008-08-08 11:53:48 +00:00
|
|
|
# include "MDCLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_MD5_IMPORTER
|
2008-08-08 11:53:48 +00:00
|
|
|
# include "MD5Loader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_STL_IMPORTER
|
2008-08-06 23:01:38 +00:00
|
|
|
# include "STLLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_LWO_IMPORTER
|
2008-08-07 22:27:17 +00:00
|
|
|
# include "LWOLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_DXF_IMPORTER
|
2008-09-05 13:21:01 +00:00
|
|
|
# include "DXFLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_NFF_IMPORTER
|
2008-09-07 16:51:05 +00:00
|
|
|
# include "NFFLoader.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_RAW_IMPORTER
|
2008-10-19 19:51:24 +00:00
|
|
|
# include "RawLoader.h"
|
2008-09-16 16:17:32 +00:00
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_OFF_IMPORTER
|
2008-10-19 19:51:24 +00:00
|
|
|
# include "OFFLoader.h"
|
2008-09-16 16:17:32 +00:00
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_AC_IMPORTER
|
|
|
|
# include "ACLoader.h"
|
|
|
|
#endif
|
2008-10-15 16:12:18 +00:00
|
|
|
#ifndef AI_BUILD_NO_BVH_IMPORTER
|
|
|
|
# include "BVHLoader.h"
|
|
|
|
#endif
|
2008-10-24 20:37:54 +00:00
|
|
|
#ifndef AI_BUILD_NO_IRRMESH_IMPORTER
|
|
|
|
# include "IRRMeshLoader.h"
|
|
|
|
#endif
|
2008-10-27 00:36:26 +00:00
|
|
|
#ifndef AI_BUILD_NO_IRR_IMPORTER
|
|
|
|
# include "IRRLoader.h"
|
|
|
|
#endif
|
2008-11-01 15:14:00 +00:00
|
|
|
#ifndef AI_BUILD_NO_Q3D_IMPORTER
|
|
|
|
# include "Q3DLoader.h"
|
|
|
|
#endif
|
2008-11-04 20:41:11 +00:00
|
|
|
#ifndef AI_BUILD_NO_B3D_IMPORTER
|
|
|
|
# include "B3DImporter.h"
|
|
|
|
#endif
|
2008-11-12 17:07:44 +00:00
|
|
|
#ifndef AI_BUILD_NO_COLLADA_IMPORTER
|
|
|
|
# include "ColladaLoader.h"
|
|
|
|
#endif
|
2009-01-09 21:29:54 +00:00
|
|
|
#ifndef AI_BUILD_NO_TERRAGEN_IMPORTER
|
|
|
|
# include "TerragenLoader.h"
|
|
|
|
#endif
|
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
|
|
|
//#ifndef AI_BUILD_NO_CSM_IMPORTER
|
|
|
|
//# include "CSMLoader.h"
|
|
|
|
//#endif
|
|
|
|
#ifndef AI_BUILD_NO_3D_IMPORTER
|
|
|
|
# include "UnrealLoader.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef AI_BUILD_NO_LWS_IMPORTER
|
|
|
|
# include "LWSLoader.h"
|
|
|
|
#endif
|
|
|
|
|
2008-08-08 11:53:48 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// =======================================================================================
|
2008-06-22 10:09:26 +00:00
|
|
|
// PostProcess-Steps
|
2009-01-12 22:06:54 +00:00
|
|
|
// =======================================================================================
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_CALCTANGENTS_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "CalcTangentsProcess.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_JOINVERTICES_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "JoinVerticesProcess.h"
|
|
|
|
#endif
|
2009-03-15 00:40:30 +00:00
|
|
|
#if !(defined AI_BUILD_NO_MAKELEFTHANDED_PROCESS && defined AI_BUILD_NO_FLIPUVS_PROCESS && defined AI_BUILD_NO_FLIPWINDINGORDER_PROCESS)
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "ConvertToLHProcess.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_TRIANGULATE_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "TriangulateProcess.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_GENFACENORMALS_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "GenFaceNormalsProcess.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_GENVERTEXNORMALS_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "GenVertexNormalsProcess.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_REMOVEVC_PROCESS
|
2008-10-02 15:22:38 +00:00
|
|
|
# include "RemoveVCProcess.h"
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_SPLITLARGEMESHES_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "SplitLargeMeshes.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_PRETRANSFORMVERTICES_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "PretransformVertices.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_LIMITBONEWEIGHTS_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "LimitBoneWeightsProcess.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "ValidateDataStructure.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_IMPROVECACHELOCALITY_PROCESS
|
2008-07-22 22:52:16 +00:00
|
|
|
# include "ImproveCacheLocality.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_FIXINFACINGNORMALS_PROCESS
|
2008-08-08 11:53:48 +00:00
|
|
|
# include "FixNormalsStep.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS
|
2008-07-30 23:00:25 +00:00
|
|
|
# include "RemoveRedundantMaterials.h"
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#ifndef AI_BUILD_NO_FINDINVALIDDATA_PROCESS
|
|
|
|
# include "FindInvalidDataProcess.h"
|
2008-09-30 20:20:56 +00:00
|
|
|
#endif
|
2008-10-22 20:06:16 +00:00
|
|
|
#ifndef AI_BUILD_NO_FINDDEGENERATES_PROCESS
|
|
|
|
# include "FindDegenerates.h"
|
|
|
|
#endif
|
2008-11-04 20:41:11 +00:00
|
|
|
#ifndef AI_BUILD_NO_SORTBYPTYPE_PROCESS
|
2008-10-13 16:45:48 +00:00
|
|
|
# include "SortByPTypeProcess.h"
|
2008-11-04 20:41:11 +00:00
|
|
|
#endif
|
2008-11-16 21:56:45 +00:00
|
|
|
#ifndef AI_BUILD_NO_GENUVCOORDS_PROCESS
|
|
|
|
# include "ComputeUVMappingProcess.h"
|
|
|
|
#endif
|
|
|
|
#ifndef AI_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
|
|
|
|
# include "TextureTransform.h"
|
|
|
|
#endif
|
2009-02-02 20:29:27 +00:00
|
|
|
#ifndef AI_BUILD_NO_FINDINSTANCES_PROCESS
|
|
|
|
# include "FindInstancesProcess.h"
|
|
|
|
#endif
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2008-10-19 11:32:33 +00:00
|
|
|
using namespace Assimp;
|
2009-01-12 22:06:54 +00:00
|
|
|
using namespace Assimp::Intern;
|
|
|
|
|
|
|
|
// =======================================================================================
|
|
|
|
// Intern::AllocateFromAssimpHeap serves as abstract base class. It overrides
|
|
|
|
// new and delete (and their array counterparts) of public API classes (e.g. Logger) to
|
|
|
|
// utilize our DLL heap
|
|
|
|
// =======================================================================================
|
|
|
|
void* AllocateFromAssimpHeap::operator new ( size_t num_bytes)
|
|
|
|
{
|
|
|
|
return ::operator new(num_bytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AllocateFromAssimpHeap::operator delete ( void* data)
|
|
|
|
{
|
|
|
|
return ::operator delete(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void* AllocateFromAssimpHeap::operator new[] ( size_t num_bytes)
|
|
|
|
{
|
|
|
|
return ::operator new[](num_bytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AllocateFromAssimpHeap::operator delete[] ( void* data)
|
|
|
|
{
|
|
|
|
return ::operator delete[](data);
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Importer Constructor.
|
|
|
|
Importer::Importer()
|
|
|
|
: mIOHandler (NULL)
|
|
|
|
, mScene (NULL)
|
|
|
|
, mErrorString ("")
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2009-01-09 21:29:54 +00:00
|
|
|
// Allocate a default IO handler
|
2008-05-05 12:36:31 +00:00
|
|
|
mIOHandler = new DefaultIOSystem;
|
2008-07-30 23:00:25 +00:00
|
|
|
mIsDefaultHandler = true;
|
2008-09-27 16:46:05 +00:00
|
|
|
bExtraVerbose = false; // disable extra verbose mode by default
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ======================================================================
|
2009-01-09 21:29:54 +00:00
|
|
|
// Add an instance of each worker class here
|
2009-01-12 22:06:54 +00:00
|
|
|
// The order doesn't really care, however file formats that are
|
2008-08-28 17:35:36 +00:00
|
|
|
// used more frequently than others should be at the beginning.
|
2009-01-12 22:06:54 +00:00
|
|
|
// ======================================================================
|
2008-09-27 16:46:05 +00:00
|
|
|
mImporter.reserve(25);
|
2008-08-28 17:35:36 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
#if (!defined AI_BUILD_NO_X_IMPORTER)
|
2008-05-05 12:36:31 +00:00
|
|
|
mImporter.push_back( new XFileImporter());
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_OBJ_IMPORTER)
|
2008-05-05 12:36:31 +00:00
|
|
|
mImporter.push_back( new ObjFileImporter());
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_3DS_IMPORTER)
|
2008-10-31 19:32:00 +00:00
|
|
|
mImporter.push_back( new Discreet3DSImporter());
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_MD3_IMPORTER)
|
2008-05-05 12:36:31 +00:00
|
|
|
mImporter.push_back( new MD3Importer());
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_MD2_IMPORTER)
|
2008-05-05 12:36:31 +00:00
|
|
|
mImporter.push_back( new MD2Importer());
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_PLY_IMPORTER)
|
2008-05-05 12:36:31 +00:00
|
|
|
mImporter.push_back( new PLYImporter());
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_MDL_IMPORTER)
|
|
|
|
mImporter.push_back( new MDLImporter());
|
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_ASE_IMPORTER)
|
|
|
|
mImporter.push_back( new ASEImporter());
|
|
|
|
#endif
|
2008-08-06 23:01:38 +00:00
|
|
|
#if (!defined AI_BUILD_NO_HMP_IMPORTER)
|
2008-06-22 10:09:26 +00:00
|
|
|
mImporter.push_back( new HMPImporter());
|
|
|
|
#endif
|
2008-08-06 23:01:38 +00:00
|
|
|
#if (!defined AI_BUILD_NO_SMD_IMPORTER)
|
2008-06-22 10:09:26 +00:00
|
|
|
mImporter.push_back( new SMDImporter());
|
|
|
|
#endif
|
2008-08-08 11:53:48 +00:00
|
|
|
#if (!defined AI_BUILD_NO_MDC_IMPORTER)
|
|
|
|
mImporter.push_back( new MDCImporter());
|
|
|
|
#endif
|
2008-08-06 23:01:38 +00:00
|
|
|
#if (!defined AI_BUILD_NO_MD5_IMPORTER)
|
|
|
|
mImporter.push_back( new MD5Importer());
|
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_STL_IMPORTER)
|
|
|
|
mImporter.push_back( new STLImporter());
|
|
|
|
#endif
|
2008-08-07 22:27:17 +00:00
|
|
|
#if (!defined AI_BUILD_NO_LWO_IMPORTER)
|
|
|
|
mImporter.push_back( new LWOImporter());
|
|
|
|
#endif
|
2008-09-05 13:21:01 +00:00
|
|
|
#if (!defined AI_BUILD_NO_DXF_IMPORTER)
|
|
|
|
mImporter.push_back( new DXFImporter());
|
|
|
|
#endif
|
2008-09-07 16:51:05 +00:00
|
|
|
#if (!defined AI_BUILD_NO_NFF_IMPORTER)
|
|
|
|
mImporter.push_back( new NFFImporter());
|
|
|
|
#endif
|
2008-09-16 16:17:32 +00:00
|
|
|
#if (!defined AI_BUILD_NO_RAW_IMPORTER)
|
|
|
|
mImporter.push_back( new RAWImporter());
|
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_OFF_IMPORTER)
|
|
|
|
mImporter.push_back( new OFFImporter());
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
#if (!defined AI_BUILD_NO_AC_IMPORTER)
|
|
|
|
mImporter.push_back( new AC3DImporter());
|
|
|
|
#endif
|
2008-10-15 16:12:18 +00:00
|
|
|
#if (!defined AI_BUILD_NO_BVH_IMPORTER)
|
|
|
|
mImporter.push_back( new BVHLoader());
|
|
|
|
#endif
|
2008-10-24 20:37:54 +00:00
|
|
|
#if (!defined AI_BUILD_NO_IRRMESH_IMPORTER)
|
|
|
|
mImporter.push_back( new IRRMeshImporter());
|
|
|
|
#endif
|
2008-10-27 00:36:26 +00:00
|
|
|
#if (!defined AI_BUILD_NO_IRR_IMPORTER)
|
|
|
|
mImporter.push_back( new IRRImporter());
|
|
|
|
#endif
|
2008-11-01 15:14:00 +00:00
|
|
|
#if (!defined AI_BUILD_NO_Q3D_IMPORTER)
|
|
|
|
mImporter.push_back( new Q3DImporter());
|
|
|
|
#endif
|
2008-11-04 20:41:11 +00:00
|
|
|
#if (!defined AI_BUILD_NO_B3D_IMPORTER)
|
|
|
|
mImporter.push_back( new B3DImporter());
|
|
|
|
#endif
|
2008-11-12 17:07:44 +00:00
|
|
|
#if (!defined AI_BUILD_NO_COLLADA_IMPORTER)
|
|
|
|
mImporter.push_back( new ColladaLoader());
|
|
|
|
#endif
|
2009-01-09 21:29:54 +00:00
|
|
|
#if (!defined AI_BUILD_NO_TERRAGEN_IMPORTER)
|
|
|
|
mImporter.push_back( new TerragenImporter());
|
|
|
|
#endif
|
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 (!defined AI_BUILD_NO_CSM_IMPORTER)
|
|
|
|
// mImporter.push_back( new CSMImporter());
|
|
|
|
//#endif
|
|
|
|
#if (!defined AI_BUILD_NO_3D_IMPORTER)
|
|
|
|
mImporter.push_back( new UnrealImporter());
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if (!defined AI_BUILD_NO_LWS_IMPORTER)
|
|
|
|
mImporter.push_back( new LWSImporter());
|
|
|
|
#endif
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ======================================================================
|
2008-11-16 21:56:45 +00:00
|
|
|
// Add an instance of each post processing step here in the order
|
2009-01-12 22:06:54 +00:00
|
|
|
// of sequence it is executed. Steps that are added here are not
|
|
|
|
// validated - as RegisterPPStep() does - all dependencies must be there.
|
|
|
|
// ======================================================================
|
2008-09-27 16:46:05 +00:00
|
|
|
mPostProcessingSteps.reserve(25);
|
2008-08-28 17:35:36 +00:00
|
|
|
|
2009-02-02 20:37:35 +00:00
|
|
|
#if (!defined AI_BUILD_NO_REMOVEVC_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new RemoveVCProcess());
|
|
|
|
#endif
|
|
|
|
|
2009-02-02 20:29:27 +00:00
|
|
|
#if (!defined AI_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new RemoveRedundantMatsProcess());
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (!defined AI_BUILD_NO_FINDINSTANCES_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new FindInstancesProcess());
|
|
|
|
#endif
|
|
|
|
|
2008-10-22 20:06:16 +00:00
|
|
|
#if (!defined AI_BUILD_NO_FINDDEGENERATES_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new FindDegeneratesProcess());
|
|
|
|
#endif
|
|
|
|
|
2009-03-26 22:05:56 +00:00
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
|
|
#ifndef AI_BUILD_NO_GENUVCOORDS_PROCESS
|
|
|
|
mPostProcessingSteps.push_back( new ComputeUVMappingProcess());
|
|
|
|
#endif
|
|
|
|
#ifndef AI_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
|
|
|
|
mPostProcessingSteps.push_back( new TextureTransformStep());
|
|
|
|
#endif
|
|
|
|
|
2008-10-19 11:32:33 +00:00
|
|
|
#if (!defined AI_BUILD_NO_PRETRANSFORMVERTICES_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new PretransformVertices());
|
|
|
|
#endif
|
2008-06-22 10:09:26 +00:00
|
|
|
#if (!defined AI_BUILD_NO_TRIANGULATE_PROCESS)
|
2008-05-05 12:36:31 +00:00
|
|
|
mPostProcessingSteps.push_back( new TriangulateProcess());
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
2009-03-26 22:05:56 +00:00
|
|
|
|
2008-09-30 20:20:56 +00:00
|
|
|
#if (!defined AI_BUILD_NO_SORTBYPTYPE_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new SortByPTypeProcess());
|
|
|
|
#endif
|
2008-10-13 16:45:48 +00:00
|
|
|
|
|
|
|
#if (!defined AI_BUILD_NO_FINDINVALIDDATA_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new FindInvalidDataProcess());
|
|
|
|
#endif
|
|
|
|
|
2008-08-08 11:53:48 +00:00
|
|
|
#if (!defined AI_BUILD_NO_FIXINFACINGNORMALS_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new FixInfacingNormalsProcess());
|
|
|
|
#endif
|
2008-06-22 10:09:26 +00:00
|
|
|
#if (!defined AI_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
2008-05-09 17:24:28 +00:00
|
|
|
mPostProcessingSteps.push_back( new SplitLargeMeshesProcess_Triangle());
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_GENFACENORMALS_PROCESS)
|
2008-05-05 12:36:31 +00:00
|
|
|
mPostProcessingSteps.push_back( new GenFaceNormalsProcess());
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
2008-09-27 16:46:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
// DON'T change the order of these five!
|
|
|
|
mPostProcessingSteps.push_back( new ComputeSpatialSortProcess());
|
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
#if (!defined AI_BUILD_NO_GENVERTEXNORMALS_PROCESS)
|
2008-05-05 12:36:31 +00:00
|
|
|
mPostProcessingSteps.push_back( new GenVertexNormalsProcess());
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_CALCTANGENTS_PROCESS)
|
2008-05-05 12:36:31 +00:00
|
|
|
mPostProcessingSteps.push_back( new CalcTangentsProcess());
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_JOINVERTICES_PROCESS)
|
2008-05-05 12:36:31 +00:00
|
|
|
mPostProcessingSteps.push_back( new JoinVerticesProcess());
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
2008-09-27 16:46:05 +00:00
|
|
|
|
|
|
|
mPostProcessingSteps.push_back( new DestroySpatialSortProcess());
|
|
|
|
|
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
#if (!defined AI_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
2008-05-09 17:24:28 +00:00
|
|
|
mPostProcessingSteps.push_back( new SplitLargeMeshesProcess_Vertex());
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
2009-03-15 00:40:30 +00:00
|
|
|
#if (!defined AI_BUILD_NO_MAKELEFTHANDED_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new MakeLeftHandedProcess());
|
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_FLIPUVS_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new FlipUVsProcess());
|
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_FLIPWINDINGORDER_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new FlipWindingOrderProcess());
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
|
|
|
#if (!defined AI_BUILD_NO_LIMITBONEWEIGHTS_PROCESS)
|
2008-06-07 23:21:36 +00:00
|
|
|
mPostProcessingSteps.push_back( new LimitBoneWeightsProcess());
|
2008-06-22 10:09:26 +00:00
|
|
|
#endif
|
2008-07-22 22:52:16 +00:00
|
|
|
#if (!defined AI_BUILD_NO_IMPROVECACHELOCALITY_PROCESS)
|
|
|
|
mPostProcessingSteps.push_back( new ImproveCacheLocalityProcess());
|
|
|
|
#endif
|
2008-09-27 16:46:05 +00:00
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Allocate a SharedPostProcessInfo object and store pointers to it
|
2008-09-27 16:46:05 +00:00
|
|
|
// in all post-process steps in the list.
|
|
|
|
mPPShared = new SharedPostProcessInfo();
|
|
|
|
for (std::vector<BaseProcess*>::iterator it = mPostProcessingSteps.begin(),
|
|
|
|
end = mPostProcessingSteps.end(); it != end; ++it)
|
|
|
|
{
|
|
|
|
(*it)->SetSharedData(mPPShared);
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Destructor.
|
|
|
|
Importer::~Importer()
|
|
|
|
{
|
2009-01-12 22:06:54 +00:00
|
|
|
// Delete all import plugins
|
2008-05-05 12:36:31 +00:00
|
|
|
for( unsigned int a = 0; a < mImporter.size(); a++)
|
|
|
|
delete mImporter[a];
|
2009-01-12 22:06:54 +00:00
|
|
|
|
|
|
|
// Delete all post-processing plug-ins
|
2008-05-05 12:36:31 +00:00
|
|
|
for( unsigned int a = 0; a < mPostProcessingSteps.size(); a++)
|
|
|
|
delete mPostProcessingSteps[a];
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Delete the assigned IO handler
|
2008-05-05 12:36:31 +00:00
|
|
|
delete mIOHandler;
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Kill imported scene. Destructors should do that recursivly
|
2008-05-05 12:36:31 +00:00
|
|
|
delete mScene;
|
2008-09-27 16:46:05 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Delete shared post-processing data
|
2008-09-27 16:46:05 +00:00
|
|
|
delete mPPShared;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2008-08-11 17:49:02 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Copy constructor - copies the config of another Importer, not the scene
|
2008-08-11 17:49:02 +00:00
|
|
|
Importer::Importer(const Importer &other)
|
|
|
|
{
|
2009-01-12 22:06:54 +00:00
|
|
|
// Call the default constructor
|
|
|
|
new(this) Importer();
|
|
|
|
|
|
|
|
// Copy the property table
|
|
|
|
mIntProperties = other.mIntProperties;
|
|
|
|
mFloatProperties = other.mFloatProperties;
|
|
|
|
mStringProperties = other.mStringProperties;
|
2008-08-11 17:49:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Register a custom loader plugin
|
2008-08-11 17:49:02 +00:00
|
|
|
aiReturn Importer::RegisterLoader(BaseImporter* pImp)
|
|
|
|
{
|
|
|
|
ai_assert(NULL != pImp);
|
2009-01-12 22:06:54 +00:00
|
|
|
// ======================================================================
|
|
|
|
// Check whether we would have two loaders for the same file extension
|
2008-11-16 21:56:45 +00:00
|
|
|
// This is absolutely OK, but we should warn the developer of the new
|
|
|
|
// loader that his code will propably never be called.
|
2009-01-12 22:06:54 +00:00
|
|
|
// ======================================================================
|
2008-08-11 17:49:02 +00:00
|
|
|
std::string st;
|
|
|
|
pImp->GetExtensionList(st);
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
2008-08-11 20:57:18 +00:00
|
|
|
const char* sz = ::strtok(const_cast<char*>(st.c_str()),";");
|
2008-08-11 17:49:02 +00:00
|
|
|
while (sz)
|
|
|
|
{
|
|
|
|
if (IsExtensionSupported(std::string(sz)))
|
2008-11-16 21:56:45 +00:00
|
|
|
DefaultLogger::get()->warn(std::string( "The file extension " ) + sz + " is already in use");
|
2009-01-12 22:06:54 +00:00
|
|
|
|
2008-08-11 17:49:02 +00:00
|
|
|
sz = ::strtok(NULL,";");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// add the loader
|
2008-11-16 21:56:45 +00:00
|
|
|
mImporter.push_back(pImp);
|
2008-08-11 17:49:02 +00:00
|
|
|
DefaultLogger::get()->info("Registering custom importer: " + st);
|
|
|
|
return AI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Unregister a custom loader
|
2008-08-11 17:49:02 +00:00
|
|
|
aiReturn Importer::UnregisterLoader(BaseImporter* pImp)
|
|
|
|
{
|
|
|
|
ai_assert(NULL != pImp);
|
|
|
|
for (std::vector<BaseImporter*>::iterator
|
|
|
|
it = mImporter.begin(),end = mImporter.end();
|
|
|
|
it != end;++it)
|
|
|
|
{
|
|
|
|
if (pImp == (*it))
|
|
|
|
{
|
|
|
|
mImporter.erase(it);
|
|
|
|
|
|
|
|
std::string st;
|
|
|
|
pImp->GetExtensionList(st);
|
|
|
|
DefaultLogger::get()->info("Unregistering custom importer: " + st);
|
|
|
|
return AI_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DefaultLogger::get()->warn("Unable to remove importer: importer not found");
|
|
|
|
return AI_FAILURE;
|
|
|
|
}
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Supplies a custom IO handler to the importer to open and access files.
|
|
|
|
void Importer::SetIOHandler( IOSystem* pIOHandler)
|
|
|
|
{
|
2009-01-12 22:06:54 +00:00
|
|
|
// If the new handler is zero, allocate a default IO implementation.
|
2008-06-22 10:09:26 +00:00
|
|
|
if (!pIOHandler)
|
2008-05-09 17:24:28 +00:00
|
|
|
{
|
|
|
|
delete mIOHandler;
|
|
|
|
mIOHandler = new DefaultIOSystem();
|
2008-06-22 10:09:26 +00:00
|
|
|
mIsDefaultHandler = true;
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
2009-01-12 22:06:54 +00:00
|
|
|
// Otherwise register the custom handler
|
2008-05-09 17:24:28 +00:00
|
|
|
else if (mIOHandler != pIOHandler)
|
|
|
|
{
|
|
|
|
delete mIOHandler;
|
|
|
|
mIOHandler = pIOHandler;
|
2008-06-22 10:09:26 +00:00
|
|
|
mIsDefaultHandler = false;
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
|
|
|
return;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-05-22 22:47:20 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
IOSystem* Importer::GetIOHandler()
|
|
|
|
{
|
|
|
|
return mIOHandler;
|
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool Importer::IsDefaultIOHandler()
|
|
|
|
{
|
|
|
|
return mIsDefaultHandler;
|
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-05-22 22:47:20 +00:00
|
|
|
// Validate post process step flags
|
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
|
|
|
bool _ValidateFlags(unsigned int pFlags)
|
2008-05-22 22:47:20 +00:00
|
|
|
{
|
|
|
|
if (pFlags & aiProcess_GenSmoothNormals &&
|
|
|
|
pFlags & aiProcess_GenNormals)
|
|
|
|
{
|
2008-08-28 17:35:36 +00:00
|
|
|
DefaultLogger::get()->error("aiProcess_GenSmoothNormals and "
|
|
|
|
"aiProcess_GenNormals may not be specified together");
|
|
|
|
return false;
|
|
|
|
}
|
2008-05-22 22:47:20 +00:00
|
|
|
return true;
|
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Free the current scene
|
|
|
|
void Importer::FreeScene( )
|
|
|
|
{
|
|
|
|
delete mScene;
|
|
|
|
mScene = NULL;
|
|
|
|
}
|
|
|
|
|
2009-01-23 21:06:43 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Get the current error string, if any
|
|
|
|
const std::string& Importer::GetErrorString() const
|
|
|
|
{
|
|
|
|
return mErrorString;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Enable extra-verbose mode
|
|
|
|
void Importer::SetExtraVerbose(bool bDo)
|
|
|
|
{
|
|
|
|
bExtraVerbose = bDo;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Get the current scene
|
|
|
|
const aiScene* Importer::GetScene() const
|
|
|
|
{
|
|
|
|
return mScene;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Orphan the current scene
|
|
|
|
aiScene* Importer::GetOrphanedScene()
|
|
|
|
{
|
|
|
|
aiScene* s = mScene;
|
|
|
|
mScene = NULL;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Validate post-processing flags
|
|
|
|
bool Importer::ValidateFlags(unsigned int pFlags)
|
|
|
|
{
|
|
|
|
// run basic checks for mutually exclusive flags
|
|
|
|
if(!_ValidateFlags(pFlags))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// ValidateDS does not anymore occur in the pp list, it plays
|
|
|
|
// an awesome extra role ...
|
|
|
|
#ifdef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
|
|
if (pFlags & aiProcess_ValidateDataStructure)
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
pFlags &= ~aiProcess_ValidateDataStructure;
|
|
|
|
|
|
|
|
// Now iterate through all bits which are set in
|
|
|
|
// the flags and check whether we find at least
|
|
|
|
// one pp plugin which handles it.
|
|
|
|
for (unsigned int mask = 1; mask < (1 << (sizeof(unsigned int)*8-1));mask <<= 1) {
|
|
|
|
|
|
|
|
if (pFlags & mask) {
|
|
|
|
|
|
|
|
bool have = false;
|
|
|
|
for( unsigned int a = 0; a < mPostProcessingSteps.size(); a++) {
|
|
|
|
if (mPostProcessingSteps[a]-> IsActive(mask) ) {
|
|
|
|
|
|
|
|
have = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!have)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Reads the given file and returns its contents if successful.
|
2009-01-23 21:06:43 +00:00
|
|
|
const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
2008-05-05 12:36:31 +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
|
|
|
// In debug builds, run a basic flag validation
|
|
|
|
ai_assert(_ValidateFlags(pFlags));
|
2008-05-22 22:47:20 +00:00
|
|
|
|
2009-01-23 21:06:43 +00:00
|
|
|
const std::string pFile(_pFile);
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ======================================================================
|
|
|
|
// Put a large try block around everything to catch all std::exception's
|
2008-10-19 11:32:33 +00:00
|
|
|
// that might be thrown by STL containers or by new().
|
|
|
|
// ImportErrorException's are throw by ourselves and caught elsewhere.
|
2009-01-12 22:06:54 +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
|
|
|
#ifdef ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
2008-10-19 11:32:33 +00:00
|
|
|
try
|
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
|
|
|
#endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
2008-05-23 12:30:52 +00:00
|
|
|
{
|
2009-01-12 22:06:54 +00:00
|
|
|
// Check whether this Importer instance has already loaded
|
2008-10-19 11:32:33 +00:00
|
|
|
// a scene. In this case we need to delete the old one
|
2009-01-12 22:06:54 +00:00
|
|
|
if (mScene)
|
2008-10-19 11:32:33 +00:00
|
|
|
{
|
2009-01-12 22:06:54 +00:00
|
|
|
DefaultLogger::get()->debug("Deleting previous scene");
|
|
|
|
FreeScene();
|
2008-10-19 11:32:33 +00:00
|
|
|
}
|
2008-05-23 12:30:52 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// First check if the file is accessable at all
|
2008-10-19 11:32:33 +00:00
|
|
|
if( !mIOHandler->Exists( pFile))
|
|
|
|
{
|
|
|
|
mErrorString = "Unable to open file \"" + pFile + "\".";
|
|
|
|
DefaultLogger::get()->error(mErrorString);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Find an worker class which can handle the file
|
2008-10-19 11:32:33 +00:00
|
|
|
BaseImporter* imp = NULL;
|
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 a = 0; a < mImporter.size(); a++) {
|
|
|
|
|
|
|
|
if( mImporter[a]->CanRead( pFile, mIOHandler, false)) {
|
2008-10-19 11:32:33 +00:00
|
|
|
imp = mImporter[a];
|
|
|
|
break;
|
|
|
|
}
|
2008-05-05 12:36:31 +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 (!imp)
|
2008-10-19 11:32:33 +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
|
|
|
// not so bad yet ... try format auto detection.
|
|
|
|
std::string::size_type s = pFile.find_last_of('.');
|
|
|
|
if (s != std::string::npos) {
|
|
|
|
DefaultLogger::get()->info("File extension now known, trying signature-based detection");
|
|
|
|
for( unsigned int a = 0; a < mImporter.size(); a++) {
|
|
|
|
|
|
|
|
if( mImporter[a]->CanRead( pFile, mIOHandler, true)) {
|
|
|
|
imp = mImporter[a];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Put a proper error message if no suitable importer was found
|
|
|
|
if( !imp)
|
|
|
|
{
|
|
|
|
mErrorString = "No suitable reader found for the file format of file \"" + pFile + "\".";
|
|
|
|
DefaultLogger::get()->error(mErrorString);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-10-19 11:32:33 +00:00
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Dispatch the reading to the worker class for this format
|
2008-10-19 11:32:33 +00:00
|
|
|
DefaultLogger::get()->info("Found a matching importer for this file format");
|
|
|
|
imp->SetupProperties( this );
|
|
|
|
mScene = imp->ReadFile( pFile, mIOHandler);
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// If successful, apply all active post processing steps to the imported data
|
2008-10-19 11:32:33 +00:00
|
|
|
if( mScene)
|
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
|
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
|
|
|
// The ValidateDS process is an exception. It is executed first,
|
|
|
|
// even before ScenePreprocessor is called.
|
|
|
|
if (pFlags & aiProcess_ValidateDataStructure)
|
|
|
|
{
|
|
|
|
ValidateDSProcess ds;
|
|
|
|
ds.ExecuteOnScene (this);
|
|
|
|
if (!mScene)
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif // no validation
|
|
|
|
|
|
|
|
// Preprocess the scene
|
2009-01-12 22:06:54 +00:00
|
|
|
ScenePreprocessor pre(mScene);
|
|
|
|
pre.ProcessScene();
|
2008-11-02 16:58:31 +00:00
|
|
|
|
2008-10-22 20:06:16 +00:00
|
|
|
DefaultLogger::get()->info("Import successful, entering postprocessing-steps");
|
2008-10-19 11:32:33 +00:00
|
|
|
#ifdef _DEBUG
|
|
|
|
if (bExtraVerbose)
|
|
|
|
{
|
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
|
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
2008-09-30 20:20:56 +00:00
|
|
|
|
2008-10-19 11:32:33 +00:00
|
|
|
DefaultLogger::get()->error("Extra verbose mode not available, library"
|
|
|
|
" wasn't build with the ValidateDS-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
|
|
|
#endif // no validation
|
2008-09-30 20:20:56 +00:00
|
|
|
|
|
|
|
|
2008-10-19 11:32:33 +00:00
|
|
|
pFlags |= aiProcess_ValidateDataStructure;
|
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
#else
|
2008-10-19 11:32:33 +00:00
|
|
|
if (bExtraVerbose)DefaultLogger::get()->warn("Not a debug build, ignoring extra verbose setting");
|
2008-08-08 18:34:14 +00:00
|
|
|
#endif // ! DEBUG
|
2008-10-19 11:32:33 +00:00
|
|
|
for( unsigned int a = 0; a < mPostProcessingSteps.size(); a++)
|
2008-06-15 10:27:08 +00:00
|
|
|
{
|
2008-10-19 11:32:33 +00:00
|
|
|
BaseProcess* process = mPostProcessingSteps[a];
|
|
|
|
if( process->IsActive( pFlags))
|
|
|
|
{
|
|
|
|
process->SetupProperties( this );
|
|
|
|
process->ExecuteOnScene ( this );
|
|
|
|
}
|
|
|
|
if( !mScene)break;
|
2008-08-08 18:34:14 +00:00
|
|
|
#ifdef _DEBUG
|
2008-09-30 20:20:56 +00:00
|
|
|
|
|
|
|
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
2008-10-19 11:32:33 +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
|
|
|
#endif // no validation
|
2008-09-30 20:20:56 +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 the extra verbose mode is active execute the
|
2008-10-19 11:32:33 +00:00
|
|
|
// VaidateDataStructureStep again after each 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
|
|
|
if (bExtraVerbose)
|
2008-07-30 23:00:25 +00:00
|
|
|
{
|
2008-10-19 11:32:33 +00:00
|
|
|
DefaultLogger::get()->debug("Extra verbose: revalidating data structures");
|
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
|
|
|
|
|
|
|
ValidateDSProcess ds;
|
|
|
|
ds.ExecuteOnScene (this);
|
2008-10-19 11:32:33 +00:00
|
|
|
if( !mScene)
|
|
|
|
{
|
|
|
|
DefaultLogger::get()->error("Extra verbose: failed to revalidate data structures");
|
|
|
|
break;
|
|
|
|
}
|
2008-07-30 23:00:25 +00:00
|
|
|
}
|
2008-08-08 18:34:14 +00:00
|
|
|
#endif // ! DEBUG
|
2008-10-19 11:32:33 +00:00
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-10-19 11:32:33 +00:00
|
|
|
// if failed, extract the error string
|
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
|
|
|
else if( !mScene)
|
|
|
|
mErrorString = imp->GetErrorText();
|
2008-10-19 11:32:33 +00:00
|
|
|
|
|
|
|
// clear any data allocated by post-process steps
|
|
|
|
mPPShared->Clean();
|
2008-11-26 22:03:14 +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
|
|
|
#ifdef ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
2008-10-19 11:32:33 +00:00
|
|
|
catch (std::exception &e)
|
|
|
|
{
|
2008-11-26 22:03:14 +00:00
|
|
|
#if (defined _MSC_VER) && (defined _CPPRTTI)
|
2008-10-19 11:32:33 +00:00
|
|
|
// if we have RTTI get the full name of the exception that occured
|
|
|
|
mErrorString = std::string(typeid( e ).name()) + ": " + e.what();
|
|
|
|
#else
|
|
|
|
mErrorString = std::string("std::exception: ") + e.what();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
DefaultLogger::get()->error(mErrorString);
|
|
|
|
delete mScene;mScene = NULL;
|
|
|
|
}
|
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
|
|
|
#endif // ! ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
2008-09-27 16:46:05 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// either successful or failure - the pointer expresses it anyways
|
|
|
|
return mScene;
|
|
|
|
}
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Helper function to check whether an extension is supported by ASSIMP
|
2009-01-23 21:06:43 +00:00
|
|
|
bool Importer::IsExtensionSupported(const char* szExtension)
|
2008-08-28 17:35:36 +00:00
|
|
|
{
|
|
|
|
return NULL != FindLoader(szExtension);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-23 21:06:43 +00:00
|
|
|
BaseImporter* Importer::FindLoader (const char* _szExtension)
|
2008-05-09 17:24:28 +00:00
|
|
|
{
|
2009-01-23 21:06:43 +00:00
|
|
|
const std::string szExtension(_szExtension);
|
2008-05-09 17:24:28 +00:00
|
|
|
for (std::vector<BaseImporter*>::const_iterator
|
2009-01-23 21:06:43 +00:00
|
|
|
i = mImporter.begin();
|
|
|
|
i != mImporter.end();++i)
|
2008-05-09 17:24:28 +00:00
|
|
|
{
|
|
|
|
// pass the file extension to the CanRead(..,NULL)-method
|
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 ((*i)->CanRead(szExtension,NULL,false))return *i;
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
2008-08-28 17:35:36 +00:00
|
|
|
return NULL;
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Helper function to build a list of all file extensions supported by ASSIMP
|
2009-01-23 21:06:43 +00:00
|
|
|
void Importer::GetExtensionList(aiString& szOut)
|
2008-05-09 17:24:28 +00:00
|
|
|
{
|
|
|
|
unsigned int iNum = 0;
|
2009-01-23 21:06:43 +00:00
|
|
|
std::string tmp; // todo: Rewrite baseImporter::GetExtensionList to use aiString, too
|
2008-05-09 17:24:28 +00:00
|
|
|
for (std::vector<BaseImporter*>::const_iterator
|
2009-01-23 21:06:43 +00:00
|
|
|
i = mImporter.begin();
|
|
|
|
i != mImporter.end();++i,++iNum)
|
2008-05-09 17:24:28 +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
|
|
|
// Insert a comma as delimiter character
|
|
|
|
// FIX: to take lazy loader implementations into account, we are
|
|
|
|
// slightly more tolerant here than we'd need to be.
|
|
|
|
if (0 != iNum && ';' != *(tmp.end()-1))
|
2009-01-23 21:06:43 +00:00
|
|
|
tmp.append(";");
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2009-01-23 21:06:43 +00:00
|
|
|
(*i)->GetExtensionList(tmp);
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
2009-01-23 21:06:43 +00:00
|
|
|
szOut.Set(tmp);
|
2008-05-09 17:24:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-08-08 11:53:48 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Set a configuration property
|
2008-08-28 17:35:36 +00:00
|
|
|
void Importer::SetPropertyInteger(const char* szName, int iValue,
|
|
|
|
bool* bWasExisting /*= NULL*/)
|
2008-08-08 11:53:48 +00:00
|
|
|
{
|
2008-08-28 17:35:36 +00:00
|
|
|
SetGenericProperty<int>(mIntProperties, szName,iValue,bWasExisting);
|
|
|
|
}
|
2008-08-08 11:53:48 +00:00
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Set a configuration property
|
2008-08-28 17:35:36 +00:00
|
|
|
void Importer::SetPropertyFloat(const char* szName, float iValue,
|
|
|
|
bool* bWasExisting /*= NULL*/)
|
|
|
|
{
|
|
|
|
SetGenericProperty<float>(mFloatProperties, szName,iValue,bWasExisting);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Set a configuration property
|
2008-08-28 17:35:36 +00:00
|
|
|
void Importer::SetPropertyString(const char* szName, const std::string& value,
|
|
|
|
bool* bWasExisting /*= NULL*/)
|
|
|
|
{
|
|
|
|
SetGenericProperty<std::string>(mStringProperties, szName,value,bWasExisting);
|
2008-08-08 11:53:48 +00:00
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-08-08 11:53:48 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Get a configuration property
|
2008-08-28 17:35:36 +00:00
|
|
|
int Importer::GetPropertyInteger(const char* szName,
|
2008-08-08 18:34:14 +00:00
|
|
|
int iErrorReturn /*= 0xffffffff*/) const
|
2008-08-08 11:53:48 +00:00
|
|
|
{
|
2008-08-28 17:35:36 +00:00
|
|
|
return GetGenericProperty<int>(mIntProperties,szName,iErrorReturn);
|
|
|
|
}
|
2008-08-08 11:53:48 +00:00
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Get a configuration property
|
2008-08-28 17:35:36 +00:00
|
|
|
float Importer::GetPropertyFloat(const char* szName,
|
|
|
|
float iErrorReturn /*= 10e10*/) const
|
|
|
|
{
|
|
|
|
return GetGenericProperty<float>(mFloatProperties,szName,iErrorReturn);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Get a configuration property
|
2008-10-31 19:32:00 +00:00
|
|
|
const std::string& Importer::GetPropertyString(const char* szName,
|
2008-08-28 17:35:36 +00:00
|
|
|
const std::string& iErrorReturn /*= ""*/) const
|
|
|
|
{
|
|
|
|
return GetGenericProperty<std::string>(mStringProperties,szName,iErrorReturn);
|
2008-08-08 11:53:48 +00:00
|
|
|
}
|
2008-08-28 17:35:36 +00:00
|
|
|
|
2008-08-08 11:53:48 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Get the memory requirements of a single node
|
2008-11-16 21:56:45 +00:00
|
|
|
inline void AddNodeWeight(unsigned int& iScene,const aiNode* pcNode)
|
2008-08-08 11:53:48 +00:00
|
|
|
{
|
|
|
|
iScene += sizeof(aiNode);
|
|
|
|
iScene += sizeof(unsigned int) * pcNode->mNumMeshes;
|
|
|
|
iScene += sizeof(void*) * pcNode->mNumChildren;
|
|
|
|
for (unsigned int i = 0; i < pcNode->mNumChildren;++i)
|
|
|
|
AddNodeWeight(iScene,pcNode->mChildren[i]);
|
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-08-08 11:53:48 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Get the memory requirements of the scene
|
|
|
|
void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
|
|
|
|
{
|
2008-08-13 23:46:46 +00:00
|
|
|
in = aiMemoryInfo();
|
2008-08-08 11:53:48 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// return if we have no scene loaded
|
|
|
|
if (!this->mScene)return;
|
2008-08-08 11:53:48 +00:00
|
|
|
in.total = sizeof(aiScene);
|
|
|
|
|
|
|
|
// add all meshes
|
|
|
|
for (unsigned int i = 0; i < mScene->mNumMeshes;++i)
|
|
|
|
{
|
|
|
|
in.meshes += sizeof(aiMesh);
|
|
|
|
if (mScene->mMeshes[i]->HasPositions())
|
|
|
|
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices;
|
|
|
|
|
|
|
|
if (mScene->mMeshes[i]->HasNormals())
|
|
|
|
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices;
|
|
|
|
|
|
|
|
if (mScene->mMeshes[i]->HasTangentsAndBitangents())
|
|
|
|
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices * 2;
|
|
|
|
|
|
|
|
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS;++a)
|
|
|
|
{
|
|
|
|
if (mScene->mMeshes[i]->HasVertexColors(a))
|
|
|
|
in.meshes += sizeof(aiColor4D) * mScene->mMeshes[i]->mNumVertices;
|
|
|
|
else break;
|
|
|
|
}
|
|
|
|
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS;++a)
|
|
|
|
{
|
|
|
|
if (mScene->mMeshes[i]->HasTextureCoords(a))
|
|
|
|
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices;
|
|
|
|
else break;
|
|
|
|
}
|
|
|
|
if (mScene->mMeshes[i]->HasBones())
|
|
|
|
{
|
|
|
|
in.meshes += sizeof(void*) * mScene->mMeshes[i]->mNumBones;
|
|
|
|
for (unsigned int p = 0; p < mScene->mMeshes[i]->mNumBones;++p)
|
|
|
|
{
|
|
|
|
in.meshes += sizeof(aiBone);
|
|
|
|
in.meshes += mScene->mMeshes[i]->mBones[p]->mNumWeights * sizeof(aiVertexWeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
in.meshes += (sizeof(aiFace) + 3 * sizeof(unsigned int))*mScene->mMeshes[i]->mNumFaces;
|
|
|
|
}
|
|
|
|
in.total += in.meshes;
|
|
|
|
|
|
|
|
// add all embedded textures
|
|
|
|
for (unsigned int i = 0; i < mScene->mNumTextures;++i)
|
|
|
|
{
|
|
|
|
const aiTexture* pc = mScene->mTextures[i];
|
|
|
|
in.textures += sizeof(aiTexture);
|
|
|
|
if (pc->mHeight)
|
|
|
|
{
|
|
|
|
in.textures += 4 * pc->mHeight * pc->mWidth;
|
|
|
|
}
|
|
|
|
else in.textures += pc->mWidth;
|
|
|
|
}
|
|
|
|
in.total += in.textures;
|
|
|
|
|
|
|
|
// add all animations
|
|
|
|
for (unsigned int i = 0; i < mScene->mNumAnimations;++i)
|
|
|
|
{
|
|
|
|
const aiAnimation* pc = mScene->mAnimations[i];
|
|
|
|
in.animations += sizeof(aiAnimation);
|
|
|
|
|
|
|
|
// add all bone anims
|
2008-09-30 13:05:48 +00:00
|
|
|
for (unsigned int a = 0; a < pc->mNumChannels; ++a)
|
2008-08-08 11:53:48 +00:00
|
|
|
{
|
2008-09-30 13:05:48 +00:00
|
|
|
const aiNodeAnim* pc2 = pc->mChannels[i];
|
|
|
|
in.animations += sizeof(aiNodeAnim);
|
2008-08-08 11:53:48 +00:00
|
|
|
in.animations += pc2->mNumPositionKeys * sizeof(aiVectorKey);
|
|
|
|
in.animations += pc2->mNumScalingKeys * sizeof(aiVectorKey);
|
|
|
|
in.animations += pc2->mNumRotationKeys * sizeof(aiQuatKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
in.total += in.animations;
|
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
// add all cameras and all lights
|
|
|
|
in.total += in.cameras = sizeof(aiCamera) * mScene->mNumCameras;
|
|
|
|
in.total += in.lights = sizeof(aiLight) * mScene->mNumLights;
|
|
|
|
|
2008-08-08 11:53:48 +00:00
|
|
|
// add all nodes
|
|
|
|
AddNodeWeight(in.nodes,mScene->mRootNode);
|
|
|
|
in.total += in.nodes;
|
|
|
|
|
|
|
|
// add all materials
|
|
|
|
for (unsigned int i = 0; i < mScene->mNumMaterials;++i)
|
|
|
|
{
|
|
|
|
const aiMaterial* pc = mScene->mMaterials[i];
|
|
|
|
in.materials += sizeof(aiMaterial);
|
|
|
|
in.materials += pc->mNumAllocated * sizeof(void*);
|
|
|
|
for (unsigned int a = 0; a < pc->mNumProperties;++a)
|
|
|
|
{
|
|
|
|
in.materials += pc->mProperties[a]->mDataLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
in.total += in.materials;
|
|
|
|
}
|
2008-05-09 17:24:28 +00:00
|
|
|
|