assimp.hpp 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2010, ASSIMP Development Team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the ASSIMP team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the ASSIMP Development Team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /** @file assimp.hpp
  35. * @brief Defines the C++-API to the Open Asset Import Library.
  36. */
  37. #ifndef INCLUDED_AI_ASSIMP_HPP
  38. #define INCLUDED_AI_ASSIMP_HPP
  39. #ifndef __cplusplus
  40. # error This header requires C++ to be used. Use assimp.h for plain C.
  41. #endif
  42. // Public ASSIMP data structures
  43. #include "aiTypes.h"
  44. #include "aiConfig.h"
  45. #include "aiAssert.h"
  46. namespace Assimp {
  47. // =======================================================================
  48. // Public interface to Assimp
  49. class Importer;
  50. class Exporter; // export.hpp
  51. class IOStream;
  52. class IOSystem;
  53. class ProgressHandler;
  54. // =======================================================================
  55. // Plugin development
  56. //
  57. // Include the following headers for the declarations:
  58. // BaseImporter.h
  59. // BaseProcess.h
  60. class BaseImporter;
  61. class BaseProcess;
  62. class SharedPostProcessInfo;
  63. class BatchLoader;
  64. // =======================================================================
  65. // Holy stuff, only for members of the high council of the Jedi.
  66. class ImporterPimpl;
  67. class ExporterPimpl; // export.hpp
  68. } //! namespace Assimp
  69. #define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff
  70. struct aiScene;
  71. struct aiFileIO;
  72. extern "C" ASSIMP_API const aiScene* aiImportFileEx( const char*, unsigned int, aiFileIO*);
  73. extern "C" ASSIMP_API const aiScene* aiImportFileFromMemory( const char*,
  74. unsigned int,unsigned int,const char*);
  75. /** @namespace Assimp Assimp's CPP-API and all internal APIs */
  76. namespace Assimp {
  77. // ----------------------------------------------------------------------------------
  78. /** CPP-API: The Importer class forms an C++ interface to the functionality of the
  79. * Open Asset Import Library.
  80. *
  81. * Create an object of this class and call ReadFile() to import a file.
  82. * If the import succeeds, the function returns a pointer to the imported data.
  83. * The data remains property of the object, it is intended to be accessed
  84. * read-only. The imported data will be destroyed along with the Importer
  85. * object. If the import fails, ReadFile() returns a NULL pointer. In this
  86. * case you can retrieve a human-readable error description be calling
  87. * GetErrorString(). You can call ReadFile() multiple times with a single Importer
  88. * instance. Actually, constructing Importer objects involves quite many
  89. * allocations and may take some time, so it's better to reuse them as often as
  90. * possible.
  91. *
  92. * If you need the Importer to do custom file handling to access the files,
  93. * implement IOSystem and IOStream and supply an instance of your custom
  94. * IOSystem implementation by calling SetIOHandler() before calling ReadFile().
  95. * If you do not assign a custion IO handler, a default handler using the
  96. * standard C++ IO logic will be used.
  97. *
  98. * @note One Importer instance is not thread-safe. If you use multiple
  99. * threads for loading, each thread should maintain its own Importer instance.
  100. */
  101. class ASSIMP_API Importer {
  102. // for internal use
  103. friend class BaseProcess;
  104. friend class BatchLoader;
  105. friend const aiScene* ::aiImportFileEx( const char*, unsigned int, aiFileIO*);
  106. friend const aiScene* ::aiImportFileFromMemory( const char*,
  107. unsigned int,unsigned int,const char*);
  108. public:
  109. // -------------------------------------------------------------------
  110. /** Constructor. Creates an empty importer object.
  111. *
  112. * Call ReadFile() to start the import process. The configuration
  113. * property table is initially empty.
  114. */
  115. Importer();
  116. // -------------------------------------------------------------------
  117. /** Copy constructor.
  118. *
  119. * This copies the configuration properties of another Importer.
  120. * If this Importer owns a scene it won't be copied.
  121. * Call ReadFile() to start the import process.
  122. */
  123. Importer(const Importer& other);
  124. // -------------------------------------------------------------------
  125. /** Destructor. The object kept ownership of the imported data,
  126. * which now will be destroyed along with the object.
  127. */
  128. ~Importer();
  129. // -------------------------------------------------------------------
  130. /** Registers a new loader.
  131. *
  132. * @param pImp Importer to be added. The Importer instance takes
  133. * ownership of the pointer, so it will be automatically deleted
  134. * with the Importer instance.
  135. * @return AI_SUCCESS if the loader has been added. The registration
  136. * fails if there is already a loader for a specific file extension.
  137. */
  138. aiReturn RegisterLoader(BaseImporter* pImp);
  139. // -------------------------------------------------------------------
  140. /** Unregisters a loader.
  141. *
  142. * @param pImp Importer to be unregistered.
  143. * @return AI_SUCCESS if the loader has been removed. The function
  144. * fails if the loader is currently in use (this could happen
  145. * if the #Importer instance is used by more than one thread) or
  146. * if it has not yet been registered.
  147. */
  148. aiReturn UnregisterLoader(BaseImporter* pImp);
  149. // -------------------------------------------------------------------
  150. /** Registers a new post-process step.
  151. *
  152. * At the moment, there's a small limitation: new post processing
  153. * steps are added to end of the list, or in other words, executed
  154. * last, after all built-in steps.
  155. * @param pImp Post-process step to be added. The Importer instance
  156. * takes ownership of the pointer, so it will be automatically
  157. * deleted with the Importer instance.
  158. * @return AI_SUCCESS if the step has been added correctly.
  159. */
  160. aiReturn RegisterPPStep(BaseProcess* pImp);
  161. // -------------------------------------------------------------------
  162. /** Unregisters a post-process step.
  163. *
  164. * @param pImp Step to be unregistered.
  165. * @return AI_SUCCESS if the step has been removed. The function
  166. * fails if the step is currently in use (this could happen
  167. * if the #Importer instance is used by more than one thread) or
  168. * if it has not yet been registered.
  169. */
  170. aiReturn UnregisterPPStep(BaseProcess* pImp);
  171. // -------------------------------------------------------------------
  172. /** Set an integer configuration property.
  173. * @param szName Name of the property. All supported properties
  174. * are defined in the aiConfig.g header (all constants share the
  175. * prefix AI_CONFIG_XXX and are simple strings).
  176. * @param iValue New value of the property
  177. * @param bWasExisting Optional pointer to receive true if the
  178. * property was set before. The new value replaces the previous value
  179. * in this case.
  180. * @note Property of different types (float, int, string ..) are kept
  181. * on different stacks, so calling SetPropertyInteger() for a
  182. * floating-point property has no effect - the loader will call
  183. * GetPropertyFloat() to read the property, but it won't be there.
  184. */
  185. void SetPropertyInteger(const char* szName, int iValue,
  186. bool* bWasExisting = NULL);
  187. // -------------------------------------------------------------------
  188. /** Set a boolean configuration property. Boolean properties
  189. * are stored on the integer stack internally so it's possible
  190. * to set them via #SetPropertyBool and query them with
  191. * #GetPropertyBool and vice versa.
  192. * @see SetPropertyInteger()
  193. */
  194. void SetPropertyBool(const char* szName, bool value, bool* bWasExisting = NULL) {
  195. SetPropertyInteger(szName,value,bWasExisting);
  196. }
  197. // -------------------------------------------------------------------
  198. /** Set a floating-point configuration property.
  199. * @see SetPropertyInteger()
  200. */
  201. void SetPropertyFloat(const char* szName, float fValue,
  202. bool* bWasExisting = NULL);
  203. // -------------------------------------------------------------------
  204. /** Set a string configuration property.
  205. * @see SetPropertyInteger()
  206. */
  207. void SetPropertyString(const char* szName, const std::string& sValue,
  208. bool* bWasExisting = NULL);
  209. // -------------------------------------------------------------------
  210. /** Get a configuration property.
  211. * @param szName Name of the property. All supported properties
  212. * are defined in the aiConfig.g header (all constants share the
  213. * prefix AI_CONFIG_XXX).
  214. * @param iErrorReturn Value that is returned if the property
  215. * is not found.
  216. * @return Current value of the property
  217. * @note Property of different types (float, int, string ..) are kept
  218. * on different lists, so calling SetPropertyInteger() for a
  219. * floating-point property has no effect - the loader will call
  220. * GetPropertyFloat() to read the property, but it won't be there.
  221. */
  222. int GetPropertyInteger(const char* szName,
  223. int iErrorReturn = 0xffffffff) const;
  224. // -------------------------------------------------------------------
  225. /** Get a boolean configuration property. Boolean properties
  226. * are stored on the integer stack internally so it's possible
  227. * to set them via #SetPropertyBool and query them with
  228. * #GetPropertyBool and vice versa.
  229. * @see GetPropertyInteger()
  230. */
  231. bool GetPropertyBool(const char* szName, bool bErrorReturn = false) const {
  232. return GetPropertyInteger(szName,bErrorReturn)!=0;
  233. }
  234. // -------------------------------------------------------------------
  235. /** Get a floating-point configuration property
  236. * @see GetPropertyInteger()
  237. */
  238. float GetPropertyFloat(const char* szName,
  239. float fErrorReturn = 10e10f) const;
  240. // -------------------------------------------------------------------
  241. /** Get a string configuration property
  242. *
  243. * The return value remains valid until the property is modified.
  244. * @see GetPropertyInteger()
  245. */
  246. const std::string& GetPropertyString(const char* szName,
  247. const std::string& sErrorReturn = "") const;
  248. // -------------------------------------------------------------------
  249. /** Supplies a custom IO handler to the importer to use to open and
  250. * access files. If you need the importer to use custion IO logic to
  251. * access the files, you need to provide a custom implementation of
  252. * IOSystem and IOFile to the importer. Then create an instance of
  253. * your custion IOSystem implementation and supply it by this function.
  254. *
  255. * The Importer takes ownership of the object and will destroy it
  256. * afterwards. The previously assigned handler will be deleted.
  257. * Pass NULL to take again ownership of your IOSystem and reset Assimp
  258. * to use its default implementation.
  259. *
  260. * @param pIOHandler The IO handler to be used in all file accesses
  261. * of the Importer.
  262. */
  263. void SetIOHandler( IOSystem* pIOHandler);
  264. // -------------------------------------------------------------------
  265. /** Retrieves the IO handler that is currently set.
  266. * You can use #IsDefaultIOHandler() to check whether the returned
  267. * interface is the default IO handler provided by ASSIMP. The default
  268. * handler is active as long the application doesn't supply its own
  269. * custom IO handler via #SetIOHandler().
  270. * @return A valid IOSystem interface, never NULL.
  271. */
  272. IOSystem* GetIOHandler() const;
  273. // -------------------------------------------------------------------
  274. /** Checks whether a default IO handler is active
  275. * A default handler is active as long the application doesn't
  276. * supply its own custom IO handler via #SetIOHandler().
  277. * @return true by default
  278. */
  279. bool IsDefaultIOHandler() const;
  280. // -------------------------------------------------------------------
  281. /** Supplies a custom progress handler to the importer. This
  282. * interface exposes a #Update() callback, which is called
  283. * more or less periodically (please don't sue us if it
  284. * isn't as periodically as you'd like it to have ...).
  285. * This can be used to implement progress bars and loading
  286. * timeouts.
  287. * @param pHandler Progress callback interface. Pass NULL to
  288. * disable progress reporting.
  289. * @note Progress handlers can be used to abort the loading
  290. * at almost any time.*/
  291. void SetProgressHandler ( ProgressHandler* pHandler );
  292. // -------------------------------------------------------------------
  293. /** Retrieves the progress handler that is currently set.
  294. * You can use #IsDefaultProgressHandler() to check whether the returned
  295. * interface is the default handler provided by ASSIMP. The default
  296. * handler is active as long the application doesn't supply its own
  297. * custom handler via #SetProgressHandler().
  298. * @return A valid ProgressHandler interface, never NULL.
  299. */
  300. ProgressHandler* GetProgressHandler() const;
  301. // -------------------------------------------------------------------
  302. /** Checks whether a default progress handler is active
  303. * A default handler is active as long the application doesn't
  304. * supply its own custom progress handler via #SetProgressHandler().
  305. * @return true by default
  306. */
  307. bool IsDefaultProgressHandler() const;
  308. // -------------------------------------------------------------------
  309. /** @brief Check whether a given set of postprocessing flags
  310. * is supported.
  311. *
  312. * Some flags are mutually exclusive, others are probably
  313. * not available because your excluded them from your
  314. * Assimp builds. Calling this function is recommended if
  315. * you're unsure.
  316. *
  317. * @param pFlags Bitwise combination of the aiPostProcess flags.
  318. * @return true if this flag combination is fine.
  319. */
  320. bool ValidateFlags(unsigned int pFlags) const;
  321. // -------------------------------------------------------------------
  322. /** Reads the given file and returns its contents if successful.
  323. *
  324. * If the call succeeds, the contents of the file are returned as a
  325. * pointer to an aiScene object. The returned data is intended to be
  326. * read-only, the importer object keeps ownership of the data and will
  327. * destroy it upon destruction. If the import fails, NULL is returned.
  328. * A human-readable error description can be retrieved by calling
  329. * GetErrorString(). The previous scene will be deleted during this call.
  330. * @param pFile Path and filename to the file to be imported.
  331. * @param pFlags Optional post processing steps to be executed after
  332. * a successful import. Provide a bitwise combination of the
  333. * #aiPostProcessSteps flags. If you wish to inspect the imported
  334. * scene first in order to fine-tune your post-processing setup,
  335. * consider to use #ApplyPostProcessing().
  336. * @return A pointer to the imported data, NULL if the import failed.
  337. * The pointer to the scene remains in possession of the Importer
  338. * instance. Use GetOrphanedScene() to take ownership of it.
  339. *
  340. * @note Assimp is able to determine the file format of a file
  341. * automatically.
  342. */
  343. const aiScene* ReadFile(
  344. const char* pFile,
  345. unsigned int pFlags);
  346. // -------------------------------------------------------------------
  347. /** Reads the given file from a memory buffer and returns its
  348. * contents if successful.
  349. *
  350. * If the call succeeds, the contents of the file are returned as a
  351. * pointer to an aiScene object. The returned data is intended to be
  352. * read-only, the importer object keeps ownership of the data and will
  353. * destroy it upon destruction. If the import fails, NULL is returned.
  354. * A human-readable error description can be retrieved by calling
  355. * GetErrorString(). The previous scene will be deleted during this call.
  356. * Calling this method doesn't affect the active IOSystem.
  357. * @param pBuffer Pointer to the file data
  358. * @param pLength Length of pBuffer, in bytes
  359. * @param pFlags Optional post processing steps to be executed after
  360. * a successful import. Provide a bitwise combination of the
  361. * #aiPostProcessSteps flags. If you wish to inspect the imported
  362. * scene first in order to fine-tune your post-processing setup,
  363. * consider to use #ApplyPostProcessing().
  364. * @param pHint An additional hint to the library. If this is a non
  365. * empty string, the library looks for a loader to support
  366. * the file extension specified by pHint and passes the file to
  367. * the first matching loader. If this loader is unable to completely
  368. * the request, the library continues and tries to determine the
  369. * file format on its own, a task that may or may not be successful.
  370. * Check the return value, and you'll know ...
  371. * @return A pointer to the imported data, NULL if the import failed.
  372. * The pointer to the scene remains in possession of the Importer
  373. * instance. Use GetOrphanedScene() to take ownership of it.
  374. *
  375. * @note This is a straightforward way to decode models from memory
  376. * buffers, but it doesn't handle model formats spreading their
  377. * data across multiple files or even directories. Examples include
  378. * OBJ or MD3, which outsource parts of their material stuff into
  379. * external scripts. If you need the full functionality, provide
  380. * a custom IOSystem to make Assimp find these files.
  381. */
  382. const aiScene* ReadFileFromMemory(
  383. const void* pBuffer,
  384. size_t pLength,
  385. unsigned int pFlags,
  386. const char* pHint = "");
  387. // -------------------------------------------------------------------
  388. /** Apply post-processing to an already-imported scene.
  389. *
  390. * This is strictly equivalent to calling #ReadFile() with the same
  391. * flags. However, you can use this separate function to inspect
  392. * the imported scene first to fine-tune your post-processing setup.
  393. * @param pFlags Provide a bitwise combination of the
  394. * #aiPostProcessSteps flags.
  395. * @return A pointer to the post-processed data. This is still the
  396. * same as the pointer returned by #ReadFile(). However, if
  397. * post-processing fails, the scene could now be NULL.
  398. * That's quite a rare case, post processing steps are not really
  399. * designed to 'fail'. To be exact, the #aiProcess_ValidateDS
  400. * flag is currently the only post processing step which can actually
  401. * cause the scene to be reset to NULL.
  402. *
  403. * @note The method does nothing if no scene is currently bound
  404. * to the #Importer instance. */
  405. const aiScene* ApplyPostProcessing(unsigned int pFlags);
  406. // -------------------------------------------------------------------
  407. /** @brief Reads the given file and returns its contents if successful.
  408. *
  409. * This function is provided for backward compatibility.
  410. * See the const char* version for detailled docs.
  411. * @see ReadFile(const char*, pFlags) */
  412. const aiScene* ReadFile(
  413. const std::string& pFile,
  414. unsigned int pFlags);
  415. // -------------------------------------------------------------------
  416. /** Frees the current scene.
  417. *
  418. * The function does nothing if no scene has previously been
  419. * read via ReadFile(). FreeScene() is called automatically by the
  420. * destructor and ReadFile() itself. */
  421. void FreeScene( );
  422. // -------------------------------------------------------------------
  423. /** Returns an error description of an error that occurred in ReadFile().
  424. *
  425. * Returns an empty string if no error occurred.
  426. * @return A description of the last error, an empty string if no
  427. * error occurred. The string is never NULL.
  428. *
  429. * @note The returned function remains valid until one of the
  430. * following methods is called: #ReadFile(), #FreeScene(). */
  431. const char* GetErrorString() const;
  432. // -------------------------------------------------------------------
  433. /** Returns whether a given file extension is supported by ASSIMP.
  434. *
  435. * @param szExtension Extension to be checked.
  436. * Must include a trailing dot '.'. Example: ".3ds", ".md3".
  437. * Cases-insensitive.
  438. * @return true if the extension is supported, false otherwise */
  439. bool IsExtensionSupported(const char* szExtension) const;
  440. // -------------------------------------------------------------------
  441. /** @brief Returns whether a given file extension is supported by ASSIMP.
  442. *
  443. * This function is provided for backward compatibility.
  444. * See the const char* version for detailed and up-to-date docs.
  445. * @see IsExtensionSupported(const char*) */
  446. inline bool IsExtensionSupported(const std::string& szExtension) const;
  447. // -------------------------------------------------------------------
  448. /** Get a full list of all file extensions supported by ASSIMP.
  449. *
  450. * If a file extension is contained in the list this does of course not
  451. * mean that ASSIMP is able to load all files with this extension ---
  452. * it simply means there is an importer loaded which claims to handle
  453. * files with this file extension.
  454. * @param szOut String to receive the extension list.
  455. * Format of the list: "*.3ds;*.obj;*.dae". This is useful for
  456. * use with the WinAPI call GetOpenFileName(Ex). */
  457. void GetExtensionList(aiString& szOut) const;
  458. // -------------------------------------------------------------------
  459. /** @brief Get a full list of all file extensions supported by ASSIMP.
  460. *
  461. * This function is provided for backward compatibility.
  462. * See the aiString version for detailed and up-to-date docs.
  463. * @see GetExtensionList(aiString&)*/
  464. inline void GetExtensionList(std::string& szOut) const;
  465. // -------------------------------------------------------------------
  466. /** Find the loader corresponding to a specific file extension.
  467. *
  468. * This is quite similar to IsExtensionSupported() except a
  469. * BaseImporter instance is returned.
  470. * @param szExtension Extension to check for. The following formats
  471. * are recgnized (BAH being the file extension): "BAH" (comparison
  472. * is case-insensitive), ".bah", "*.bah" (wild card and dot
  473. * characters at the beginning of the extension are skipped).
  474. * @return NULL if there is no loader for the extension.*/
  475. BaseImporter* FindLoader (const char* szExtension) const;
  476. // -------------------------------------------------------------------
  477. /** Returns the scene loaded by the last successful call to ReadFile()
  478. *
  479. * @return Current scene or NULL if there is currently no scene loaded */
  480. const aiScene* GetScene() const;
  481. // -------------------------------------------------------------------
  482. /** Returns the scene loaded by the last successful call to ReadFile()
  483. * and releases the scene from the ownership of the Importer
  484. * instance. The application is now responsible for deleting the
  485. * scene. Any further calls to GetScene() or GetOrphanedScene()
  486. * will return NULL - until a new scene has been loaded via ReadFile().
  487. *
  488. * @return Current scene or NULL if there is currently no scene loaded
  489. * @note Use this method with maximal caution, and only if you have to.
  490. * By design, aiScene's are exclusively maintained, allocated and
  491. * deallocated by Assimp and no one else. The reasoning behind this
  492. * is the golden rule that deallocations should always be done
  493. * by the module that did the original allocation because heaps
  494. * are not necessarily shared. GetOrphanedScene() enforces you
  495. * to delete the returned scene by yourself, but this will only
  496. * be fine if and only if you're using the same heap as assimp.
  497. * On Windows, it's typically fine when everything is linked
  498. * against the multithreaded-dll version of the runtime library.
  499. * It will work as well for static linkage with Assimp.*/
  500. aiScene* GetOrphanedScene();
  501. // -------------------------------------------------------------------
  502. /** Returns the storage allocated by ASSIMP to hold the scene data
  503. * in memory.
  504. *
  505. * This refers to the currently loaded file, see #ReadFile().
  506. * @param in Data structure to be filled.
  507. * @note The returned memory statistics refer to the actual
  508. * size of the use data of the aiScene. Heap-related overhead
  509. * is (naturally) not included.*/
  510. void GetMemoryRequirements(aiMemoryInfo& in) const;
  511. // -------------------------------------------------------------------
  512. /** Enables "extra verbose" mode.
  513. *
  514. * 'Extra verbose' means the data structure is validated after *every*
  515. * single post processing step to make sure everyone modifies the data
  516. * structure in a well-defined manner. This is a debug feature and not
  517. * intended for use in production environments. */
  518. void SetExtraVerbose(bool bDo);
  519. protected:
  520. // Just because we don't want you to know how we're hacking around.
  521. ImporterPimpl* pimpl;
  522. }; //! class Importer
  523. // ----------------------------------------------------------------------------
  524. // For compatibility, the interface of some functions taking a std::string was
  525. // changed to const char* to avoid crashes between binary incompatible STL
  526. // versions. This code her is inlined, so it shouldn't cause any problems.
  527. // ----------------------------------------------------------------------------
  528. // ----------------------------------------------------------------------------
  529. AI_FORCE_INLINE const aiScene* Importer::ReadFile( const std::string& pFile,unsigned int pFlags){
  530. return ReadFile(pFile.c_str(),pFlags);
  531. }
  532. // ----------------------------------------------------------------------------
  533. AI_FORCE_INLINE void Importer::GetExtensionList(std::string& szOut) const {
  534. aiString s;
  535. GetExtensionList(s);
  536. szOut = s.data;
  537. }
  538. // ----------------------------------------------------------------------------
  539. AI_FORCE_INLINE bool Importer::IsExtensionSupported(const std::string& szExtension) const {
  540. return IsExtensionSupported(szExtension.c_str());
  541. }
  542. } // !namespace Assimp
  543. #endif // INCLUDED_AI_ASSIMP_HPP