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
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
Copyright (c) 2006-2012, 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.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
/** @file Importer.cpp
|
|
|
|
* @brief 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"
|
2012-02-03 17:04:06 +00:00
|
|
|
#include "../include/assimp/version.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2010-04-11 02:14:52 +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.
|
|
|
|
*
|
2010-04-11 02:14:52 +00:00
|
|
|
* Note that any Exception except DeadlyImportError may lead to
|
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
|
|
|
* undefined behaviour -> loaders could remain in an unusable state and
|
|
|
|
* further imports with the same Importer instance could fail/crash/burn ...
|
|
|
|
*/
|
2010-04-11 02:14:52 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2011-05-06 23:55:38 +00:00
|
|
|
#ifndef ASSIMP_BUILD_DEBUG
|
|
|
|
# define ASSIMP_CATCH_GLOBAL_EXCEPTIONS
|
|
|
|
#endif
|
2010-04-11 02:14:52 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Internal headers
|
2010-04-11 02:14:52 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2011-08-01 20:58:31 +00:00
|
|
|
#include "Importer.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
#include "BaseProcess.h"
|
2011-08-01 20:58:31 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
#include "DefaultIOStream.h"
|
|
|
|
#include "DefaultIOSystem.h"
|
2010-08-26 18:16:12 +00:00
|
|
|
#include "DefaultProgressHandler.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"
|
2009-06-21 19:44:48 +00:00
|
|
|
#include "MemoryIOWrapper.h"
|
2010-07-08 22:44:44 +00:00
|
|
|
#include "Profiler.h"
|
2010-08-26 14:20:28 +00:00
|
|
|
#include "TinyFormatter.h"
|
2010-07-08 22:44:44 +00:00
|
|
|
|
2010-05-10 10:22:24 +00:00
|
|
|
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
2008-06-22 10:09:26 +00:00
|
|
|
# include "ValidateDataStructure.h"
|
|
|
|
#endif
|
2011-08-01 20:58:31 +00:00
|
|
|
|
|
|
|
using namespace Assimp::Profiling;
|
|
|
|
using namespace Assimp::Formatter;
|
|
|
|
|
|
|
|
namespace Assimp {
|
|
|
|
// ImporterRegistry.cpp
|
|
|
|
void GetImporterInstanceList(std::vector< BaseImporter* >& out);
|
|
|
|
// PostStepRegistry.cpp
|
|
|
|
void GetPostProcessingStepInstanceList(std::vector< BaseProcess* >& out);
|
|
|
|
}
|
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;
|
|
|
|
|
2010-04-11 02:14:52 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Intern::AllocateFromAssimpHeap serves as abstract base class. It overrides
|
|
|
|
// new and delete (and their array counterparts) of public API classes (e.g. Logger) to
|
2010-04-11 02:14:52 +00:00
|
|
|
// utilize our DLL heap.
|
|
|
|
// See http://www.gotw.ca/publications/mill15.htm
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-24 20:53:24 +00:00
|
|
|
void* AllocateFromAssimpHeap::operator new ( size_t num_bytes) {
|
2009-01-12 22:06:54 +00:00
|
|
|
return ::operator new(num_bytes);
|
|
|
|
}
|
|
|
|
|
2010-04-11 02:29:46 +00:00
|
|
|
void* AllocateFromAssimpHeap::operator new ( size_t num_bytes, const std::nothrow_t& ) throw() {
|
2010-04-11 02:14:52 +00:00
|
|
|
try {
|
|
|
|
return AllocateFromAssimpHeap::operator new( num_bytes );
|
|
|
|
}
|
|
|
|
catch( ... ) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
void AllocateFromAssimpHeap::operator delete ( void* data) {
|
2009-01-12 22:06:54 +00:00
|
|
|
return ::operator delete(data);
|
|
|
|
}
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
void* AllocateFromAssimpHeap::operator new[] ( size_t num_bytes) {
|
2009-01-12 22:06:54 +00:00
|
|
|
return ::operator new[](num_bytes);
|
|
|
|
}
|
|
|
|
|
2010-04-11 02:29:46 +00:00
|
|
|
void* AllocateFromAssimpHeap::operator new[] ( size_t num_bytes, const std::nothrow_t& ) throw() {
|
2010-04-11 02:14:52 +00:00
|
|
|
try {
|
|
|
|
return AllocateFromAssimpHeap::operator new[]( num_bytes );
|
|
|
|
}
|
|
|
|
catch( ... ) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
void AllocateFromAssimpHeap::operator delete[] ( void* data) {
|
2009-01-12 22:06:54 +00:00
|
|
|
return ::operator delete[](data);
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-24 20:53:24 +00:00
|
|
|
// Importer constructor.
|
2009-01-12 22:06:54 +00:00
|
|
|
Importer::Importer()
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
// allocate the pimpl first
|
|
|
|
pimpl = new ImporterPimpl();
|
|
|
|
|
|
|
|
pimpl->mScene = NULL;
|
|
|
|
pimpl->mErrorString = "";
|
|
|
|
|
2009-01-09 21:29:54 +00:00
|
|
|
// Allocate a default IO handler
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mIOHandler = new DefaultIOSystem;
|
|
|
|
pimpl->mIsDefaultHandler = true;
|
|
|
|
pimpl->bExtraVerbose = false; // disable extra verbose mode by default
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2010-08-26 18:16:12 +00:00
|
|
|
pimpl->mProgressHandler = new DefaultProgressHandler();
|
|
|
|
pimpl->mIsDefaultProgressHandler = true;
|
|
|
|
|
2011-08-01 20:58:31 +00:00
|
|
|
GetImporterInstanceList(pimpl->mImporter);
|
|
|
|
GetPostProcessingStepInstanceList(pimpl->mPostProcessingSteps);
|
2008-09-27 16:46:05 +00:00
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
// Allocate a SharedPostProcessInfo object and store pointers to it in all post-process steps in the list.
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mPPShared = new SharedPostProcessInfo();
|
2009-05-25 17:19:20 +00:00
|
|
|
for (std::vector<BaseProcess*>::iterator it = pimpl->mPostProcessingSteps.begin();
|
|
|
|
it != pimpl->mPostProcessingSteps.end();
|
|
|
|
++it) {
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
(*it)->SetSharedData(pimpl->mPPShared);
|
2008-09-27 16:46:05 +00:00
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-24 20:53:24 +00:00
|
|
|
// Destructor of Importer
|
2008-05-05 12:36:31 +00:00
|
|
|
Importer::~Importer()
|
|
|
|
{
|
2009-01-12 22:06:54 +00:00
|
|
|
// Delete all import plugins
|
2009-04-24 20:53:24 +00:00
|
|
|
for( unsigned int a = 0; a < pimpl->mImporter.size(); a++)
|
|
|
|
delete pimpl->mImporter[a];
|
2009-01-12 22:06:54 +00:00
|
|
|
|
|
|
|
// Delete all post-processing plug-ins
|
2009-04-24 20:53:24 +00:00
|
|
|
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++)
|
|
|
|
delete pimpl->mPostProcessingSteps[a];
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2010-12-11 15:50:14 +00:00
|
|
|
// Delete the assigned IO and progress handler
|
2009-04-24 20:53:24 +00:00
|
|
|
delete pimpl->mIOHandler;
|
2010-12-11 15:50:14 +00:00
|
|
|
delete pimpl->mProgressHandler;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Kill imported scene. Destructors should do that recursivly
|
2009-04-24 20:53:24 +00:00
|
|
|
delete pimpl->mScene;
|
2008-09-27 16:46:05 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Delete shared post-processing data
|
2009-04-24 20:53:24 +00:00
|
|
|
delete pimpl->mPPShared;
|
|
|
|
|
|
|
|
// and finally the pimpl itself
|
|
|
|
delete pimpl;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2008-08-11 17:49:02 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-24 20:53:24 +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
|
|
|
new(this) Importer();
|
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
pimpl->mIntProperties = other.pimpl->mIntProperties;
|
|
|
|
pimpl->mFloatProperties = other.pimpl->mFloatProperties;
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mStringProperties = other.pimpl->mStringProperties;
|
2008-08-11 17:49:02 +00:00
|
|
|
}
|
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Register a custom post-processing step
|
|
|
|
aiReturn Importer::RegisterPPStep(BaseProcess* pImp)
|
|
|
|
{
|
|
|
|
ai_assert(NULL != pImp);
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2009-05-25 17:19:20 +00:00
|
|
|
|
2010-03-18 17:00:12 +00:00
|
|
|
pimpl->mPostProcessingSteps.push_back(pImp);
|
|
|
|
DefaultLogger::get()->info("Registering custom post-processing step");
|
|
|
|
|
|
|
|
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
2009-05-25 17:19:20 +00:00
|
|
|
return AI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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);
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2009-04-24 20:53:24 +00:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------
|
2009-01-12 22:06:54 +00:00
|
|
|
// Check whether we would have two loaders for the same file extension
|
2009-05-25 17:19:20 +00:00
|
|
|
// This is absolutely OK, but we should warn the developer of the new
|
2010-03-02 17:38:01 +00:00
|
|
|
// loader that his code will probably never be called if the first
|
|
|
|
// loader is a bit too lazy in his file checking.
|
2009-04-24 20:53:24 +00:00
|
|
|
// --------------------------------------------------------------------
|
2010-03-02 17:38:01 +00:00
|
|
|
std::set<std::string> st;
|
|
|
|
std::string baked;
|
2008-08-11 17:49:02 +00:00
|
|
|
pImp->GetExtensionList(st);
|
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
for(std::set<std::string>::const_iterator it = st.begin(); it != st.end(); ++it) {
|
|
|
|
|
2013-11-21 12:05:48 +00:00
|
|
|
#ifdef ASSIMP_BUILD_DEBUG
|
2010-03-02 17:38:01 +00:00
|
|
|
if (IsExtensionSupported(*it)) {
|
|
|
|
DefaultLogger::get()->warn("The file extension " + *it + " is already in use");
|
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
#endif
|
2010-03-02 17:38:01 +00:00
|
|
|
baked += *it;
|
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
|
|
|
// add the loader
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mImporter.push_back(pImp);
|
2010-03-02 17:38:01 +00:00
|
|
|
DefaultLogger::get()->info("Registering custom importer for these file extensions: " + baked);
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
2008-08-11 17:49:02 +00:00
|
|
|
return AI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-24 20:53:24 +00:00
|
|
|
// Unregister a custom loader plugin
|
2008-08-11 17:49:02 +00:00
|
|
|
aiReturn Importer::UnregisterLoader(BaseImporter* pImp)
|
|
|
|
{
|
2010-03-02 17:38:01 +00:00
|
|
|
if(!pImp) {
|
|
|
|
// unregistering a NULL importer is no problem for us ... really!
|
|
|
|
return AI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2010-08-26 18:16:12 +00:00
|
|
|
std::vector<BaseImporter*>::iterator it = std::find(pimpl->mImporter.begin(),
|
|
|
|
pimpl->mImporter.end(),pImp);
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
if (it != pimpl->mImporter.end()) {
|
|
|
|
pimpl->mImporter.erase(it);
|
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
std::set<std::string> st;
|
2009-04-24 20:53:24 +00:00
|
|
|
pImp->GetExtensionList(st);
|
2010-03-02 17:38:01 +00:00
|
|
|
|
|
|
|
DefaultLogger::get()->info("Unregistering custom importer: ");
|
2009-04-24 20:53:24 +00:00
|
|
|
return AI_SUCCESS;
|
2008-08-11 17:49:02 +00:00
|
|
|
}
|
2009-05-25 17:19:20 +00:00
|
|
|
DefaultLogger::get()->warn("Unable to remove custom importer: I can't find you ...");
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
2009-05-25 17:19:20 +00:00
|
|
|
return AI_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Unregister a custom loader plugin
|
|
|
|
aiReturn Importer::UnregisterPPStep(BaseProcess* pImp)
|
|
|
|
{
|
2010-03-02 17:38:01 +00:00
|
|
|
if(!pImp) {
|
|
|
|
// unregistering a NULL ppstep is no problem for us ... really!
|
|
|
|
return AI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2010-08-26 18:16:12 +00:00
|
|
|
std::vector<BaseProcess*>::iterator it = std::find(pimpl->mPostProcessingSteps.begin(),
|
|
|
|
pimpl->mPostProcessingSteps.end(),pImp);
|
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
if (it != pimpl->mPostProcessingSteps.end()) {
|
|
|
|
pimpl->mPostProcessingSteps.erase(it);
|
|
|
|
DefaultLogger::get()->info("Unregistering custom post-processing step");
|
|
|
|
return AI_SUCCESS;
|
|
|
|
}
|
|
|
|
DefaultLogger::get()->warn("Unable to remove custom post-processing step: I can't find you ..");
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(aiReturn);
|
2008-08-11 17:49:02 +00:00
|
|
|
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)
|
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
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
|
|
|
{
|
2009-04-10 21:59:22 +00:00
|
|
|
// Release pointer in the possession of the caller
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mIOHandler = new DefaultIOSystem();
|
|
|
|
pimpl->mIsDefaultHandler = true;
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
2009-01-12 22:06:54 +00:00
|
|
|
// Otherwise register the custom handler
|
2009-04-24 20:53:24 +00:00
|
|
|
else if (pimpl->mIOHandler != pIOHandler)
|
2008-05-09 17:24:28 +00:00
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
delete pimpl->mIOHandler;
|
|
|
|
pimpl->mIOHandler = pIOHandler;
|
|
|
|
pimpl->mIsDefaultHandler = false;
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(void);
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-05-22 22:47:20 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-24 20:53:24 +00:00
|
|
|
// Get the currently set IO handler
|
2010-08-26 18:16:12 +00:00
|
|
|
IOSystem* Importer::GetIOHandler() const
|
2008-06-22 10:09:26 +00:00
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
return pimpl->mIOHandler;
|
2008-06-22 10:09:26 +00:00
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-24 20:53:24 +00:00
|
|
|
// Check whether a custom IO handler is currently set
|
2010-08-26 18:16:12 +00:00
|
|
|
bool Importer::IsDefaultIOHandler() const
|
2008-06-22 10:09:26 +00:00
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
return pimpl->mIsDefaultHandler;
|
2008-06-22 10:09:26 +00:00
|
|
|
}
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2010-08-26 18:16:12 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Supplies a custom progress handler to get regular callbacks during importing
|
|
|
|
void Importer::SetProgressHandler ( ProgressHandler* pHandler )
|
|
|
|
{
|
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
|
|
|
// If the new handler is zero, allocate a default implementation.
|
|
|
|
if (!pHandler)
|
|
|
|
{
|
|
|
|
// Release pointer in the possession of the caller
|
|
|
|
pimpl->mProgressHandler = new DefaultProgressHandler();
|
|
|
|
pimpl->mIsDefaultProgressHandler = true;
|
|
|
|
}
|
|
|
|
// Otherwise register the custom handler
|
|
|
|
else if (pimpl->mProgressHandler != pHandler)
|
|
|
|
{
|
|
|
|
delete pimpl->mProgressHandler;
|
|
|
|
pimpl->mProgressHandler = pHandler;
|
|
|
|
pimpl->mIsDefaultProgressHandler = false;
|
|
|
|
}
|
|
|
|
ASSIMP_END_EXCEPTION_REGION(void);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Get the currently set progress handler
|
|
|
|
ProgressHandler* Importer::GetProgressHandler() const
|
|
|
|
{
|
|
|
|
return pimpl->mProgressHandler;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Check whether a custom progress handler is currently set
|
|
|
|
bool Importer::IsDefaultProgressHandler() const
|
|
|
|
{
|
|
|
|
return pimpl->mIsDefaultProgressHandler;
|
|
|
|
}
|
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2008-05-22 22:47:20 +00:00
|
|
|
// Validate post process step flags
|
2010-08-26 18:16:12 +00:00
|
|
|
bool _ValidateFlags(unsigned int pFlags)
|
2008-05-22 22:47:20 +00:00
|
|
|
{
|
2009-05-25 17:19:20 +00:00
|
|
|
if (pFlags & aiProcess_GenSmoothNormals && pFlags & aiProcess_GenNormals) {
|
|
|
|
DefaultLogger::get()->error("#aiProcess_GenSmoothNormals and #aiProcess_GenNormals are incompatible");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (pFlags & aiProcess_OptimizeGraph && pFlags & aiProcess_PreTransformVertices) {
|
|
|
|
DefaultLogger::get()->error("#aiProcess_OptimizeGraph and #aiProcess_PreTransformVertices are incompatible");
|
2008-08-28 17:35:36 +00:00
|
|
|
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( )
|
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2009-04-24 20:53:24 +00:00
|
|
|
delete pimpl->mScene;
|
|
|
|
pimpl->mScene = NULL;
|
|
|
|
|
|
|
|
pimpl->mErrorString = "";
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(void);
|
2009-01-12 22:06:54 +00:00
|
|
|
}
|
|
|
|
|
2009-01-23 21:06:43 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Get the current error string, if any
|
2009-04-24 20:53:24 +00:00
|
|
|
const char* Importer::GetErrorString() const
|
2009-01-23 21:06:43 +00:00
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
/* Must remain valid as long as ReadFile() or FreeFile() are not called */
|
|
|
|
return pimpl->mErrorString.c_str();
|
2009-01-23 21:06:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Enable extra-verbose mode
|
|
|
|
void Importer::SetExtraVerbose(bool bDo)
|
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->bExtraVerbose = bDo;
|
2009-01-23 21:06:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Get the current scene
|
|
|
|
const aiScene* Importer::GetScene() const
|
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
return pimpl->mScene;
|
2009-01-23 21:06:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-24 20:53:24 +00:00
|
|
|
// Orphan the current scene and return it.
|
2009-01-23 21:06:43 +00:00
|
|
|
aiScene* Importer::GetOrphanedScene()
|
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
aiScene* s = pimpl->mScene;
|
2010-03-18 17:00:12 +00:00
|
|
|
|
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mScene = NULL;
|
|
|
|
|
|
|
|
pimpl->mErrorString = ""; /* reset error string */
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(aiScene*);
|
2009-01-23 21:06:43 +00:00
|
|
|
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
|
2010-08-26 18:16:12 +00:00
|
|
|
bool Importer::ValidateFlags(unsigned int pFlags) const
|
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-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
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
|
|
|
// run basic checks for mutually exclusive flags
|
2010-03-18 17:00:12 +00:00
|
|
|
if(!_ValidateFlags(pFlags)) {
|
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 false;
|
2010-03-18 17:00:12 +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
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
// ValidateDS does not anymore occur in the pp list, it plays an awesome extra role ...
|
2010-05-10 10:22:24 +00:00
|
|
|
#ifdef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
2010-08-26 18:16:12 +00:00
|
|
|
if (pFlags & aiProcess_ValidateDataStructure) {
|
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 false;
|
2010-08-26 18:16:12 +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
|
|
|
#endif
|
|
|
|
pFlags &= ~aiProcess_ValidateDataStructure;
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
// Now iterate through all bits which are set in the flags and check whether we find at least
|
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
|
|
|
// one pp plugin which handles it.
|
2010-02-06 23:52:41 +00:00
|
|
|
for (unsigned int mask = 1; mask < (1u << (sizeof(unsigned int)*8-1));mask <<= 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
|
|
|
|
|
|
|
if (pFlags & mask) {
|
|
|
|
|
|
|
|
bool have = false;
|
2009-04-24 20:53:24 +00:00
|
|
|
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
|
|
|
|
if (pimpl->mPostProcessingSteps[a]-> IsActive(mask) ) {
|
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
|
|
|
|
|
|
|
have = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-08-26 18:16:12 +00:00
|
|
|
if (!have) {
|
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 false;
|
2010-08-26 18:16:12 +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
|
|
|
}
|
|
|
|
}
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(bool);
|
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 true;
|
|
|
|
}
|
|
|
|
|
2009-06-21 19:44:48 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const aiScene* Importer::ReadFileFromMemory( const void* pBuffer,
|
|
|
|
size_t pLength,
|
|
|
|
unsigned int pFlags,
|
|
|
|
const char* pHint /*= ""*/)
|
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2009-06-21 19:44:48 +00:00
|
|
|
if (!pHint) {
|
|
|
|
pHint = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pBuffer || !pLength || strlen(pHint) > 100) {
|
|
|
|
pimpl->mErrorString = "Invalid parameters passed to ReadFileFromMemory()";
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// prevent deletion of the previous IOHandler
|
|
|
|
IOSystem* io = pimpl->mIOHandler;
|
|
|
|
pimpl->mIOHandler = NULL;
|
|
|
|
|
|
|
|
SetIOHandler(new MemoryIOSystem((const uint8_t*)pBuffer,pLength));
|
|
|
|
|
|
|
|
// read the file and recover the previous IOSystem
|
|
|
|
char fbuff[128];
|
|
|
|
sprintf(fbuff,"%s.%s",AI_MEMORYIO_MAGIC_FILENAME,pHint);
|
|
|
|
|
|
|
|
ReadFile(fbuff,pFlags);
|
|
|
|
SetIOHandler(io);
|
|
|
|
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(const aiScene*);
|
2009-06-21 19:44:48 +00:00
|
|
|
return pimpl->mScene;
|
|
|
|
}
|
|
|
|
|
2010-08-26 14:20:28 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void WriteLogOpening(const std::string& file)
|
|
|
|
{
|
|
|
|
Logger* l = DefaultLogger::get();
|
|
|
|
if (!l) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
l->info("Load " + file);
|
|
|
|
|
|
|
|
// print a full version dump. This is nice because we don't
|
|
|
|
// need to ask the authors of incoming bug reports for
|
|
|
|
// the library version they're using - a log dump is
|
|
|
|
// sufficient.
|
|
|
|
const unsigned int flags = aiGetCompileFlags();
|
|
|
|
l->debug(format()
|
|
|
|
<< "Assimp "
|
|
|
|
<< aiGetVersionMajor()
|
|
|
|
<< "."
|
|
|
|
<< aiGetVersionMinor()
|
|
|
|
<< "."
|
|
|
|
<< aiGetVersionRevision()
|
|
|
|
|
2011-09-23 16:45:17 +00:00
|
|
|
<< " "
|
|
|
|
#if defined(ASSIMP_BUILD_ARCHITECTURE)
|
|
|
|
<< ASSIMP_BUILD_ARCHITECTURE
|
|
|
|
#elif defined(_M_IX86) || defined(__x86_32__) || defined(__i386__)
|
|
|
|
<< "x86"
|
|
|
|
#elif defined(_M_X64) || defined(__x86_64__)
|
|
|
|
<< "amd64"
|
|
|
|
#elif defined(_M_IA64) || defined(__ia64__)
|
|
|
|
<< "itanium"
|
|
|
|
#elif defined(__ppc__) || defined(__powerpc__)
|
|
|
|
<< "ppc32"
|
|
|
|
#elif defined(__powerpc64__)
|
|
|
|
<< "ppc64"
|
|
|
|
#elif defined(__arm__)
|
|
|
|
<< "arm"
|
2010-08-26 14:20:28 +00:00
|
|
|
#else
|
2011-09-23 16:45:17 +00:00
|
|
|
<< "<unknown architecture>"
|
2010-08-26 14:20:28 +00:00
|
|
|
#endif
|
|
|
|
|
2011-09-23 16:45:17 +00:00
|
|
|
<< " "
|
|
|
|
#if defined(ASSIMP_BUILD_COMPILER)
|
|
|
|
<< ASSIMP_BUILD_COMPILER
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
<< "msvc"
|
2010-08-26 14:20:28 +00:00
|
|
|
#elif defined(__GNUC__)
|
2011-09-23 16:45:17 +00:00
|
|
|
<< "gcc"
|
2010-08-26 14:20:28 +00:00
|
|
|
#else
|
2011-09-23 16:45:17 +00:00
|
|
|
<< "<unknown compiler>"
|
2010-08-26 14:20:28 +00:00
|
|
|
#endif
|
|
|
|
|
2013-11-21 12:05:48 +00:00
|
|
|
#ifdef ASSIMP_BUILD_DEBUG
|
2010-08-26 14:20:28 +00:00
|
|
|
<< " debug"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
<< (flags & ASSIMP_CFLAGS_NOBOOST ? " noboost" : "")
|
|
|
|
<< (flags & ASSIMP_CFLAGS_SHARED ? " shared" : "")
|
|
|
|
<< (flags & ASSIMP_CFLAGS_SINGLETHREADED ? " singlethreaded" : "")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2010-05-27 18:30:28 +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
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2009-01-23 21:06:43 +00:00
|
|
|
const std::string pFile(_pFile);
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
// ----------------------------------------------------------------------
|
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-04-24 20:53:24 +00:00
|
|
|
//-----------------------------------------------------------------------
|
2009-05-25 17:19:20 +00:00
|
|
|
|
2010-08-26 14:20:28 +00:00
|
|
|
WriteLogOpening(pFile);
|
|
|
|
|
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
|
2010-07-08 22:44:44 +00:00
|
|
|
if (pimpl->mScene) {
|
|
|
|
|
|
|
|
DefaultLogger::get()->debug("(Deleting previous scene)");
|
2009-01-12 22:06:54 +00:00
|
|
|
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
|
2010-07-08 22:44:44 +00:00
|
|
|
if( !pimpl->mIOHandler->Exists( pFile)) {
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mErrorString = "Unable to open file \"" + pFile + "\".";
|
|
|
|
DefaultLogger::get()->error(pimpl->mErrorString);
|
2008-10-19 11:32:33 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2010-07-08 22:44:44 +00:00
|
|
|
boost::scoped_ptr<Profiler> profiler(GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME,0)?new Profiler():NULL);
|
|
|
|
if (profiler) {
|
|
|
|
profiler->BeginRegion("total");
|
|
|
|
}
|
|
|
|
|
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;
|
2009-04-24 20:53:24 +00:00
|
|
|
for( unsigned int a = 0; a < pimpl->mImporter.size(); 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
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, false)) {
|
|
|
|
imp = pimpl->mImporter[a];
|
2008-10-19 11:32:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2010-07-08 22:44:44 +00:00
|
|
|
if (!imp) {
|
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.
|
2010-07-08 22:44:44 +00:00
|
|
|
const std::string::size_type s = pFile.find_last_of('.');
|
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 (s != std::string::npos) {
|
2011-04-22 16:08:31 +00:00
|
|
|
DefaultLogger::get()->info("File extension not known, trying signature-based detection");
|
2009-04-24 20:53:24 +00:00
|
|
|
for( unsigned int a = 0; a < pimpl->mImporter.size(); 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
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
if( pimpl->mImporter[a]->CanRead( pFile, pimpl->mIOHandler, true)) {
|
|
|
|
imp = pimpl->mImporter[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
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Put a proper error message if no suitable importer was found
|
2009-06-21 19:44:48 +00:00
|
|
|
if( !imp) {
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mErrorString = "No suitable reader found for the file format of file \"" + pFile + "\".";
|
|
|
|
DefaultLogger::get()->error(pimpl->mErrorString);
|
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 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");
|
2010-08-26 18:16:12 +00:00
|
|
|
pimpl->mProgressHandler->Update();
|
2010-07-08 22:44:44 +00:00
|
|
|
|
|
|
|
if (profiler) {
|
|
|
|
profiler->BeginRegion("import");
|
|
|
|
}
|
|
|
|
|
2010-08-26 18:16:12 +00:00
|
|
|
pimpl->mScene = imp->ReadFile( this, pFile, pimpl->mIOHandler);
|
|
|
|
pimpl->mProgressHandler->Update();
|
2008-10-19 11:32:33 +00:00
|
|
|
|
2010-07-08 22:44:44 +00:00
|
|
|
if (profiler) {
|
|
|
|
profiler->EndRegion("import");
|
|
|
|
}
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// If successful, apply all active post processing steps to the imported data
|
2009-05-25 17:19:20 +00:00
|
|
|
if( pimpl->mScene) {
|
|
|
|
|
2010-05-10 10:22:24 +00:00
|
|
|
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
2009-05-25 17:19:20 +00:00
|
|
|
// The ValidateDS process is an exception. It is executed first, even before ScenePreprocessor is called.
|
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 (pFlags & aiProcess_ValidateDataStructure)
|
|
|
|
{
|
|
|
|
ValidateDSProcess ds;
|
|
|
|
ds.ExecuteOnScene (this);
|
2009-05-25 17:19:20 +00:00
|
|
|
if (!pimpl->mScene) {
|
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 NULL;
|
2009-05-25 17:19:20 +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
|
|
|
}
|
|
|
|
#endif // no validation
|
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
// Preprocess the scene and prepare it for post-processing
|
2010-07-08 22:44:44 +00:00
|
|
|
if (profiler) {
|
|
|
|
profiler->BeginRegion("preprocess");
|
|
|
|
}
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
ScenePreprocessor pre(pimpl->mScene);
|
2009-01-12 22:06:54 +00:00
|
|
|
pre.ProcessScene();
|
2008-11-02 16:58:31 +00:00
|
|
|
|
2010-08-26 18:16:12 +00:00
|
|
|
pimpl->mProgressHandler->Update();
|
2010-07-08 22:44:44 +00:00
|
|
|
if (profiler) {
|
|
|
|
profiler->EndRegion("preprocess");
|
|
|
|
}
|
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
// Ensure that the validation process won't be called twice
|
|
|
|
ApplyPostProcessing(pFlags & (~aiProcess_ValidateDataStructure));
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
2008-10-19 11:32:33 +00:00
|
|
|
// if failed, extract the error string
|
2009-05-25 17:19:20 +00:00
|
|
|
else if( !pimpl->mScene) {
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mErrorString = imp->GetErrorText();
|
2009-05-25 17:19:20 +00:00
|
|
|
}
|
2008-10-19 11:32:33 +00:00
|
|
|
|
|
|
|
// clear any data allocated by post-process steps
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mPPShared->Clean();
|
2010-07-08 22:44:44 +00:00
|
|
|
|
|
|
|
if (profiler) {
|
|
|
|
profiler->EndRegion("total");
|
|
|
|
}
|
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
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mErrorString = std::string(typeid( e ).name()) + ": " + e.what();
|
2008-10-19 11:32:33 +00:00
|
|
|
#else
|
2009-04-24 20:53:24 +00:00
|
|
|
pimpl->mErrorString = std::string("std::exception: ") + e.what();
|
2008-10-19 11:32:33 +00:00
|
|
|
#endif
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
DefaultLogger::get()->error(pimpl->mErrorString);
|
|
|
|
delete pimpl->mScene; pimpl->mScene = NULL;
|
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
|
|
|
#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
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(const aiScene*);
|
2009-04-24 20:53:24 +00:00
|
|
|
return pimpl->mScene;
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2010-05-27 18:30:28 +00:00
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Apply post-processing to the currently bound scene
|
|
|
|
const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2009-05-25 17:19:20 +00:00
|
|
|
// Return immediately if no scene is active
|
|
|
|
if (!pimpl->mScene) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If no flags are given, return the current scene with no further action
|
|
|
|
if (!pFlags) {
|
|
|
|
return pimpl->mScene;
|
|
|
|
}
|
|
|
|
|
|
|
|
// In debug builds: run basic flag validation
|
|
|
|
ai_assert(_ValidateFlags(pFlags));
|
|
|
|
DefaultLogger::get()->info("Entering post processing pipeline");
|
|
|
|
|
2010-05-10 10:22:24 +00:00
|
|
|
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
2009-05-25 17:19:20 +00:00
|
|
|
// The ValidateDS process plays an exceptional role. It isn't contained in the global
|
|
|
|
// list of post-processing steps, so we need to call it manually.
|
|
|
|
if (pFlags & aiProcess_ValidateDataStructure)
|
|
|
|
{
|
|
|
|
ValidateDSProcess ds;
|
|
|
|
ds.ExecuteOnScene (this);
|
|
|
|
if (!pimpl->mScene) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // no validation
|
2013-11-21 12:05:48 +00:00
|
|
|
#ifdef ASSIMP_BUILD_DEBUG
|
2009-05-25 17:19:20 +00:00
|
|
|
if (pimpl->bExtraVerbose)
|
|
|
|
{
|
2010-05-10 10:22:24 +00:00
|
|
|
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
2009-05-25 17:19:20 +00:00
|
|
|
DefaultLogger::get()->error("Verbose Import is not available due to build settings");
|
|
|
|
#endif // no validation
|
|
|
|
pFlags |= aiProcess_ValidateDataStructure;
|
|
|
|
}
|
|
|
|
#else
|
2010-07-08 22:44:44 +00:00
|
|
|
if (pimpl->bExtraVerbose) {
|
2009-05-25 17:19:20 +00:00
|
|
|
DefaultLogger::get()->warn("Not a debug build, ignoring extra verbose setting");
|
2010-07-08 22:44:44 +00:00
|
|
|
}
|
2009-05-25 17:19:20 +00:00
|
|
|
#endif // ! DEBUG
|
2010-07-08 22:44:44 +00:00
|
|
|
|
|
|
|
boost::scoped_ptr<Profiler> profiler(GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME,0)?new Profiler():NULL);
|
2009-05-25 17:19:20 +00:00
|
|
|
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
|
|
|
|
|
|
|
|
BaseProcess* process = pimpl->mPostProcessingSteps[a];
|
|
|
|
if( process->IsActive( pFlags)) {
|
|
|
|
|
2010-07-08 22:44:44 +00:00
|
|
|
if (profiler) {
|
|
|
|
profiler->BeginRegion("postprocess");
|
|
|
|
}
|
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
process->ExecuteOnScene ( this );
|
2010-08-26 18:16:12 +00:00
|
|
|
pimpl->mProgressHandler->Update();
|
2010-07-08 22:44:44 +00:00
|
|
|
|
|
|
|
if (profiler) {
|
|
|
|
profiler->EndRegion("postprocess");
|
|
|
|
}
|
2009-05-25 17:19:20 +00:00
|
|
|
}
|
|
|
|
if( !pimpl->mScene) {
|
|
|
|
break;
|
|
|
|
}
|
2013-11-21 12:05:48 +00:00
|
|
|
#ifdef ASSIMP_BUILD_DEBUG
|
2009-05-25 17:19:20 +00:00
|
|
|
|
2010-05-10 10:22:24 +00:00
|
|
|
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
2009-05-25 17:19:20 +00:00
|
|
|
continue;
|
|
|
|
#endif // no validation
|
|
|
|
|
|
|
|
// If the extra verbose mode is active, execute the ValidateDataStructureStep again - after each step
|
|
|
|
if (pimpl->bExtraVerbose) {
|
|
|
|
DefaultLogger::get()->debug("Verbose Import: revalidating data structures");
|
|
|
|
|
|
|
|
ValidateDSProcess ds;
|
|
|
|
ds.ExecuteOnScene (this);
|
|
|
|
if( !pimpl->mScene) {
|
|
|
|
DefaultLogger::get()->error("Verbose Import: failed to revalidate data structures");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // ! DEBUG
|
|
|
|
}
|
|
|
|
|
2011-08-01 20:58:31 +00:00
|
|
|
// update private scene flags
|
2012-05-23 09:25:40 +00:00
|
|
|
if( pimpl->mScene )
|
|
|
|
ScenePriv(pimpl->mScene)->mPPStepsApplied |= pFlags;
|
2011-08-01 20:58:31 +00:00
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
// clear any data allocated by post-process steps
|
|
|
|
pimpl->mPPShared->Clean();
|
|
|
|
DefaultLogger::get()->info("Leaving post processing pipeline");
|
2010-03-18 17:00:12 +00:00
|
|
|
|
|
|
|
ASSIMP_END_EXCEPTION_REGION(const aiScene*);
|
2009-05-25 17:19:20 +00:00
|
|
|
return pimpl->mScene;
|
|
|
|
}
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Helper function to check whether an extension is supported by ASSIMP
|
2010-08-26 18:16:12 +00:00
|
|
|
bool Importer::IsExtensionSupported(const char* szExtension) const
|
2008-08-28 17:35:36 +00:00
|
|
|
{
|
2012-04-18 23:07:52 +00:00
|
|
|
return NULL != GetImporter(szExtension);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
size_t Importer::GetImporterCount() const
|
|
|
|
{
|
|
|
|
return pimpl->mImporter.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const aiImporterDesc* Importer::GetImporterInfo(size_t index) const
|
|
|
|
{
|
|
|
|
if (index >= pimpl->mImporter.size()) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return pimpl->mImporter[index]->GetInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
BaseImporter* Importer::GetImporter (size_t index) const
|
|
|
|
{
|
|
|
|
if (index >= pimpl->mImporter.size()) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return pimpl->mImporter[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Find a loader plugin for a given file extension
|
|
|
|
BaseImporter* Importer::GetImporter (const char* szExtension) const
|
|
|
|
{
|
|
|
|
return GetImporter(GetImporterIndex(szExtension));
|
2008-08-28 17:35:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2009-04-27 19:58:34 +00:00
|
|
|
// Find a loader plugin for a given file extension
|
2012-04-18 23:07:52 +00:00
|
|
|
size_t Importer::GetImporterIndex (const char* szExtension) const
|
2008-05-09 17:24:28 +00:00
|
|
|
{
|
2010-03-02 17:38:01 +00:00
|
|
|
ai_assert(szExtension);
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2010-03-02 17:38:01 +00:00
|
|
|
|
|
|
|
// skip over wildcard and dot characters at string head --
|
|
|
|
for(;*szExtension == '*' || *szExtension == '.'; ++szExtension);
|
|
|
|
|
|
|
|
std::string ext(szExtension);
|
2010-10-13 19:34:44 +00:00
|
|
|
if (ext.empty()) {
|
2012-04-22 22:59:15 +00:00
|
|
|
return static_cast<size_t>(-1);
|
2010-10-13 19:34:44 +00:00
|
|
|
}
|
|
|
|
std::transform(ext.begin(),ext.end(), ext.begin(), tolower);
|
2009-04-27 19:58:34 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
std::set<std::string> str;
|
2009-04-27 19:58:34 +00:00
|
|
|
for (std::vector<BaseImporter*>::const_iterator i = pimpl->mImporter.begin();i != pimpl->mImporter.end();++i) {
|
2010-03-02 17:38:01 +00:00
|
|
|
str.clear();
|
2009-04-27 19:58:34 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
(*i)->GetExtensionList(str);
|
|
|
|
for (std::set<std::string>::const_iterator it = str.begin(); it != str.end(); ++it) {
|
|
|
|
if (ext == *it) {
|
2012-04-18 23:07:52 +00:00
|
|
|
return std::distance(static_cast< std::vector<BaseImporter*>::const_iterator >(pimpl->mImporter.begin()), i);
|
2010-03-02 17:38:01 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
2012-04-18 23:07:52 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(size_t);
|
|
|
|
return static_cast<size_t>(-1);
|
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
|
2010-08-26 18:16:12 +00:00
|
|
|
void Importer::GetExtensionList(aiString& szOut) const
|
2008-05-09 17:24:28 +00:00
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
2010-03-02 17:38:01 +00:00
|
|
|
std::set<std::string> str;
|
|
|
|
for (std::vector<BaseImporter*>::const_iterator i = pimpl->mImporter.begin();i != pimpl->mImporter.end();++i) {
|
|
|
|
(*i)->GetExtensionList(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (std::set<std::string>::const_iterator it = str.begin();; ) {
|
|
|
|
szOut.Append("*.");
|
|
|
|
szOut.Append((*it).c_str());
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
if (++it == str.end()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
szOut.Append(";");
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_END_EXCEPTION_REGION(void);
|
2008-05-09 17:24:28 +00:00
|
|
|
}
|
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
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
|
|
|
SetGenericProperty<int>(pimpl->mIntProperties, szName,iValue,bWasExisting);
|
|
|
|
ASSIMP_END_EXCEPTION_REGION(void);
|
2008-08-28 17:35:36 +00:00
|
|
|
}
|
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*/)
|
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
|
|
|
SetGenericProperty<float>(pimpl->mFloatProperties, szName,iValue,bWasExisting);
|
|
|
|
ASSIMP_END_EXCEPTION_REGION(void);
|
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::SetPropertyString(const char* szName, const std::string& value,
|
|
|
|
bool* bWasExisting /*= NULL*/)
|
|
|
|
{
|
2010-03-18 17:00:12 +00:00
|
|
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
|
|
|
SetGenericProperty<std::string>(pimpl->mStringProperties, szName,value,bWasExisting);
|
|
|
|
ASSIMP_END_EXCEPTION_REGION(void);
|
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
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
return GetGenericProperty<int>(pimpl->mIntProperties,szName,iErrorReturn);
|
2008-08-28 17:35:36 +00:00
|
|
|
}
|
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
|
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
return GetGenericProperty<float>(pimpl->mFloatProperties,szName,iErrorReturn);
|
2008-08-28 17:35:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
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
|
|
|
|
{
|
2009-04-24 20:53:24 +00:00
|
|
|
return GetGenericProperty<std::string>(pimpl->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;
|
2010-03-02 17:38:01 +00:00
|
|
|
|
|
|
|
for (unsigned int i = 0; i < pcNode->mNumChildren;++i) {
|
2008-08-08 11:53:48 +00:00
|
|
|
AddNodeWeight(iScene,pcNode->mChildren[i]);
|
2010-03-02 17:38:01 +00:00
|
|
|
}
|
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 the memory requirements of the scene
|
|
|
|
void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
|
|
|
|
{
|
2008-08-13 23:46:46 +00:00
|
|
|
in = aiMemoryInfo();
|
2009-04-24 20:53:24 +00:00
|
|
|
aiScene* mScene = pimpl->mScene;
|
2008-08-08 11:53:48 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// return if we have no scene loaded
|
2009-04-24 20:53:24 +00:00
|
|
|
if (!pimpl->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);
|
2010-03-02 17:38:01 +00:00
|
|
|
if (mScene->mMeshes[i]->HasPositions()) {
|
2008-08-08 11:53:48 +00:00
|
|
|
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices;
|
2010-03-02 17:38:01 +00:00
|
|
|
}
|
2008-08-08 11:53:48 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
if (mScene->mMeshes[i]->HasNormals()) {
|
2008-08-08 11:53:48 +00:00
|
|
|
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices;
|
2010-03-02 17:38:01 +00:00
|
|
|
}
|
2008-08-08 11:53:48 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
if (mScene->mMeshes[i]->HasTangentsAndBitangents()) {
|
2008-08-08 11:53:48 +00:00
|
|
|
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices * 2;
|
2010-03-02 17:38:01 +00:00
|
|
|
}
|
2008-08-08 11:53:48 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS;++a) {
|
|
|
|
if (mScene->mMeshes[i]->HasVertexColors(a)) {
|
2008-08-08 11:53:48 +00:00
|
|
|
in.meshes += sizeof(aiColor4D) * mScene->mMeshes[i]->mNumVertices;
|
2010-03-02 17:38:01 +00:00
|
|
|
}
|
2008-08-08 11:53:48 +00:00
|
|
|
else break;
|
|
|
|
}
|
2010-03-02 17:38:01 +00:00
|
|
|
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS;++a) {
|
|
|
|
if (mScene->mMeshes[i]->HasTextureCoords(a)) {
|
2008-08-08 11:53:48 +00:00
|
|
|
in.meshes += sizeof(aiVector3D) * mScene->mMeshes[i]->mNumVertices;
|
2010-03-02 17:38:01 +00:00
|
|
|
}
|
2008-08-08 11:53:48 +00:00
|
|
|
else break;
|
|
|
|
}
|
2010-03-02 17:38:01 +00:00
|
|
|
if (mScene->mMeshes[i]->HasBones()) {
|
2008-08-08 11:53:48 +00:00
|
|
|
in.meshes += sizeof(void*) * mScene->mMeshes[i]->mNumBones;
|
2010-03-02 17:38:01 +00:00
|
|
|
for (unsigned int p = 0; p < mScene->mMeshes[i]->mNumBones;++p) {
|
2008-08-08 11:53:48 +00:00
|
|
|
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
|
2010-03-02 17:38:01 +00:00
|
|
|
for (unsigned int i = 0; i < mScene->mNumTextures;++i) {
|
2008-08-08 11:53:48 +00:00
|
|
|
const aiTexture* pc = mScene->mTextures[i];
|
|
|
|
in.textures += sizeof(aiTexture);
|
2010-03-02 17:38:01 +00:00
|
|
|
if (pc->mHeight) {
|
2008-08-08 11:53:48 +00:00
|
|
|
in.textures += 4 * pc->mHeight * pc->mWidth;
|
|
|
|
}
|
|
|
|
else in.textures += pc->mWidth;
|
|
|
|
}
|
|
|
|
in.total += in.textures;
|
|
|
|
|
|
|
|
// add all animations
|
2010-03-02 17:38:01 +00:00
|
|
|
for (unsigned int i = 0; i < mScene->mNumAnimations;++i) {
|
2008-08-08 11:53:48 +00:00
|
|
|
const aiAnimation* pc = mScene->mAnimations[i];
|
|
|
|
in.animations += sizeof(aiAnimation);
|
|
|
|
|
|
|
|
// add all bone anims
|
2010-03-02 17:38:01 +00:00
|
|
|
for (unsigned int a = 0; a < pc->mNumChannels; ++a) {
|
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
|
2010-03-02 17:38:01 +00:00
|
|
|
for (unsigned int i = 0; i < mScene->mNumMaterials;++i) {
|
2008-08-08 11:53:48 +00:00
|
|
|
const aiMaterial* pc = mScene->mMaterials[i];
|
|
|
|
in.materials += sizeof(aiMaterial);
|
|
|
|
in.materials += pc->mNumAllocated * sizeof(void*);
|
2010-03-02 17:38:01 +00:00
|
|
|
|
|
|
|
for (unsigned int a = 0; a < pc->mNumProperties;++a) {
|
2008-08-08 11:53:48 +00:00
|
|
|
in.materials += pc->mProperties[a]->mDataLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
in.total += in.materials;
|
|
|
|
}
|
2008-05-09 17:24:28 +00:00
|
|
|
|