Assimp  v3.0 (July 2012)
Classes | Functions
cexport.h File Reference

Defines the C-API for the Assimp export interface. More...

Classes

struct  aiExportDataBlob
 Describes a blob of exported scene data. More...
struct  aiExportFormatDesc
 Describes an file format which Assimp can export to. More...

Functions

ASSIMP_API void aiCopyScene (const aiScene *pIn, aiScene **pOut)
 Create a modifyable copy of a scene.
ASSIMP_API aiReturn aiExportScene (const aiScene *pScene, const char *pFormatId, const char *pFileName, unsigned int pPreprocessing)
 Exports the given scene to a chosen file format and writes the result file(s) to disk.
ASSIMP_API aiReturn aiExportSceneEx (const aiScene *pScene, const char *pFormatId, const char *pFileName, aiFileIO *pIO, unsigned int pPreprocessing)
 Exports the given scene to a chosen file format using custom IO logic supplied by you.
ASSIMP_API const aiExportDataBlobaiExportSceneToBlob (const aiScene *pScene, const char *pFormatId, unsigned int pPreprocessing)
 Exports the given scene to a chosen file format.
ASSIMP_API size_t aiGetExportFormatCount (void)
 Returns the number of export file formats available in the current Assimp build.
ASSIMP_API const
aiExportFormatDesc
aiGetExportFormatDescription (size_t pIndex)
 Returns a description of the nth export file format.
ASSIMP_API void aiReleaseExportBlob (const aiExportDataBlob *pData)
 Releases the memory associated with the given exported data.

Detailed Description

Defines the C-API for the Assimp export interface.


Function Documentation

ASSIMP_API void aiCopyScene ( const aiScene pIn,
aiScene **  pOut 
)

Create a modifyable copy of a scene.

This is useful to import files via Assimp, change their topology and export them again. Since the scene returned by the various importer functions is const, a modifyable copy is needed.

Parameters:
pInValid scene to be copied
pOutReceives a modifyable copy of the scene.
ASSIMP_API aiReturn aiExportScene ( const aiScene pScene,
const char *  pFormatId,
const char *  pFileName,
unsigned int  pPreprocessing 
)

Exports the given scene to a chosen file format and writes the result file(s) to disk.

Parameters:
pSceneThe scene to export. Stays in possession of the caller, is not changed by the function. The scene is expected to conform to Assimp's Importer output format as specified in the Data Structures Page . In short, this means the model data should use a right-handed coordinate systems, face winding should be counter-clockwise and the UV coordinate origin is assumed to be in the upper left. If your input data uses different conventions, have a look at the last parameter.
pFormatIdID string to specify to which format you want to export to. Use aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available.
pFileNameOutput file to write
pIOcustom IO implementation to be used. Use this if you use your own storage methods. If none is supplied, a default implementation using standard file IO is used. Note that aiExportSceneToBlob is provided as convenience function to export to memory buffers.
pPreprocessingAccepts any choice of the #aiPostProcessing enumerated flags, but in reality only a subset of them makes sense here. Specifying 'preprocessing' flags is useful if the input scene does not conform to Assimp's default conventions as specified in the Data Structures Page . In short, this means the geometry data should use a right-handed coordinate systems, face winding should be counter-clockwise and the UV coordinate origin is assumed to be in the upper left. The aiProcess_MakeLeftHanded, aiProcess_FlipUVs and aiProcess_FlipWindingOrder flags are used in the import side to allow users to have those defaults automatically adapted to their conventions. Specifying those flags for exporting has the opposite effect, respectively. Some other of the aiPostProcessSteps enumerated values may be useful as well, but you'll need to try out what their effect on the exported file is. Many formats impose their own restrictions on the structure of the geometry stored therein, so some preprocessing may have little or no effect at all, or may be redundant as exporters would apply them anyhow. A good example is triangulation - whilst you can enforce it by specifying the aiProcess_Triangulate flag, most export formats support only triangulate data so they would run the step anyway.
Returns:
a status code indicating the result of the export
ASSIMP_API aiReturn aiExportSceneEx ( const aiScene pScene,
const char *  pFormatId,
const char *  pFileName,
aiFileIO pIO,
unsigned int  pPreprocessing 
)

Exports the given scene to a chosen file format using custom IO logic supplied by you.

Parameters:
pSceneThe scene to export. Stays in possession of the caller, is not changed by the function.
pFormatIdID string to specify to which format you want to export to. Use aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available.
pFileNameOutput file to write
pIOcustom IO implementation to be used. Use this if you use your own storage methods. If none is supplied, a default implementation using standard file IO is used. Note that aiExportSceneToBlob is provided as convenience function to export to memory buffers.
pPreprocessingPlease see the documentation for aiExportScene
Returns:
a status code indicating the result of the export
Note:
Include <aiFileIO.h> for the definition of aiFileIO.
ASSIMP_API const aiExportDataBlob* aiExportSceneToBlob ( const aiScene pScene,
const char *  pFormatId,
unsigned int  pPreprocessing 
)

Exports the given scene to a chosen file format.

Returns the exported data as a binary blob which you can write into a file or something. When you're done with the data, use aiReleaseExportBlob() to free the resources associated with the export.

Parameters:
pSceneThe scene to export. Stays in possession of the caller, is not changed by the function.
pFormatIdID string to specify to which format you want to export to. Use aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available.
pPreprocessingPlease see the documentation for aiExportScene
Returns:
the exported data or NULL in case of error
ASSIMP_API size_t aiGetExportFormatCount ( void  )

Returns the number of export file formats available in the current Assimp build.

Use aiGetExportFormatDescription() to retrieve infos of a specific export format.

ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription ( size_t  pIndex)

Returns a description of the nth export file format.

Use aiGetExportFormatCount() to learn how many export formats are supported.

Parameters:
pIndexIndex of the export format to retrieve information for. Valid range is 0 to aiGetExportFormatCount()
Returns:
A description of that specific export format. NULL if pIndex is out of range.
ASSIMP_API void aiReleaseExportBlob ( const aiExportDataBlob pData)

Releases the memory associated with the given exported data.

Use this function to free a data blob returned by aiExportScene().

Parameters:
pDatathe data blob returned by aiExportSceneToBlob