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