Add aiFreeScene() API for symmetry with aiCopyScene.

pull/89/merge
Alexander Gessler 2013-09-02 21:32:20 +02:00
parent de7b1aaa50
commit 0edb78d940
2 changed files with 20 additions and 3 deletions

View File

@ -64,6 +64,7 @@ ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex
return Exporter().GetExportFormatDescription(pIndex); return Exporter().GetExportFormatDescription(pIndex);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
ASSIMP_API void aiCopyScene(const aiScene* pIn, aiScene** pOut) ASSIMP_API void aiCopyScene(const aiScene* pIn, aiScene** pOut)
{ {
@ -74,6 +75,16 @@ ASSIMP_API void aiCopyScene(const aiScene* pIn, aiScene** pOut)
SceneCombiner::CopyScene(pOut,pIn,true); SceneCombiner::CopyScene(pOut,pIn,true);
} }
// ------------------------------------------------------------------------------------------------
ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn)
{
// note: aiReleaseImport() is also able to delete scene copies, but in addition
// it also handles scenes with import metadata.
delete pIn;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
ASSIMP_API aiReturn aiExportScene( const aiScene* pScene, const char* pFormatId, const char* pFileName, unsigned int pPreprocessing ) ASSIMP_API aiReturn aiExportScene( const aiScene* pScene, const char* pFormatId, const char* pFileName, unsigned int pPreprocessing )
{ {

View File

@ -95,16 +95,22 @@ ASSIMP_API const C_STRUCT aiExportFormatDesc* aiGetExportFormatDescription( size
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Create a modifyable copy of a scene. /** Create a modifiable copy of a scene.
* This is useful to import files via Assimp, change their topology and * This is useful to import files via Assimp, change their topology and
* export them again. Since the scene returned by the various importer functions * export them again. Since the scene returned by the various importer functions
* is const, a modifyable copy is needed. * is const, a modifiable copy is needed.
* @param pIn Valid scene to be copied * @param pIn Valid scene to be copied
* @param pOut Receives a modifyable copy of the scene. * @param pOut Receives a modifyable copy of the scene. Use aiFreeScene() to
* delete it again.
*/ */
ASSIMP_API void aiCopyScene(const C_STRUCT aiScene* pIn, ASSIMP_API void aiCopyScene(const C_STRUCT aiScene* pIn,
C_STRUCT aiScene** pOut); C_STRUCT aiScene** pOut);
// --------------------------------------------------------------------------------
/** Frees a scene copy created using aiCopyScene() */
ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Exports the given scene to a chosen file format and writes the result file(s) to disk. /** Exports the given scene to a chosen file format and writes the result file(s) to disk.
* @param pScene The scene to export. Stays in possession of the caller, is not changed by the function. * @param pScene The scene to export. Stays in possession of the caller, is not changed by the function.