2008-05-09 17:24:28 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
2008-05-22 10:20:31 +00:00
|
|
|
Open Asset Import Library (ASSIMP)
|
2008-05-09 17:24:28 +00:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2010-04-10 15:30:22 +00:00
|
|
|
Copyright (c) 2006-2010, ASSIMP Development 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.
|
|
|
|
|
|
|
|
* Neither the name of the ASSIMP team, nor the names of its
|
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
|
|
|
written permission of the ASSIMP Development Team.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
/** @file assimp.hpp
|
2009-01-13 18:58:07 +00:00
|
|
|
* @brief Defines the C++-API to the Open Asset Import Library.
|
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
#ifndef INCLUDED_AI_ASSIMP_HPP
|
|
|
|
#define INCLUDED_AI_ASSIMP_HPP
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
#ifndef __cplusplus
|
2009-04-24 20:53:24 +00:00
|
|
|
# error This header requires C++ to be used. Use assimp.h for plain C.
|
2008-05-05 12:36:31 +00:00
|
|
|
#endif
|
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
// Public ASSIMP data structures
|
2008-08-08 11:59:09 +00:00
|
|
|
#include "aiTypes.h"
|
2008-08-08 11:51:00 +00:00
|
|
|
#include "aiConfig.h"
|
2008-10-13 16:45:48 +00:00
|
|
|
#include "aiAssert.h"
|
2008-08-08 11:51:00 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
namespace Assimp {
|
|
|
|
// =======================================================================
|
|
|
|
// Public interface to Assimp
|
2008-08-13 23:46:46 +00:00
|
|
|
class Importer;
|
2008-10-13 16:45:48 +00:00
|
|
|
class IOStream;
|
|
|
|
class IOSystem;
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// =======================================================================
|
2008-11-29 15:30:50 +00:00
|
|
|
// Plugin development
|
2009-04-24 20:53:24 +00:00
|
|
|
//
|
|
|
|
// Include the following headers for the declarations:
|
2009-01-12 22:06:54 +00:00
|
|
|
// BaseImporter.h
|
|
|
|
// BaseProcess.h
|
2008-10-13 16:45:48 +00:00
|
|
|
class BaseImporter;
|
|
|
|
class BaseProcess;
|
|
|
|
class SharedPostProcessInfo;
|
2008-10-31 19:32:00 +00:00
|
|
|
class BatchLoader;
|
2009-04-24 20:53:24 +00:00
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
// Holy stuff, only for members of the high council of the Jedi.
|
|
|
|
class ImporterPimpl;
|
2009-01-12 22:06:54 +00:00
|
|
|
} //! namespace Assimp
|
2008-08-13 23:46:46 +00:00
|
|
|
|
2008-08-08 11:51:00 +00:00
|
|
|
#define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff
|
2008-06-22 10:09:26 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
struct aiScene;
|
2008-08-28 17:35:36 +00:00
|
|
|
struct aiFileIO;
|
2008-11-30 22:27:20 +00:00
|
|
|
extern "C" ASSIMP_API const aiScene* aiImportFileEx( const char*, unsigned int, aiFileIO*);
|
2009-06-21 19:44:48 +00:00
|
|
|
extern "C" ASSIMP_API const aiScene* aiImportFileFromMemory( const char*,
|
|
|
|
unsigned int,unsigned int,const char*);
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-08-31 15:51:54 +00:00
|
|
|
/** @namespace Assimp Assimp's CPP-API and all internal APIs */
|
2009-01-12 22:06:54 +00:00
|
|
|
namespace Assimp {
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ----------------------------------------------------------------------------------
|
2009-08-31 15:51:54 +00:00
|
|
|
/** CPP-API: The Importer class forms an C++ interface to the functionality of the
|
2009-01-12 22:06:54 +00:00
|
|
|
* Open Asset Import Library.
|
2008-05-05 12:36:31 +00:00
|
|
|
*
|
|
|
|
* Create an object of this class and call ReadFile() to import a file.
|
|
|
|
* If the import succeeds, the function returns a pointer to the imported data.
|
|
|
|
* The data remains property of the object, it is intended to be accessed
|
|
|
|
* read-only. The imported data will be destroyed along with the Importer
|
2009-01-12 22:06:54 +00:00
|
|
|
* object. If the import fails, ReadFile() returns a NULL pointer. In this
|
2008-05-05 12:36:31 +00:00
|
|
|
* case you can retrieve a human-readable error description be calling
|
2009-01-12 22:06:54 +00:00
|
|
|
* GetErrorString(). You can call ReadFile() multiple times with a single Importer
|
|
|
|
* instance. Actually, constructing Importer objects involves quite many
|
|
|
|
* allocations and may take some time, so it's better to reuse them as often as
|
|
|
|
* possible.
|
2008-05-05 12:36:31 +00:00
|
|
|
*
|
|
|
|
* If you need the Importer to do custom file handling to access the files,
|
2008-05-09 17:24:28 +00:00
|
|
|
* implement IOSystem and IOStream and supply an instance of your custom
|
|
|
|
* IOSystem implementation by calling SetIOHandler() before calling ReadFile().
|
|
|
|
* If you do not assign a custion IO handler, a default handler using the
|
|
|
|
* standard C++ IO logic will be used.
|
|
|
|
*
|
|
|
|
* @note One Importer instance is not thread-safe. If you use multiple
|
2009-04-24 20:53:24 +00:00
|
|
|
* threads for loading, each thread should maintain its own Importer instance.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
2009-06-21 19:44:48 +00:00
|
|
|
class ASSIMP_API Importer {
|
|
|
|
|
|
|
|
// for internal use
|
2008-06-15 10:27:08 +00:00
|
|
|
friend class BaseProcess;
|
2008-10-31 19:32:00 +00:00
|
|
|
friend class BatchLoader;
|
2008-08-28 17:35:36 +00:00
|
|
|
friend const aiScene* ::aiImportFileEx( const char*, unsigned int, aiFileIO*);
|
2009-06-21 19:44:48 +00:00
|
|
|
friend const aiScene* ::aiImportFileFromMemory( const char*,
|
|
|
|
unsigned int,unsigned int,const char*);
|
2008-06-15 10:27:08 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Constructor. Creates an empty importer object.
|
|
|
|
*
|
2009-04-24 20:53:24 +00:00
|
|
|
* Call ReadFile() to start the import process. The configuration
|
|
|
|
* property table is initially empty.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
|
|
|
Importer();
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Copy constructor.
|
|
|
|
*
|
|
|
|
* This copies the configuration properties of another Importer.
|
|
|
|
* If this Importer owns a scene it won't be copied.
|
|
|
|
* Call ReadFile() to start the import process.
|
|
|
|
*/
|
|
|
|
Importer(const Importer& other);
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Destructor. The object kept ownership of the imported data,
|
|
|
|
* which now will be destroyed along with the object.
|
|
|
|
*/
|
|
|
|
~Importer();
|
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
|
2008-08-11 17:49:02 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Registers a new loader.
|
|
|
|
*
|
|
|
|
* @param pImp Importer to be added. The Importer instance takes
|
|
|
|
* ownership of the pointer, so it will be automatically deleted
|
|
|
|
* with the Importer instance.
|
|
|
|
* @return AI_SUCCESS if the loader has been added. The registration
|
|
|
|
* fails if there is already a loader for a specific file extension.
|
|
|
|
*/
|
|
|
|
aiReturn RegisterLoader(BaseImporter* pImp);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Unregisters a loader.
|
|
|
|
*
|
|
|
|
* @param pImp Importer to be unregistered.
|
|
|
|
* @return AI_SUCCESS if the loader has been removed. The function
|
|
|
|
* fails if the loader is currently in use (this could happen
|
|
|
|
* if the #Importer instance is used by more than one thread) or
|
|
|
|
* if it has not yet been registered.
|
|
|
|
*/
|
|
|
|
aiReturn UnregisterLoader(BaseImporter* pImp);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Registers a new post-process step.
|
|
|
|
*
|
2009-05-25 17:19:20 +00:00
|
|
|
* At the moment, there's a small limitation: new post processing
|
|
|
|
* steps are added to end of the list, or in other words, executed
|
|
|
|
* last, after all built-in steps.
|
2008-08-11 17:49:02 +00:00
|
|
|
* @param pImp Post-process step to be added. The Importer instance
|
|
|
|
* takes ownership of the pointer, so it will be automatically
|
|
|
|
* deleted with the Importer instance.
|
2009-05-25 17:19:20 +00:00
|
|
|
* @return AI_SUCCESS if the step has been added correctly.
|
2008-08-11 17:49:02 +00:00
|
|
|
*/
|
|
|
|
aiReturn RegisterPPStep(BaseProcess* pImp);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Unregisters a post-process step.
|
|
|
|
*
|
|
|
|
* @param pImp Step to be unregistered.
|
|
|
|
* @return AI_SUCCESS if the step has been removed. The function
|
|
|
|
* fails if the step is currently in use (this could happen
|
|
|
|
* if the #Importer instance is used by more than one thread) or
|
|
|
|
* if it has not yet been registered.
|
|
|
|
*/
|
|
|
|
aiReturn UnregisterPPStep(BaseProcess* pImp);
|
2009-05-25 17:19:20 +00:00
|
|
|
|
2008-08-11 17:49:02 +00:00
|
|
|
|
2008-08-08 11:51:00 +00:00
|
|
|
// -------------------------------------------------------------------
|
2008-08-28 17:35:36 +00:00
|
|
|
/** Set an integer configuration property.
|
2008-08-08 11:51:00 +00:00
|
|
|
* @param szName Name of the property. All supported properties
|
2008-08-28 17:35:36 +00:00
|
|
|
* are defined in the aiConfig.g header (all constants share the
|
2010-07-10 10:53:39 +00:00
|
|
|
* prefix AI_CONFIG_XXX and are simple strings).
|
2008-08-08 11:51:00 +00:00
|
|
|
* @param iValue New value of the property
|
2008-08-28 17:35:36 +00:00
|
|
|
* @param bWasExisting Optional pointer to receive true if the
|
2010-07-10 10:53:39 +00:00
|
|
|
* property was set before. The new value replaces the previous value
|
2008-08-28 17:35:36 +00:00
|
|
|
* in this case.
|
|
|
|
* @note Property of different types (float, int, string ..) are kept
|
|
|
|
* on different stacks, so calling SetPropertyInteger() for a
|
|
|
|
* floating-point property has no effect - the loader will call
|
|
|
|
* GetPropertyFloat() to read the property, but it won't be there.
|
2008-08-08 11:51:00 +00:00
|
|
|
*/
|
2008-08-28 17:35:36 +00:00
|
|
|
void SetPropertyInteger(const char* szName, int iValue,
|
|
|
|
bool* bWasExisting = NULL);
|
|
|
|
|
2010-07-10 10:53:39 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Set a boolean configuration property. Boolean properties
|
|
|
|
* are stored on the integer stack internally so it's possible
|
|
|
|
* to set them via #SetPropertyBool and query them with
|
|
|
|
* #GetPropertyBool and vice versa.
|
|
|
|
* @see SetPropertyInteger()
|
|
|
|
*/
|
|
|
|
void SetPropertyBool(const char* szName, bool value, bool* bWasExisting = NULL) {
|
|
|
|
SetPropertyInteger(szName,value);
|
|
|
|
}
|
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Set a floating-point configuration property.
|
|
|
|
* @see SetPropertyInteger()
|
|
|
|
*/
|
|
|
|
void SetPropertyFloat(const char* szName, float fValue,
|
|
|
|
bool* bWasExisting = NULL);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Set a string configuration property.
|
|
|
|
* @see SetPropertyInteger()
|
|
|
|
*/
|
|
|
|
void SetPropertyString(const char* szName, const std::string& sValue,
|
|
|
|
bool* bWasExisting = NULL);
|
2008-08-08 11:51:00 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Get a configuration property.
|
|
|
|
* @param szName Name of the property. All supported properties
|
2008-08-28 17:35:36 +00:00
|
|
|
* are defined in the aiConfig.g header (all constants share the
|
|
|
|
* prefix AI_CONFIG_XXX).
|
|
|
|
* @param iErrorReturn Value that is returned if the property
|
|
|
|
* is not found.
|
2008-08-08 11:51:00 +00:00
|
|
|
* @return Current value of the property
|
2008-08-28 17:35:36 +00:00
|
|
|
* @note Property of different types (float, int, string ..) are kept
|
|
|
|
* on different lists, so calling SetPropertyInteger() for a
|
|
|
|
* floating-point property has no effect - the loader will call
|
|
|
|
* GetPropertyFloat() to read the property, but it won't be there.
|
2008-08-08 11:51:00 +00:00
|
|
|
*/
|
2008-08-28 17:35:36 +00:00
|
|
|
int GetPropertyInteger(const char* szName,
|
|
|
|
int iErrorReturn = 0xffffffff) const;
|
|
|
|
|
2010-07-10 10:53:39 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Get a boolean configuration property. Boolean properties
|
|
|
|
* are stored on the integer stack internally so it's possible
|
|
|
|
* to set them via #SetPropertyBool and query them with
|
|
|
|
* #GetPropertyBool and vice versa.
|
|
|
|
* @see GetPropertyInteger()
|
|
|
|
*/
|
|
|
|
bool GetPropertyBool(const char* szName, bool bErrorReturn = false) const {
|
|
|
|
return GetPropertyInteger(szName,bErrorReturn)!=0;
|
|
|
|
}
|
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Get a floating-point configuration property
|
|
|
|
* @see GetPropertyInteger()
|
|
|
|
*/
|
|
|
|
float GetPropertyFloat(const char* szName,
|
|
|
|
float fErrorReturn = 10e10f) const;
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Get a string configuration property
|
2008-10-31 19:32:00 +00:00
|
|
|
*
|
|
|
|
* The return value remains valid until the property is modified.
|
2008-08-28 17:35:36 +00:00
|
|
|
* @see GetPropertyInteger()
|
|
|
|
*/
|
2008-10-31 19:32:00 +00:00
|
|
|
const std::string& GetPropertyString(const char* szName,
|
2008-08-28 17:35:36 +00:00
|
|
|
const std::string& sErrorReturn = "") const;
|
2008-08-08 11:51:00 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
2008-05-09 17:24:28 +00:00
|
|
|
/** Supplies a custom IO handler to the importer to use to open and
|
|
|
|
* access files. If you need the importer to use custion IO logic to
|
|
|
|
* access the files, you need to provide a custom implementation of
|
|
|
|
* IOSystem and IOFile to the importer. Then create an instance of
|
|
|
|
* your custion IOSystem implementation and supply it by this function.
|
2008-05-05 12:36:31 +00:00
|
|
|
*
|
2008-05-09 17:24:28 +00:00
|
|
|
* The Importer takes ownership of the object and will destroy it
|
|
|
|
* afterwards. The previously assigned handler will be deleted.
|
2009-04-10 21:59:22 +00:00
|
|
|
* Pass NULL to take again ownership of your IOSystem and reset Assimp
|
|
|
|
* to use its default implementation.
|
2008-05-05 12:36:31 +00:00
|
|
|
*
|
2008-05-09 17:24:28 +00:00
|
|
|
* @param pIOHandler The IO handler to be used in all file accesses
|
2009-04-10 21:59:22 +00:00
|
|
|
* of the Importer.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
|
|
|
void SetIOHandler( IOSystem* pIOHandler);
|
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Retrieves the IO handler that is currently set.
|
|
|
|
* You can use IsDefaultIOHandler() to check whether the returned
|
|
|
|
* interface is the default IO handler provided by ASSIMP. The default
|
|
|
|
* handler is active as long the application doesn't supply its own
|
|
|
|
* custom IO handler via SetIOHandler().
|
|
|
|
* @return A valid IOSystem interface
|
|
|
|
*/
|
|
|
|
IOSystem* GetIOHandler();
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Checks whether a default IO handler is active
|
|
|
|
* A default handler is active as long the application doesn't
|
|
|
|
* supply its own custom IO handler via SetIOHandler().
|
|
|
|
* @return true by default
|
|
|
|
*/
|
|
|
|
bool IsDefaultIOHandler();
|
|
|
|
|
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 given set of postprocessing flags
|
|
|
|
* is supported.
|
|
|
|
*
|
|
|
|
* Some flags are mutually exclusive, others are probably
|
|
|
|
* not available because your excluded them from your
|
|
|
|
* Assimp builds. Calling this function is recommended if
|
|
|
|
* you're unsure.
|
|
|
|
*
|
|
|
|
* @param pFlags Bitwise combination of the aiPostProcess flags.
|
|
|
|
* @return true if this flag combination is not supported.
|
|
|
|
*/
|
|
|
|
bool ValidateFlags(unsigned int pFlags);
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Reads the given file and returns its contents if successful.
|
2009-01-23 21:06:43 +00:00
|
|
|
*
|
|
|
|
* If the call succeeds, the contents of the file are returned as a
|
|
|
|
* pointer to an aiScene object. The returned data is intended to be
|
|
|
|
* read-only, the importer object keeps ownership of the data and will
|
|
|
|
* destroy it upon destruction. If the import fails, NULL is returned.
|
|
|
|
* A human-readable error description can be retrieved by calling
|
|
|
|
* GetErrorString(). The previous scene will be deleted during this call.
|
|
|
|
* @param pFile Path and filename to the file to be imported.
|
|
|
|
* @param pFlags Optional post processing steps to be executed after
|
|
|
|
* a successful import. Provide a bitwise combination of the
|
2009-05-25 17:19:20 +00:00
|
|
|
* #aiPostProcessSteps flags. If you wish to inspect the imported
|
|
|
|
* scene first in order to fine-tune your post-processing setup,
|
|
|
|
* consider to use #ApplyPostProcessing().
|
2009-01-23 21:06:43 +00:00
|
|
|
* @return A pointer to the imported data, NULL if the import failed.
|
|
|
|
* The pointer to the scene remains in possession of the Importer
|
|
|
|
* instance. Use GetOrphanedScene() to take ownership of it.
|
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
|
|
|
*
|
|
|
|
* @note Assimp is able to determine the file format of a file
|
2010-03-06 10:31:37 +00:00
|
|
|
* automatically.
|
2009-01-23 21:06:43 +00:00
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
const aiScene* ReadFile(
|
|
|
|
const char* pFile,
|
|
|
|
unsigned int pFlags);
|
2009-01-23 21:06:43 +00:00
|
|
|
|
2009-06-21 19:44:48 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Reads the given file from a memory buffer and returns its
|
|
|
|
* contents if successful.
|
|
|
|
*
|
|
|
|
* If the call succeeds, the contents of the file are returned as a
|
|
|
|
* pointer to an aiScene object. The returned data is intended to be
|
|
|
|
* read-only, the importer object keeps ownership of the data and will
|
|
|
|
* destroy it upon destruction. If the import fails, NULL is returned.
|
|
|
|
* A human-readable error description can be retrieved by calling
|
|
|
|
* GetErrorString(). The previous scene will be deleted during this call.
|
|
|
|
* Calling this method doesn't affect the active IOSystem.
|
|
|
|
* @param pBuffer Pointer to the file data
|
|
|
|
* @param pLength Length of pBuffer, in bytes
|
|
|
|
* @param pFlags Optional post processing steps to be executed after
|
|
|
|
* a successful import. Provide a bitwise combination of the
|
|
|
|
* #aiPostProcessSteps flags. If you wish to inspect the imported
|
|
|
|
* scene first in order to fine-tune your post-processing setup,
|
|
|
|
* consider to use #ApplyPostProcessing().
|
|
|
|
* @param pHint An additional hint to the library. If this is a non
|
|
|
|
* empty string, the library looks for a loader to support
|
|
|
|
* the file extension specified by pHint and passes the file to
|
|
|
|
* the first matching loader. If this loader is unable to completely
|
|
|
|
* the request, the library continues and tries to determine the
|
|
|
|
* file format on its own, a task that may or may not be successful.
|
|
|
|
* Check the return value, and you'll know ...
|
|
|
|
* @return A pointer to the imported data, NULL if the import failed.
|
|
|
|
* The pointer to the scene remains in possession of the Importer
|
|
|
|
* instance. Use GetOrphanedScene() to take ownership of it.
|
|
|
|
*
|
|
|
|
* @note This is a straightforward way to decode models from memory
|
|
|
|
* buffers, but it doesn't handle model formats spreading their
|
|
|
|
* data across multiple files or even directories. Examples include
|
|
|
|
* OBJ or MD3, which outsource parts of their material stuff into
|
2010-03-06 10:31:37 +00:00
|
|
|
* external scripts. If you need the full functionality, provide
|
2009-06-21 19:44:48 +00:00
|
|
|
* a custom IOSystem to make Assimp find these files.
|
|
|
|
*/
|
2010-03-02 17:38:01 +00:00
|
|
|
const aiScene* ReadFileFromMemory(
|
|
|
|
const void* pBuffer,
|
2009-06-21 19:44:48 +00:00
|
|
|
size_t pLength,
|
|
|
|
unsigned int pFlags,
|
|
|
|
const char* pHint = "");
|
|
|
|
|
2009-05-25 17:19:20 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Apply post-processing to an already-imported scene.
|
|
|
|
*
|
|
|
|
* This is strictly equivalent to calling #ReadFile() with the same
|
|
|
|
* flags. However, you can use this separate function to inspect
|
|
|
|
* the imported scene first to fine-tune your post-processing setup.
|
|
|
|
* @param pFlags Provide a bitwise combination of the
|
|
|
|
* #aiPostProcessSteps flags.
|
|
|
|
* @return A pointer to the post-processed data. This is still the
|
|
|
|
* same as the pointer returned by #ReadFile(). However, if
|
2009-05-28 11:32:54 +00:00
|
|
|
* post-processing fails, the scene could now be NULL.
|
2009-05-25 17:19:20 +00:00
|
|
|
* That's quite a rare case, post processing steps are not really
|
|
|
|
* designed to 'fail'. To be exact, the #aiProcess_ValidateDS
|
|
|
|
* flag is currently the only post processing step which can actually
|
|
|
|
* cause the scene to be reset to NULL.
|
|
|
|
*
|
|
|
|
* @note The method does nothing if no scene is currently bound
|
2010-03-02 17:38:01 +00:00
|
|
|
* to the #Importer instance. */
|
2009-05-25 17:19:20 +00:00
|
|
|
const aiScene* ApplyPostProcessing(unsigned int pFlags);
|
|
|
|
|
2009-01-23 21:06:43 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** @brief Reads the given file and returns its contents if successful.
|
|
|
|
*
|
|
|
|
* This function is provided for backward compatibility.
|
|
|
|
* See the const char* version for detailled docs.
|
2010-03-02 17:38:01 +00:00
|
|
|
* @see ReadFile(const char*, pFlags) */
|
|
|
|
const aiScene* ReadFile(
|
|
|
|
const std::string& pFile,
|
|
|
|
unsigned int pFlags);
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Frees the current scene.
|
|
|
|
*
|
|
|
|
* The function does nothing if no scene has previously been
|
|
|
|
* read via ReadFile(). FreeScene() is called automatically by the
|
2010-03-02 17:38:01 +00:00
|
|
|
* destructor and ReadFile() itself. */
|
2009-01-12 22:06:54 +00:00
|
|
|
void FreeScene( );
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// -------------------------------------------------------------------
|
2009-01-13 18:58:07 +00:00
|
|
|
/** Returns an error description of an error that occurred in ReadFile().
|
2009-04-24 20:53:24 +00:00
|
|
|
*
|
|
|
|
* Returns an empty string if no error occurred.
|
|
|
|
* @return A description of the last error, an empty string if no
|
|
|
|
* error occurred. The string is never NULL.
|
|
|
|
*
|
|
|
|
* @note The returned function remains valid until one of the
|
2010-03-02 17:38:01 +00:00
|
|
|
* following methods is called: #ReadFile(), #FreeScene(). */
|
2009-04-24 20:53:24 +00:00
|
|
|
const char* GetErrorString() const;
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// -------------------------------------------------------------------
|
2008-08-28 17:35:36 +00:00
|
|
|
/** Returns whether a given file extension is supported by ASSIMP.
|
2009-04-24 20:53:24 +00:00
|
|
|
*
|
|
|
|
* @param szExtension Extension to be checked.
|
|
|
|
* Must include a trailing dot '.'. Example: ".3ds", ".md3".
|
|
|
|
* Cases-insensitive.
|
2010-03-02 17:38:01 +00:00
|
|
|
* @return true if the extension is supported, false otherwise */
|
2009-01-23 21:06:43 +00:00
|
|
|
bool IsExtensionSupported(const char* szExtension);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** @brief Returns whether a given file extension is supported by ASSIMP.
|
|
|
|
*
|
|
|
|
* This function is provided for backward compatibility.
|
2010-03-02 17:38:01 +00:00
|
|
|
* See the const char* version for detailed and up-to-date docs.
|
|
|
|
* @see IsExtensionSupported(const char*) */
|
2009-04-24 20:53:24 +00:00
|
|
|
inline bool IsExtensionSupported(const std::string& szExtension);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
// -------------------------------------------------------------------
|
2008-06-22 10:09:26 +00:00
|
|
|
/** Get a full list of all file extensions supported by ASSIMP.
|
2009-04-24 20:53:24 +00:00
|
|
|
*
|
|
|
|
* If a file extension is contained in the list this does of course not
|
2010-03-02 17:38:01 +00:00
|
|
|
* mean that ASSIMP is able to load all files with this extension ---
|
|
|
|
* it simply means there is an importer loaded which claims to handle
|
|
|
|
* files with this file extension.
|
|
|
|
* @param szOut String to receive the extension list.
|
|
|
|
* Format of the list: "*.3ds;*.obj;*.dae". This is useful for
|
|
|
|
* use with the WinAPI call GetOpenFileName(Ex). */
|
2009-01-23 21:06:43 +00:00
|
|
|
void GetExtensionList(aiString& szOut);
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** @brief Get a full list of all file extensions supported by ASSIMP.
|
|
|
|
*
|
|
|
|
* This function is provided for backward compatibility.
|
2010-03-02 17:38:01 +00:00
|
|
|
* See the aiString version for detailed and up-to-date docs.
|
|
|
|
* @see GetExtensionList(aiString&)*/
|
2009-01-23 21:06:43 +00:00
|
|
|
inline void GetExtensionList(std::string& szOut);
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
|
2008-08-28 17:35:36 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Find the loader corresponding to a specific file extension.
|
|
|
|
*
|
|
|
|
* This is quite similar to IsExtensionSupported() except a
|
|
|
|
* BaseImporter instance is returned.
|
2010-03-02 17:38:01 +00:00
|
|
|
* @param szExtension Extension to check for. The following formats
|
|
|
|
* are recgnized (BAH being the file extension): "BAH" (comparison
|
|
|
|
* is case-insensitive), ".bah", "*.bah" (wild card and dot
|
|
|
|
* characters at the beginning of the extension are skipped).
|
|
|
|
* @return NULL if there is no loader for the extension.*/
|
2009-01-23 21:06:43 +00:00
|
|
|
BaseImporter* FindLoader (const char* szExtension);
|
2008-08-28 17:35:36 +00:00
|
|
|
|
2010-03-02 17:38:01 +00:00
|
|
|
|
2008-05-23 12:30:52 +00:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Returns the scene loaded by the last successful call to ReadFile()
|
2008-10-27 00:36:26 +00:00
|
|
|
*
|
2010-03-02 17:38:01 +00:00
|
|
|
* @return Current scene or NULL if there is currently no scene loaded */
|
2009-01-12 22:06:54 +00:00
|
|
|
const aiScene* GetScene() const;
|
2008-10-27 00:36:26 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
/** Returns the scene loaded by the last successful call to ReadFile()
|
|
|
|
* and releases the scene from the ownership of the Importer
|
2009-01-13 18:58:07 +00:00
|
|
|
* instance. The application is now responsible for deleting the
|
2008-10-27 00:36:26 +00:00
|
|
|
* scene. Any further calls to GetScene() or GetOrphanedScene()
|
|
|
|
* will return NULL - until a new scene has been loaded via ReadFile().
|
|
|
|
*
|
|
|
|
* @return Current scene or NULL if there is currently no scene loaded
|
2010-03-08 20:21:30 +00:00
|
|
|
* @note Use this method with maximal caution, and only if you have to.
|
|
|
|
* By design, aiScene's are exclusively maintained, allocated and
|
|
|
|
* deallocated by Assimp and no one else. The reasoning behind this
|
|
|
|
* is the golden rule that deallocations should always be done
|
|
|
|
* by the module that did the original allocation because heaps
|
|
|
|
* are not necessarily shared. GetOrphanedScene() enforces you
|
|
|
|
* to delete the returned scene by yourself, but this will only
|
|
|
|
* be fine if and only if you're using the same heap as assimp.
|
|
|
|
* On Windows, it's typically fine when everything is linked
|
|
|
|
* against the multithreaded-dll version of the runtime library.
|
|
|
|
* It will work as well for static linkage with Assimp.*/
|
2009-01-12 22:06:54 +00:00
|
|
|
aiScene* GetOrphanedScene();
|
2008-05-23 12:30:52 +00:00
|
|
|
|
2008-08-08 11:51:00 +00:00
|
|
|
// -------------------------------------------------------------------
|
2009-04-24 20:53:24 +00:00
|
|
|
/** Returns the storage allocated by ASSIMP to hold the scene data
|
2008-08-08 11:51:00 +00:00
|
|
|
* in memory.
|
2009-04-24 20:53:24 +00:00
|
|
|
*
|
|
|
|
* This refers to the currently loaded file, see #ReadFile().
|
|
|
|
* @param in Data structure to be filled.
|
2010-03-02 17:38:01 +00:00
|
|
|
* @note The returned memory statistics refer to the actual
|
|
|
|
* size of the use data of the aiScene. Heap-related overhead
|
|
|
|
* is (naturally) not included.*/
|
2008-08-08 11:51:00 +00:00
|
|
|
void GetMemoryRequirements(aiMemoryInfo& in) const;
|
|
|
|
|
2008-07-30 23:00:25 +00:00
|
|
|
// -------------------------------------------------------------------
|
2009-04-24 20:53:24 +00:00
|
|
|
/** Enables "extra verbose" mode.
|
|
|
|
*
|
2010-03-02 17:38:01 +00:00
|
|
|
* 'Extra verbose' means the data structure is validated after *every*
|
|
|
|
* single post processing step to make sure everyone modifies the data
|
|
|
|
* structure in a well-defined manner. This is a debug feature and not
|
|
|
|
* intended for use in production environments. */
|
2009-01-12 22:06:54 +00:00
|
|
|
void SetExtraVerbose(bool bDo);
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
protected:
|
2008-06-22 10:09:26 +00:00
|
|
|
|
2009-04-24 20:53:24 +00:00
|
|
|
// Just because we don't want you to know how we're hacking around.
|
|
|
|
ImporterPimpl* pimpl;
|
2009-01-12 22:06:54 +00:00
|
|
|
}; //! class Importer
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-23 21:06:43 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// For compatibility, the interface of some functions taking a std::string was
|
|
|
|
// changed to const char* to avoid crashes between binary incompatible STL
|
|
|
|
// versions. This code her is inlined, so it shouldn't cause any problems.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
AI_FORCE_INLINE const aiScene* Importer::ReadFile( const std::string& pFile,
|
|
|
|
unsigned int pFlags)
|
2008-11-29 15:30:50 +00:00
|
|
|
{
|
2009-01-23 21:06:43 +00:00
|
|
|
return ReadFile(pFile.c_str(),pFlags);
|
2008-11-29 15:30:50 +00:00
|
|
|
}
|
2009-01-23 21:06:43 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
AI_FORCE_INLINE void Importer::GetExtensionList(std::string& szOut)
|
2008-11-29 15:30:50 +00:00
|
|
|
{
|
2009-01-23 21:06:43 +00:00
|
|
|
aiString s;
|
|
|
|
GetExtensionList(s);
|
|
|
|
szOut = s.data;
|
2008-11-29 15:30:50 +00:00
|
|
|
}
|
2009-01-23 21:06:43 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
AI_FORCE_INLINE bool Importer::IsExtensionSupported(
|
|
|
|
const std::string& szExtension)
|
2008-11-29 15:30:50 +00:00
|
|
|
{
|
2009-01-23 21:06:43 +00:00
|
|
|
return IsExtensionSupported(szExtension.c_str());
|
2008-11-29 15:30:50 +00:00
|
|
|
}
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
} // !namespace Assimp
|
|
|
|
#endif // INCLUDED_AI_ASSIMP_HPP
|