miniassimp
diff include/miniassimp/Importer.hpp @ 0:879c81d94345
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 28 Jan 2019 18:19:26 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/include/miniassimp/Importer.hpp Mon Jan 28 18:19:26 2019 +0200 1.3 @@ -0,0 +1,649 @@ 1.4 +/* 1.5 +--------------------------------------------------------------------------- 1.6 +Open Asset Import Library (assimp) 1.7 +--------------------------------------------------------------------------- 1.8 + 1.9 +Copyright (c) 2006-2018, assimp team 1.10 + 1.11 + 1.12 + 1.13 +All rights reserved. 1.14 + 1.15 +Redistribution and use of this software in source and binary forms, 1.16 +with or without modification, are permitted provided that the following 1.17 +conditions are met: 1.18 + 1.19 +* Redistributions of source code must retain the above 1.20 + copyright notice, this list of conditions and the 1.21 + following disclaimer. 1.22 + 1.23 +* Redistributions in binary form must reproduce the above 1.24 + copyright notice, this list of conditions and the 1.25 + following disclaimer in the documentation and/or other 1.26 + materials provided with the distribution. 1.27 + 1.28 +* Neither the name of the assimp team, nor the names of its 1.29 + contributors may be used to endorse or promote products 1.30 + derived from this software without specific prior 1.31 + written permission of the assimp team. 1.32 + 1.33 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.34 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.35 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.36 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1.37 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.38 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.39 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1.40 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1.41 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.42 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1.43 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.44 +--------------------------------------------------------------------------- 1.45 +*/ 1.46 + 1.47 +/** @file Importer.hpp 1.48 + * @brief Defines the C++-API to the Open Asset Import Library. 1.49 + */ 1.50 +#pragma once 1.51 +#ifndef AI_ASSIMP_HPP_INC 1.52 +#define AI_ASSIMP_HPP_INC 1.53 + 1.54 +#ifndef __cplusplus 1.55 +# error This header requires C++ to be used. Use assimp.h for plain C. 1.56 +#endif // __cplusplus 1.57 + 1.58 +// Public ASSIMP data structures 1.59 +#include <miniassimp/types.h> 1.60 + 1.61 +namespace Assimp { 1.62 + // ======================================================================= 1.63 + // Public interface to Assimp 1.64 + class Importer; 1.65 + class IOStream; 1.66 + class IOSystem; 1.67 + class ProgressHandler; 1.68 + 1.69 + // ======================================================================= 1.70 + // Plugin development 1.71 + // 1.72 + // Include the following headers for the declarations: 1.73 + // BaseImporter.h 1.74 + // BaseProcess.h 1.75 + class BaseImporter; 1.76 + class BaseProcess; 1.77 + class SharedPostProcessInfo; 1.78 + class BatchLoader; 1.79 + 1.80 + // ======================================================================= 1.81 + // Holy stuff, only for members of the high council of the Jedi. 1.82 + class ImporterPimpl; 1.83 +} //! namespace Assimp 1.84 + 1.85 +#define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff 1.86 + 1.87 +struct aiScene; 1.88 + 1.89 +// importerdesc.h 1.90 +struct aiImporterDesc; 1.91 + 1.92 +/** @namespace Assimp Assimp's CPP-API and all internal APIs */ 1.93 +namespace Assimp { 1.94 + 1.95 +// ---------------------------------------------------------------------------------- 1.96 +/** CPP-API: The Importer class forms an C++ interface to the functionality of the 1.97 +* Open Asset Import Library. 1.98 +* 1.99 +* Create an object of this class and call ReadFile() to import a file. 1.100 +* If the import succeeds, the function returns a pointer to the imported data. 1.101 +* The data remains property of the object, it is intended to be accessed 1.102 +* read-only. The imported data will be destroyed along with the Importer 1.103 +* object. If the import fails, ReadFile() returns a NULL pointer. In this 1.104 +* case you can retrieve a human-readable error description be calling 1.105 +* GetErrorString(). You can call ReadFile() multiple times with a single Importer 1.106 +* instance. Actually, constructing Importer objects involves quite many 1.107 +* allocations and may take some time, so it's better to reuse them as often as 1.108 +* possible. 1.109 +* 1.110 +* If you need the Importer to do custom file handling to access the files, 1.111 +* implement IOSystem and IOStream and supply an instance of your custom 1.112 +* IOSystem implementation by calling SetIOHandler() before calling ReadFile(). 1.113 +* If you do not assign a custion IO handler, a default handler using the 1.114 +* standard C++ IO logic will be used. 1.115 +* 1.116 +* @note One Importer instance is not thread-safe. If you use multiple 1.117 +* threads for loading, each thread should maintain its own Importer instance. 1.118 +*/ 1.119 +class ASSIMP_API Importer { 1.120 +private: 1.121 + Importer(const Importer& other); 1.122 + Importer &operator=(const Importer &); 1.123 + 1.124 +public: 1.125 + /** 1.126 + * @brief The upper limit for hints. 1.127 + */ 1.128 + static const unsigned int MaxLenHint = 200; 1.129 + 1.130 +public: 1.131 + 1.132 + // ------------------------------------------------------------------- 1.133 + /** Constructor. Creates an empty importer object. 1.134 + * 1.135 + * Call ReadFile() to start the import process. The configuration 1.136 + * property table is initially empty. 1.137 + */ 1.138 + Importer(); 1.139 + 1.140 + // ------------------------------------------------------------------- 1.141 + /** Destructor. The object kept ownership of the imported data, 1.142 + * which now will be destroyed along with the object. 1.143 + */ 1.144 + ~Importer(); 1.145 + 1.146 + 1.147 + // ------------------------------------------------------------------- 1.148 + /** Registers a new loader. 1.149 + * 1.150 + * @param pImp Importer to be added. The Importer instance takes 1.151 + * ownership of the pointer, so it will be automatically deleted 1.152 + * with the Importer instance. 1.153 + * @return AI_SUCCESS if the loader has been added. The registration 1.154 + * fails if there is already a loader for a specific file extension. 1.155 + */ 1.156 + aiReturn RegisterLoader(BaseImporter* pImp); 1.157 + 1.158 + // ------------------------------------------------------------------- 1.159 + /** Unregisters a loader. 1.160 + * 1.161 + * @param pImp Importer to be unregistered. 1.162 + * @return AI_SUCCESS if the loader has been removed. The function 1.163 + * fails if the loader is currently in use (this could happen 1.164 + * if the #Importer instance is used by more than one thread) or 1.165 + * if it has not yet been registered. 1.166 + */ 1.167 + aiReturn UnregisterLoader(BaseImporter* pImp); 1.168 + 1.169 + // ------------------------------------------------------------------- 1.170 + /** Registers a new post-process step. 1.171 + * 1.172 + * At the moment, there's a small limitation: new post processing 1.173 + * steps are added to end of the list, or in other words, executed 1.174 + * last, after all built-in steps. 1.175 + * @param pImp Post-process step to be added. The Importer instance 1.176 + * takes ownership of the pointer, so it will be automatically 1.177 + * deleted with the Importer instance. 1.178 + * @return AI_SUCCESS if the step has been added correctly. 1.179 + */ 1.180 + aiReturn RegisterPPStep(BaseProcess* pImp); 1.181 + 1.182 + // ------------------------------------------------------------------- 1.183 + /** Unregisters a post-process step. 1.184 + * 1.185 + * @param pImp Step to be unregistered. 1.186 + * @return AI_SUCCESS if the step has been removed. The function 1.187 + * fails if the step is currently in use (this could happen 1.188 + * if the #Importer instance is used by more than one thread) or 1.189 + * if it has not yet been registered. 1.190 + */ 1.191 + aiReturn UnregisterPPStep(BaseProcess* pImp); 1.192 + 1.193 + // ------------------------------------------------------------------- 1.194 + /** Set an integer configuration property. 1.195 + * @param szName Name of the property. All supported properties 1.196 + * are defined in the aiConfig.g header (all constants share the 1.197 + * prefix AI_CONFIG_XXX and are simple strings). 1.198 + * @param iValue New value of the property 1.199 + * @return true if the property was set before. The new value replaces 1.200 + * the previous value in this case. 1.201 + * @note Property of different types (float, int, string ..) are kept 1.202 + * on different stacks, so calling SetPropertyInteger() for a 1.203 + * floating-point property has no effect - the loader will call 1.204 + * GetPropertyFloat() to read the property, but it won't be there. 1.205 + */ 1.206 + bool SetPropertyInteger(const char* szName, int iValue); 1.207 + 1.208 + // ------------------------------------------------------------------- 1.209 + /** Set a boolean configuration property. Boolean properties 1.210 + * are stored on the integer stack internally so it's possible 1.211 + * to set them via #SetPropertyBool and query them with 1.212 + * #GetPropertyBool and vice versa. 1.213 + * @see SetPropertyInteger() 1.214 + */ 1.215 + bool SetPropertyBool(const char* szName, bool value) { 1.216 + return SetPropertyInteger(szName,value); 1.217 + } 1.218 + 1.219 + // ------------------------------------------------------------------- 1.220 + /** Set a floating-point configuration property. 1.221 + * @see SetPropertyInteger() 1.222 + */ 1.223 + bool SetPropertyFloat(const char* szName, ai_real fValue); 1.224 + 1.225 + // ------------------------------------------------------------------- 1.226 + /** Set a string configuration property. 1.227 + * @see SetPropertyInteger() 1.228 + */ 1.229 + bool SetPropertyString(const char* szName, const std::string& sValue); 1.230 + 1.231 + // ------------------------------------------------------------------- 1.232 + /** Set a matrix configuration property. 1.233 + * @see SetPropertyInteger() 1.234 + */ 1.235 + bool SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue); 1.236 + 1.237 + // ------------------------------------------------------------------- 1.238 + /** Get a configuration property. 1.239 + * @param szName Name of the property. All supported properties 1.240 + * are defined in the aiConfig.g header (all constants share the 1.241 + * prefix AI_CONFIG_XXX). 1.242 + * @param iErrorReturn Value that is returned if the property 1.243 + * is not found. 1.244 + * @return Current value of the property 1.245 + * @note Property of different types (float, int, string ..) are kept 1.246 + * on different lists, so calling SetPropertyInteger() for a 1.247 + * floating-point property has no effect - the loader will call 1.248 + * GetPropertyFloat() to read the property, but it won't be there. 1.249 + */ 1.250 + int GetPropertyInteger(const char* szName, 1.251 + int iErrorReturn = 0xffffffff) const; 1.252 + 1.253 + // ------------------------------------------------------------------- 1.254 + /** Get a boolean configuration property. Boolean properties 1.255 + * are stored on the integer stack internally so it's possible 1.256 + * to set them via #SetPropertyBool and query them with 1.257 + * #GetPropertyBool and vice versa. 1.258 + * @see GetPropertyInteger() 1.259 + */ 1.260 + bool GetPropertyBool(const char* szName, bool bErrorReturn = false) const { 1.261 + return GetPropertyInteger(szName,bErrorReturn)!=0; 1.262 + } 1.263 + 1.264 + // ------------------------------------------------------------------- 1.265 + /** Get a floating-point configuration property 1.266 + * @see GetPropertyInteger() 1.267 + */ 1.268 + ai_real GetPropertyFloat(const char* szName, 1.269 + ai_real fErrorReturn = 10e10) const; 1.270 + 1.271 + // ------------------------------------------------------------------- 1.272 + /** Get a string configuration property 1.273 + * 1.274 + * The return value remains valid until the property is modified. 1.275 + * @see GetPropertyInteger() 1.276 + */ 1.277 + const std::string GetPropertyString(const char* szName, 1.278 + const std::string& sErrorReturn = "") const; 1.279 + 1.280 + // ------------------------------------------------------------------- 1.281 + /** Get a matrix configuration property 1.282 + * 1.283 + * The return value remains valid until the property is modified. 1.284 + * @see GetPropertyInteger() 1.285 + */ 1.286 + const aiMatrix4x4 GetPropertyMatrix(const char* szName, 1.287 + const aiMatrix4x4& sErrorReturn = aiMatrix4x4()) const; 1.288 + 1.289 + // ------------------------------------------------------------------- 1.290 + /** Supplies a custom IO handler to the importer to use to open and 1.291 + * access files. If you need the importer to use custom IO logic to 1.292 + * access the files, you need to provide a custom implementation of 1.293 + * IOSystem and IOFile to the importer. Then create an instance of 1.294 + * your custom IOSystem implementation and supply it by this function. 1.295 + * 1.296 + * The Importer takes ownership of the object and will destroy it 1.297 + * afterwards. The previously assigned handler will be deleted. 1.298 + * Pass NULL to take again ownership of your IOSystem and reset Assimp 1.299 + * to use its default implementation. 1.300 + * 1.301 + * @param pIOHandler The IO handler to be used in all file accesses 1.302 + * of the Importer. 1.303 + */ 1.304 + void SetIOHandler( IOSystem* pIOHandler); 1.305 + 1.306 + // ------------------------------------------------------------------- 1.307 + /** Retrieves the IO handler that is currently set. 1.308 + * You can use #IsDefaultIOHandler() to check whether the returned 1.309 + * interface is the default IO handler provided by ASSIMP. The default 1.310 + * handler is active as long the application doesn't supply its own 1.311 + * custom IO handler via #SetIOHandler(). 1.312 + * @return A valid IOSystem interface, never NULL. 1.313 + */ 1.314 + IOSystem* GetIOHandler() const; 1.315 + 1.316 + // ------------------------------------------------------------------- 1.317 + /** Checks whether a default IO handler is active 1.318 + * A default handler is active as long the application doesn't 1.319 + * supply its own custom IO handler via #SetIOHandler(). 1.320 + * @return true by default 1.321 + */ 1.322 + bool IsDefaultIOHandler() const; 1.323 + 1.324 + // ------------------------------------------------------------------- 1.325 + /** Supplies a custom progress handler to the importer. This 1.326 + * interface exposes an #Update() callback, which is called 1.327 + * more or less periodically (please don't sue us if it 1.328 + * isn't as periodically as you'd like it to have ...). 1.329 + * This can be used to implement progress bars and loading 1.330 + * timeouts. 1.331 + * @param pHandler Progress callback interface. Pass NULL to 1.332 + * disable progress reporting. 1.333 + * @note Progress handlers can be used to abort the loading 1.334 + * at almost any time.*/ 1.335 + void SetProgressHandler ( ProgressHandler* pHandler ); 1.336 + 1.337 + // ------------------------------------------------------------------- 1.338 + /** Retrieves the progress handler that is currently set. 1.339 + * You can use #IsDefaultProgressHandler() to check whether the returned 1.340 + * interface is the default handler provided by ASSIMP. The default 1.341 + * handler is active as long the application doesn't supply its own 1.342 + * custom handler via #SetProgressHandler(). 1.343 + * @return A valid ProgressHandler interface, never NULL. 1.344 + */ 1.345 + ProgressHandler* GetProgressHandler() const; 1.346 + 1.347 + // ------------------------------------------------------------------- 1.348 + /** Checks whether a default progress handler is active 1.349 + * A default handler is active as long the application doesn't 1.350 + * supply its own custom progress handler via #SetProgressHandler(). 1.351 + * @return true by default 1.352 + */ 1.353 + bool IsDefaultProgressHandler() const; 1.354 + 1.355 + // ------------------------------------------------------------------- 1.356 + /** @brief Check whether a given set of post-processing flags 1.357 + * is supported. 1.358 + * 1.359 + * Some flags are mutually exclusive, others are probably 1.360 + * not available because your excluded them from your 1.361 + * Assimp builds. Calling this function is recommended if 1.362 + * you're unsure. 1.363 + * 1.364 + * @param pFlags Bitwise combination of the aiPostProcess flags. 1.365 + * @return true if this flag combination is fine. 1.366 + */ 1.367 + bool ValidateFlags(unsigned int pFlags) const; 1.368 + 1.369 + // ------------------------------------------------------------------- 1.370 + /** Reads the given file and returns its contents if successful. 1.371 + * 1.372 + * If the call succeeds, the contents of the file are returned as a 1.373 + * pointer to an aiScene object. The returned data is intended to be 1.374 + * read-only, the importer object keeps ownership of the data and will 1.375 + * destroy it upon destruction. If the import fails, NULL is returned. 1.376 + * A human-readable error description can be retrieved by calling 1.377 + * GetErrorString(). The previous scene will be deleted during this call. 1.378 + * @param pFile Path and filename to the file to be imported. 1.379 + * @param pFlags Optional post processing steps to be executed after 1.380 + * a successful import. Provide a bitwise combination of the 1.381 + * #aiPostProcessSteps flags. If you wish to inspect the imported 1.382 + * scene first in order to fine-tune your post-processing setup, 1.383 + * consider to use #ApplyPostProcessing(). 1.384 + * @return A pointer to the imported data, NULL if the import failed. 1.385 + * The pointer to the scene remains in possession of the Importer 1.386 + * instance. Use GetOrphanedScene() to take ownership of it. 1.387 + * 1.388 + * @note Assimp is able to determine the file format of a file 1.389 + * automatically. 1.390 + */ 1.391 + const aiScene* ReadFile( 1.392 + const char* pFile, 1.393 + unsigned int pFlags); 1.394 + 1.395 + // ------------------------------------------------------------------- 1.396 + /** Reads the given file from a memory buffer and returns its 1.397 + * contents if successful. 1.398 + * 1.399 + * If the call succeeds, the contents of the file are returned as a 1.400 + * pointer to an aiScene object. The returned data is intended to be 1.401 + * read-only, the importer object keeps ownership of the data and will 1.402 + * destroy it upon destruction. If the import fails, NULL is returned. 1.403 + * A human-readable error description can be retrieved by calling 1.404 + * GetErrorString(). The previous scene will be deleted during this call. 1.405 + * Calling this method doesn't affect the active IOSystem. 1.406 + * @param pBuffer Pointer to the file data 1.407 + * @param pLength Length of pBuffer, in bytes 1.408 + * @param pFlags Optional post processing steps to be executed after 1.409 + * a successful import. Provide a bitwise combination of the 1.410 + * #aiPostProcessSteps flags. If you wish to inspect the imported 1.411 + * scene first in order to fine-tune your post-processing setup, 1.412 + * consider to use #ApplyPostProcessing(). 1.413 + * @param pHint An additional hint to the library. If this is a non 1.414 + * empty string, the library looks for a loader to support 1.415 + * the file extension specified by pHint and passes the file to 1.416 + * the first matching loader. If this loader is unable to completely 1.417 + * the request, the library continues and tries to determine the 1.418 + * file format on its own, a task that may or may not be successful. 1.419 + * Check the return value, and you'll know ... 1.420 + * @return A pointer to the imported data, NULL if the import failed. 1.421 + * The pointer to the scene remains in possession of the Importer 1.422 + * instance. Use GetOrphanedScene() to take ownership of it. 1.423 + * 1.424 + * @note This is a straightforward way to decode models from memory 1.425 + * buffers, but it doesn't handle model formats that spread their 1.426 + * data across multiple files or even directories. Examples include 1.427 + * OBJ or MD3, which outsource parts of their material info into 1.428 + * external scripts. If you need full functionality, provide 1.429 + * a custom IOSystem to make Assimp find these files and use 1.430 + * the regular ReadFile() API. 1.431 + */ 1.432 + const aiScene* ReadFileFromMemory( 1.433 + const void* pBuffer, 1.434 + size_t pLength, 1.435 + unsigned int pFlags, 1.436 + const char* pHint = ""); 1.437 + 1.438 + // ------------------------------------------------------------------- 1.439 + /** Apply post-processing to an already-imported scene. 1.440 + * 1.441 + * This is strictly equivalent to calling #ReadFile() with the same 1.442 + * flags. However, you can use this separate function to inspect 1.443 + * the imported scene first to fine-tune your post-processing setup. 1.444 + * @param pFlags Provide a bitwise combination of the 1.445 + * #aiPostProcessSteps flags. 1.446 + * @return A pointer to the post-processed data. This is still the 1.447 + * same as the pointer returned by #ReadFile(). However, if 1.448 + * post-processing fails, the scene could now be NULL. 1.449 + * That's quite a rare case, post processing steps are not really 1.450 + * designed to 'fail'. To be exact, the #aiProcess_ValidateDS 1.451 + * flag is currently the only post processing step which can actually 1.452 + * cause the scene to be reset to NULL. 1.453 + * 1.454 + * @note The method does nothing if no scene is currently bound 1.455 + * to the #Importer instance. */ 1.456 + const aiScene* ApplyPostProcessing(unsigned int pFlags); 1.457 + 1.458 + const aiScene* ApplyCustomizedPostProcessing( BaseProcess *rootProcess, bool requestValidation ); 1.459 + 1.460 + // ------------------------------------------------------------------- 1.461 + /** @brief Reads the given file and returns its contents if successful. 1.462 + * 1.463 + * This function is provided for backward compatibility. 1.464 + * See the const char* version for detailed docs. 1.465 + * @see ReadFile(const char*, pFlags) */ 1.466 + const aiScene* ReadFile( 1.467 + const std::string& pFile, 1.468 + unsigned int pFlags); 1.469 + 1.470 + // ------------------------------------------------------------------- 1.471 + /** Frees the current scene. 1.472 + * 1.473 + * The function does nothing if no scene has previously been 1.474 + * read via ReadFile(). FreeScene() is called automatically by the 1.475 + * destructor and ReadFile() itself. */ 1.476 + void FreeScene( ); 1.477 + 1.478 + // ------------------------------------------------------------------- 1.479 + /** Returns an error description of an error that occurred in ReadFile(). 1.480 + * 1.481 + * Returns an empty string if no error occurred. 1.482 + * @return A description of the last error, an empty string if no 1.483 + * error occurred. The string is never NULL. 1.484 + * 1.485 + * @note The returned function remains valid until one of the 1.486 + * following methods is called: #ReadFile(), #FreeScene(). */ 1.487 + const char* GetErrorString() const; 1.488 + 1.489 + // ------------------------------------------------------------------- 1.490 + /** Returns the scene loaded by the last successful call to ReadFile() 1.491 + * 1.492 + * @return Current scene or NULL if there is currently no scene loaded */ 1.493 + const aiScene* GetScene() const; 1.494 + 1.495 + // ------------------------------------------------------------------- 1.496 + /** Returns the scene loaded by the last successful call to ReadFile() 1.497 + * and releases the scene from the ownership of the Importer 1.498 + * instance. The application is now responsible for deleting the 1.499 + * scene. Any further calls to GetScene() or GetOrphanedScene() 1.500 + * will return NULL - until a new scene has been loaded via ReadFile(). 1.501 + * 1.502 + * @return Current scene or NULL if there is currently no scene loaded 1.503 + * @note Use this method with maximal caution, and only if you have to. 1.504 + * By design, aiScene's are exclusively maintained, allocated and 1.505 + * deallocated by Assimp and no one else. The reasoning behind this 1.506 + * is the golden rule that deallocations should always be done 1.507 + * by the module that did the original allocation because heaps 1.508 + * are not necessarily shared. GetOrphanedScene() enforces you 1.509 + * to delete the returned scene by yourself, but this will only 1.510 + * be fine if and only if you're using the same heap as assimp. 1.511 + * On Windows, it's typically fine provided everything is linked 1.512 + * against the multithreaded-dll version of the runtime library. 1.513 + * It will work as well for static linkage with Assimp.*/ 1.514 + aiScene* GetOrphanedScene(); 1.515 + 1.516 + // ------------------------------------------------------------------- 1.517 + /** Returns whether a given file extension is supported by ASSIMP. 1.518 + * 1.519 + * @param szExtension Extension to be checked. 1.520 + * Must include a trailing dot '.'. Example: ".3ds", ".md3". 1.521 + * Cases-insensitive. 1.522 + * @return true if the extension is supported, false otherwise */ 1.523 + bool IsExtensionSupported(const char* szExtension) const; 1.524 + 1.525 + // ------------------------------------------------------------------- 1.526 + /** @brief Returns whether a given file extension is supported by ASSIMP. 1.527 + * 1.528 + * This function is provided for backward compatibility. 1.529 + * See the const char* version for detailed and up-to-date docs. 1.530 + * @see IsExtensionSupported(const char*) */ 1.531 + inline bool IsExtensionSupported(const std::string& szExtension) const; 1.532 + 1.533 + // ------------------------------------------------------------------- 1.534 + /** Get a full list of all file extensions supported by ASSIMP. 1.535 + * 1.536 + * If a file extension is contained in the list this does of course not 1.537 + * mean that ASSIMP is able to load all files with this extension --- 1.538 + * it simply means there is an importer loaded which claims to handle 1.539 + * files with this file extension. 1.540 + * @param szOut String to receive the extension list. 1.541 + * Format of the list: "*.3ds;*.obj;*.dae". This is useful for 1.542 + * use with the WinAPI call GetOpenFileName(Ex). */ 1.543 + void GetExtensionList(aiString& szOut) const; 1.544 + 1.545 + // ------------------------------------------------------------------- 1.546 + /** @brief Get a full list of all file extensions supported by ASSIMP. 1.547 + * 1.548 + * This function is provided for backward compatibility. 1.549 + * See the aiString version for detailed and up-to-date docs. 1.550 + * @see GetExtensionList(aiString&)*/ 1.551 + inline void GetExtensionList(std::string& szOut) const; 1.552 + 1.553 + // ------------------------------------------------------------------- 1.554 + /** Get the number of importers currently registered with Assimp. */ 1.555 + size_t GetImporterCount() const; 1.556 + 1.557 + // ------------------------------------------------------------------- 1.558 + /** Get meta data for the importer corresponding to a specific index.. 1.559 + * 1.560 + * For the declaration of #aiImporterDesc, include <assimp/importerdesc.h>. 1.561 + * @param index Index to query, must be within [0,GetImporterCount()) 1.562 + * @return Importer meta data structure, NULL if the index does not 1.563 + * exist or if the importer doesn't offer meta information ( 1.564 + * importers may do this at the cost of being hated by their peers).*/ 1.565 + const aiImporterDesc* GetImporterInfo(size_t index) const; 1.566 + 1.567 + // ------------------------------------------------------------------- 1.568 + /** Find the importer corresponding to a specific index. 1.569 + * 1.570 + * @param index Index to query, must be within [0,GetImporterCount()) 1.571 + * @return Importer instance. NULL if the index does not 1.572 + * exist. */ 1.573 + BaseImporter* GetImporter(size_t index) const; 1.574 + 1.575 + // ------------------------------------------------------------------- 1.576 + /** Find the importer corresponding to a specific file extension. 1.577 + * 1.578 + * This is quite similar to #IsExtensionSupported except a 1.579 + * BaseImporter instance is returned. 1.580 + * @param szExtension Extension to check for. The following formats 1.581 + * are recognized (BAH being the file extension): "BAH" (comparison 1.582 + * is case-insensitive), ".bah", "*.bah" (wild card and dot 1.583 + * characters at the beginning of the extension are skipped). 1.584 + * @return NULL if no importer is found*/ 1.585 + BaseImporter* GetImporter (const char* szExtension) const; 1.586 + 1.587 + // ------------------------------------------------------------------- 1.588 + /** Find the importer index corresponding to a specific file extension. 1.589 + * 1.590 + * @param szExtension Extension to check for. The following formats 1.591 + * are recognized (BAH being the file extension): "BAH" (comparison 1.592 + * is case-insensitive), ".bah", "*.bah" (wild card and dot 1.593 + * characters at the beginning of the extension are skipped). 1.594 + * @return (size_t)-1 if no importer is found */ 1.595 + size_t GetImporterIndex (const char* szExtension) const; 1.596 + 1.597 + // ------------------------------------------------------------------- 1.598 + /** Returns the storage allocated by ASSIMP to hold the scene data 1.599 + * in memory. 1.600 + * 1.601 + * This refers to the currently loaded file, see #ReadFile(). 1.602 + * @param in Data structure to be filled. 1.603 + * @note The returned memory statistics refer to the actual 1.604 + * size of the use data of the aiScene. Heap-related overhead 1.605 + * is (naturally) not included.*/ 1.606 + void GetMemoryRequirements(aiMemoryInfo& in) const; 1.607 + 1.608 + // ------------------------------------------------------------------- 1.609 + /** Enables "extra verbose" mode. 1.610 + * 1.611 + * 'Extra verbose' means the data structure is validated after *every* 1.612 + * single post processing step to make sure everyone modifies the data 1.613 + * structure in a well-defined manner. This is a debug feature and not 1.614 + * intended for use in production environments. */ 1.615 + void SetExtraVerbose(bool bDo); 1.616 + 1.617 + // ------------------------------------------------------------------- 1.618 + /** Private, do not use. */ 1.619 + ImporterPimpl* Pimpl() { return pimpl; } 1.620 + const ImporterPimpl* Pimpl() const { return pimpl; } 1.621 + 1.622 +protected: 1.623 + 1.624 + // Just because we don't want you to know how we're hacking around. 1.625 + ImporterPimpl* pimpl; 1.626 +}; //! class Importer 1.627 + 1.628 + 1.629 +// ---------------------------------------------------------------------------- 1.630 +// For compatibility, the interface of some functions taking a std::string was 1.631 +// changed to const char* to avoid crashes between binary incompatible STL 1.632 +// versions. This code her is inlined, so it shouldn't cause any problems. 1.633 +// ---------------------------------------------------------------------------- 1.634 + 1.635 +// ---------------------------------------------------------------------------- 1.636 +AI_FORCE_INLINE const aiScene* Importer::ReadFile( const std::string& pFile,unsigned int pFlags){ 1.637 + return ReadFile(pFile.c_str(),pFlags); 1.638 +} 1.639 +// ---------------------------------------------------------------------------- 1.640 +AI_FORCE_INLINE void Importer::GetExtensionList(std::string& szOut) const { 1.641 + aiString s; 1.642 + GetExtensionList(s); 1.643 + szOut = s.data; 1.644 +} 1.645 +// ---------------------------------------------------------------------------- 1.646 +AI_FORCE_INLINE bool Importer::IsExtensionSupported(const std::string& szExtension) const { 1.647 + return IsExtensionSupported(szExtension.c_str()); 1.648 +} 1.649 + 1.650 +} // !namespace Assimp 1.651 + 1.652 +#endif // AI_ASSIMP_HPP_INC