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.
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
/** @file Definition of the base class for all importer worker classes. */
|
2009-01-12 22:06:54 +00:00
|
|
|
#ifndef INCLUDED_AI_BASEIMPORTER_H
|
|
|
|
#define INCLUDED_AI_BASEIMPORTER_H
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2010-03-18 17:00:12 +00:00
|
|
|
#include "Exceptional.h"
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
#include <string>
|
2010-06-18 17:36:46 +00:00
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
2015-04-15 19:22:26 +00:00
|
|
|
#include <set>
|
|
|
|
#include "../include/assimp/types.h"
|
2015-04-16 10:32:35 +00:00
|
|
|
#include "../include/assimp/ProgressHandler.hpp"
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
struct aiScene;
|
|
|
|
|
2008-09-13 22:31:15 +00:00
|
|
|
namespace Assimp {
|
2015-04-16 10:32:35 +00:00
|
|
|
|
2008-08-13 23:46:46 +00:00
|
|
|
class Importer;
|
2015-04-15 23:00:17 +00:00
|
|
|
class IOSystem;
|
2010-06-18 17:36:46 +00:00
|
|
|
class BaseProcess;
|
|
|
|
class SharedPostProcessInfo;
|
2015-04-16 10:32:35 +00:00
|
|
|
class IOStream;
|
2015-04-15 23:00:17 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
// utility to do char4 to uint32 in a portable manner
|
|
|
|
#define AI_MAKE_MAGIC(string) ((uint32_t)((string[0] << 24) + \
|
|
|
|
(string[1] << 16) + (string[2] << 8) + string[3]))
|
|
|
|
|
2010-05-10 10:22:24 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
template <typename T>
|
|
|
|
struct ScopeGuard
|
|
|
|
{
|
|
|
|
ScopeGuard(T* obj) : obj(obj), mdismiss() {}
|
|
|
|
~ScopeGuard () throw() {
|
|
|
|
if (!mdismiss) {
|
|
|
|
delete obj;
|
|
|
|
}
|
|
|
|
obj = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
T* dismiss() {
|
|
|
|
mdismiss=true;
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
operator T*() {
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
T* operator -> () {
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-11-29 10:56:39 +00:00
|
|
|
// no copying allowed.
|
2014-12-01 19:34:15 +00:00
|
|
|
ScopeGuard();
|
2014-11-29 10:56:39 +00:00
|
|
|
ScopeGuard( const ScopeGuard & );
|
|
|
|
ScopeGuard &operator = ( const ScopeGuard & );
|
|
|
|
|
2010-05-10 10:22:24 +00:00
|
|
|
T* obj;
|
|
|
|
bool mdismiss;
|
|
|
|
};
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
2009-08-31 15:51:54 +00:00
|
|
|
/** FOR IMPORTER PLUGINS ONLY: The BaseImporter defines a common interface
|
|
|
|
* for all importer worker classes.
|
2008-05-05 12:36:31 +00:00
|
|
|
*
|
|
|
|
* The interface defines two functions: CanRead() is used to check if the
|
|
|
|
* importer can handle the format of the given file. If an implementation of
|
|
|
|
* this function returns true, the importer then calls ReadFile() which
|
2008-05-09 17:24:28 +00:00
|
|
|
* imports the given file. ReadFile is not overridable, it just calls
|
|
|
|
* InternReadFile() and catches any ImportErrorException that might occur.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
2014-05-04 14:02:52 +00:00
|
|
|
class ASSIMP_API BaseImporter
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
friend class Importer;
|
|
|
|
|
2011-08-01 20:58:31 +00:00
|
|
|
public:
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
/** Constructor to be privately used by #Importer */
|
2008-05-05 12:36:31 +00:00
|
|
|
BaseImporter();
|
|
|
|
|
|
|
|
/** Destructor, private as well */
|
|
|
|
virtual ~BaseImporter();
|
|
|
|
|
|
|
|
public:
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Returns whether the class can handle the format of the given file.
|
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
|
|
|
*
|
|
|
|
* The implementation should be as quick as possible. A check for
|
|
|
|
* the file extension is enough. If no suitable loader is found with
|
|
|
|
* this strategy, CanRead() is called again, the 'checkSig' parameter
|
|
|
|
* set to true this time. Now the implementation is expected to
|
2010-03-02 17:38:01 +00:00
|
|
|
* perform a full check of the file structure, possibly searching the
|
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
|
|
|
* first bytes of the file for magic identifiers or keywords.
|
|
|
|
*
|
|
|
|
* @param pFile Path and file name of the file to be examined.
|
|
|
|
* @param pIOHandler The IO handler to use for accessing any file.
|
|
|
|
* @param checkSig Set to true if this method is called a second time.
|
|
|
|
* This time, the implementation may take more time to examine the
|
|
|
|
* contents of the file to be loaded for magic bytes, keywords, etc
|
|
|
|
* to be able to load files with unknown/not existent file extensions.
|
|
|
|
* @return true if the class can read this file, false if not.
|
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
virtual bool CanRead(
|
|
|
|
const std::string& pFile,
|
|
|
|
IOSystem* pIOHandler,
|
|
|
|
bool checkSig
|
|
|
|
) const = 0;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Imports the given file and returns the imported data.
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
* If the import succeeds, ownership of the data is transferred to
|
|
|
|
* the caller. If the import fails, NULL is returned. The function
|
|
|
|
* takes care that any partially constructed data is destroyed
|
|
|
|
* beforehand.
|
|
|
|
*
|
2010-08-26 18:16:12 +00:00
|
|
|
* @param pImp #Importer object hosting this loader.
|
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
|
|
|
* @param pFile Path of the file to be imported.
|
|
|
|
* @param pIOHandler IO-Handler used to open this and possible other files.
|
|
|
|
* @return The imported data or NULL if failed. If it failed a
|
|
|
|
* human-readable error description can be retrieved by calling
|
|
|
|
* GetErrorText()
|
|
|
|
*
|
|
|
|
* @note This function is not intended to be overridden. Implement
|
|
|
|
* InternReadFile() to do the import. If an exception is thrown somewhere
|
|
|
|
* in InternReadFile(), this function will catch it and transform it into
|
|
|
|
* a suitable response to the caller.
|
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
aiScene* ReadFile(
|
2010-08-26 18:16:12 +00:00
|
|
|
const Importer* pImp,
|
2010-03-02 17:38:01 +00:00
|
|
|
const std::string& pFile,
|
|
|
|
IOSystem* pIOHandler
|
|
|
|
);
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Returns the error description of the last error that occured.
|
2008-05-09 17:24:28 +00:00
|
|
|
* @return A description of the last error that occured. An empty
|
|
|
|
* string if there was no error.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
const std::string& GetErrorText() const {
|
|
|
|
return mErrorText;
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2008-08-08 18:34:14 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Called prior to ReadFile().
|
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
|
|
|
* The function is a request to the importer to update its configuration
|
|
|
|
* basing on the Importer's configuration property list.
|
|
|
|
* @param pImp Importer instance
|
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
virtual void SetupProperties(
|
|
|
|
const Importer* pImp
|
|
|
|
);
|
2008-08-08 18:34:14 +00:00
|
|
|
|
2012-04-22 22:26:26 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
2012-04-18 23:07:52 +00:00
|
|
|
/** Called by #Importer::GetImporterInfo to get a description of
|
2012-04-22 22:26:26 +00:00
|
|
|
* some loader features. Importers must provide this information. */
|
|
|
|
virtual const aiImporterDesc* GetInfo() const = 0;
|
|
|
|
|
|
|
|
|
2012-04-18 23:07:52 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Called by #Importer::GetExtensionList for each loaded importer.
|
2012-04-22 22:26:26 +00:00
|
|
|
* Take the extension list contained in the structure returned by
|
|
|
|
* #GetInfo and insert all file extensions into the given set.
|
|
|
|
* @param extension set to collect file extensions in*/
|
|
|
|
void GetExtensionList(std::set<std::string>& extensions);
|
|
|
|
|
|
|
|
protected:
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Imports the given file into the given scene structure. The
|
|
|
|
* function is expected to throw an ImportErrorException if there is
|
|
|
|
* an error. If it terminates normally, the data in aiScene is
|
|
|
|
* expected to be correct. Override this function to implement the
|
|
|
|
* actual importing.
|
2008-06-22 10:09:26 +00:00
|
|
|
* <br>
|
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
|
|
|
* The output scene must meet the following requirements:<br>
|
|
|
|
* <ul>
|
|
|
|
* <li>At least a root node must be there, even if its only purpose
|
|
|
|
* is to reference one mesh.</li>
|
|
|
|
* <li>aiMesh::mPrimitiveTypes may be 0. The types of primitives
|
|
|
|
* in the mesh are determined automatically in this case.</li>
|
|
|
|
* <li>the vertex data is stored in a pseudo-indexed "verbose" format.
|
2008-09-30 20:20:56 +00:00
|
|
|
* In fact this means that every vertex that is referenced by
|
|
|
|
* a face is unique. Or the other way round: a vertex index may
|
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 occur twice in a single aiMesh.</li>
|
|
|
|
* <li>aiAnimation::mDuration may be -1. Assimp determines the length
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
* of the animation automatically in this case as the length 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
|
|
|
* the longest animation channel.</li>
|
|
|
|
* <li>aiMesh::mBitangents may be NULL if tangents and normals are
|
|
|
|
* given. In this case bitangents are computed as the cross product
|
|
|
|
* between normal and tangent.</li>
|
|
|
|
* <li>There needn't be a material. If none is there a default material
|
|
|
|
* is generated. However, it is recommended practice for loaders
|
|
|
|
* to generate a default material for yourself that matches the
|
|
|
|
* default material setting for the file format better than Assimp's
|
|
|
|
* generic default material. Note that default materials *should*
|
|
|
|
* be named AI_DEFAULT_MATERIAL_NAME if they're just color-shaded
|
|
|
|
* or AI_DEFAULT_TEXTURED_MATERIAL_NAME if they define a (dummy)
|
|
|
|
* texture. </li>
|
|
|
|
* </ul>
|
|
|
|
* If the AI_SCENE_FLAGS_INCOMPLETE-Flag is <b>not</b> set:<ul>
|
|
|
|
* <li> at least one mesh must be there</li>
|
|
|
|
* <li> there may be no meshes with 0 vertices or faces</li>
|
|
|
|
* </ul>
|
|
|
|
* This won't be checked (except by the validation step): Assimp will
|
2008-06-22 10:09:26 +00:00
|
|
|
* crash if one of the conditions is not met!
|
|
|
|
*
|
2008-05-05 12:36:31 +00:00
|
|
|
* @param pFile Path of the file to be imported.
|
|
|
|
* @param pScene The scene object to hold the imported data.
|
2008-05-09 17:24:28 +00:00
|
|
|
* NULL is not a valid parameter.
|
2008-05-05 12:36:31 +00:00
|
|
|
* @param pIOHandler The IO handler to use for any file access.
|
2010-03-02 17:38:01 +00:00
|
|
|
* NULL is not a valid parameter. */
|
|
|
|
virtual void InternReadFile(
|
|
|
|
const std::string& pFile,
|
|
|
|
aiScene* pScene,
|
|
|
|
IOSystem* pIOHandler
|
|
|
|
) = 0;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-08-21 22:49:58 +00:00
|
|
|
public: // static utilities
|
2008-10-24 20:37:54 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** A utility for CanRead().
|
|
|
|
*
|
|
|
|
* The function searches the header of a file for a specific token
|
|
|
|
* and returns true if this token is found. This works for text
|
2009-01-12 22:06:54 +00:00
|
|
|
* files only. There is a rudimentary handling of UNICODE files.
|
2008-10-24 20:37:54 +00:00
|
|
|
* The comparison is case independent.
|
|
|
|
*
|
|
|
|
* @param pIOSystem IO System to work with
|
|
|
|
* @param file File name of the file
|
|
|
|
* @param tokens List of tokens to search for
|
|
|
|
* @param numTokens Size of the token array
|
|
|
|
* @param searchBytes Number of bytes to be searched for the tokens.
|
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
static bool SearchFileHeaderForToken(
|
|
|
|
IOSystem* pIOSystem,
|
2008-10-24 20:37:54 +00:00
|
|
|
const std::string& file,
|
2010-03-02 17:38:01 +00:00
|
|
|
const char** tokens,
|
|
|
|
unsigned int numTokens,
|
2012-03-20 20:31:14 +00:00
|
|
|
unsigned int searchBytes = 200,
|
|
|
|
bool tokensSol = false);
|
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
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** @brief Check whether a file has a specific file extension
|
|
|
|
* @param pFile Input file
|
|
|
|
* @param ext0 Extension to check for. Lowercase characters only, no dot!
|
|
|
|
* @param ext1 Optional second extension
|
|
|
|
* @param ext2 Optional third extension
|
|
|
|
* @note Case-insensitive
|
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
static bool SimpleExtensionCheck (
|
|
|
|
const std::string& 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
|
|
|
const char* ext0,
|
|
|
|
const char* ext1 = NULL,
|
|
|
|
const char* ext2 = NULL);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** @brief Extract file extension from a string
|
|
|
|
* @param pFile Input file
|
|
|
|
* @return Extension without trailing dot, all lowercase
|
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
static std::string GetExtension (
|
|
|
|
const std::string& 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
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** @brief Check whether a file starts with one or more magic tokens
|
|
|
|
* @param pFile Input file
|
|
|
|
* @param pIOHandler IO system to be used
|
|
|
|
* @param magic n magic tokens
|
|
|
|
* @params num Size of magic
|
|
|
|
* @param offset Offset from file start where tokens are located
|
|
|
|
* @param Size of one token, in bytes. Maximally 16 bytes.
|
|
|
|
* @return true if one of the given tokens was found
|
|
|
|
*
|
|
|
|
* @note For convinence, the check is also performed for the
|
|
|
|
* byte-swapped variant of all tokens (big endian). Only for
|
|
|
|
* tokens of size 2,4.
|
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
static bool CheckMagicToken(
|
|
|
|
IOSystem* pIOHandler,
|
|
|
|
const std::string& 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
|
|
|
const void* magic,
|
|
|
|
unsigned int num,
|
|
|
|
unsigned int offset = 0,
|
|
|
|
unsigned int size = 4);
|
|
|
|
|
2008-10-27 00:36:26 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** An utility for all text file loaders. It converts a file to our
|
2009-08-21 22:49:58 +00:00
|
|
|
* UTF8 character set. Errors are reported, but ignored.
|
|
|
|
*
|
|
|
|
* @param data File buffer to be converted to UTF8 data. The buffer
|
|
|
|
* is resized as appropriate. */
|
2010-03-02 17:38:01 +00:00
|
|
|
static void ConvertToUTF8(
|
|
|
|
std::vector<char>& data);
|
2009-08-21 22:49:58 +00:00
|
|
|
|
2013-11-26 15:34:16 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** An utility for all text file loaders. It converts a file from our
|
|
|
|
* UTF8 character set back to ISO-8859-1. Errors are reported, but ignored.
|
|
|
|
*
|
|
|
|
* @param data File buffer to be converted from UTF8 to ISO-8859-1. The buffer
|
|
|
|
* is resized as appropriate. */
|
|
|
|
static void ConvertUTF8toISO8859_1(
|
|
|
|
std::string& data);
|
|
|
|
|
2009-08-21 22:49:58 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Utility for text file loaders which copies the contents of the
|
|
|
|
* file into a memory buffer and converts it to our UTF8
|
|
|
|
* representation.
|
|
|
|
* @param stream Stream to read from.
|
|
|
|
* @param data Output buffer to be resized and filled with the
|
|
|
|
* converted text file data. The buffer is terminated with
|
|
|
|
* a binary 0. */
|
2010-03-02 17:38:01 +00:00
|
|
|
static void TextFileToBuffer(
|
|
|
|
IOStream* stream,
|
2009-08-21 22:49:58 +00:00
|
|
|
std::vector<char>& data);
|
2008-10-27 00:36:26 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
protected:
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
/** Error description in case there was one. */
|
|
|
|
std::string mErrorText;
|
2010-08-26 18:16:12 +00:00
|
|
|
|
|
|
|
/** Currently set progress handler */
|
|
|
|
ProgressHandler* progress;
|
2008-05-05 12:36:31 +00:00
|
|
|
};
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
|
2008-09-13 22:31:15 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
} // end of namespace Assimp
|
|
|
|
|
2008-09-11 20:50:15 +00:00
|
|
|
#endif // AI_BASEIMPORTER_H_INC
|