Assimp  v3.1.1 (June 2014)
Assimp.cpp File Reference

Implementation of the Plain-C API. More...

Classes

struct  Assimp::mpred
 Stores the LogStream objects for all active C log streams. More...
 
class  LogToCallbackRedirector
 

Namespaces

 Assimp
 MACHINE-GENERATED by scripts/ICFImporter/CppGenerator.py.
 

Typedefs

typedef std::map< aiLogStream, Assimp::LogStream *, mpredAssimp::LogStreamMap
 
typedef std::list< Assimp::LogStream * > Assimp::PredefLogStreamMap
 Stores the LogStream objects allocated by aiGetPredefinedLogStream. More...
 
typedef BatchLoader::PropertyMap Assimp::PropertyMap
 

Functions

ASSIMP_API const aiSceneaiApplyCustomizedPostProcessing (const aiScene *scene, BaseProcess *process, bool requestValidation)
 
ASSIMP_API const aiSceneaiApplyPostProcessing (const aiScene *pScene, unsigned int pFlags)
 
ASSIMP_API void aiAttachLogStream (const aiLogStream *stream)
 
ASSIMP_API aiPropertyStoreaiCreatePropertyStore (void)
 Create an empty property store. More...
 
ASSIMP_API void aiCreateQuaternionFromMatrix (aiQuaternion *quat, const aiMatrix3x3 *mat)
 
ASSIMP_API void aiDecomposeMatrix (const aiMatrix4x4 *mat, aiVector3D *scaling, aiQuaternion *rotation, aiVector3D *position)
 
ASSIMP_API void aiDetachAllLogStreams (void)
 Detach all active log streams from the libraries' logging system. More...
 
ASSIMP_API aiReturn aiDetachLogStream (const aiLogStream *stream)
 
ASSIMP_API void aiEnableVerboseLogging (aiBool d)
 Enable verbose logging. More...
 
const char * aiGetErrorString ()
 Returns the error text of the last failed import process. More...
 
void aiGetExtensionList (aiString *szOut)
 
ASSIMP_API C_STRUCT const aiImporterDescaiGetImporterDesc (const char *extension)
 Returns the Importer description for a given extension. More...
 
size_t aiGetImportFormatCount (void)
 Returns the number of import file formats available in the current Assimp build. More...
 
const aiImporterDescaiGetImportFormatDescription (size_t pIndex)
 Returns a description of the nth import file format. More...
 
void aiGetMemoryRequirements (const C_STRUCT aiScene *pIn, C_STRUCT aiMemoryInfo *in)
 Get the approximated storage required by an imported asset. More...
 
ASSIMP_API aiLogStream aiGetPredefinedLogStream (aiDefaultLogStream pStream, const char *file)
 
ASSIMP_API void aiIdentityMatrix3 (aiMatrix3x3 *mat)
 
ASSIMP_API void aiIdentityMatrix4 (aiMatrix4x4 *mat)
 
const aiSceneaiImportFile (const char *pFile, unsigned int pFlags)
 Reads the given file and returns its content. More...
 
const aiSceneaiImportFileEx (const char *pFile, unsigned int pFlags, aiFileIO *pFS)
 
const aiSceneaiImportFileExWithProperties (const char *pFile, unsigned int pFlags, aiFileIO *pFS, const aiPropertyStore *props)
 
const aiSceneaiImportFileFromMemory (const char *pBuffer, unsigned int pLength, unsigned int pFlags, const char *pHint)
 Reads the given file from a given memory buffer,. More...
 
const aiSceneaiImportFileFromMemoryWithProperties (const char *pBuffer, unsigned int pLength, unsigned int pFlags, const char *pHint, const aiPropertyStore *props)
 
aiBool aiIsExtensionSupported (const char *szExtension)
 Returns whether a given file extension is supported by ASSIMP. More...
 
ASSIMP_API void aiMultiplyMatrix3 (aiMatrix3x3 *dst, const aiMatrix3x3 *src)
 
ASSIMP_API void aiMultiplyMatrix4 (aiMatrix4x4 *dst, const aiMatrix4x4 *src)
 
void aiReleaseImport (const aiScene *pScene)
 
ASSIMP_API void aiReleasePropertyStore (aiPropertyStore *p)
 
ASSIMP_API void aiSetImportPropertyFloat (aiPropertyStore *p, const char *szName, ai_real value)
 
ASSIMP_API void aiSetImportPropertyInteger (aiPropertyStore *p, const char *szName, int value)
 
ASSIMP_API void aiSetImportPropertyMatrix (aiPropertyStore *p, const char *szName, const C_STRUCT aiMatrix4x4 *mat)
 
ASSIMP_API void aiSetImportPropertyString (aiPropertyStore *p, const char *szName, const C_STRUCT aiString *st)
 
ASSIMP_API void aiTransformVecByMatrix3 (aiVector3D *vec, const aiMatrix3x3 *mat)
 
ASSIMP_API void aiTransformVecByMatrix4 (aiVector3D *vec, const aiMatrix4x4 *mat)
 
ASSIMP_API void aiTransposeMatrix3 (aiMatrix3x3 *mat)
 
ASSIMP_API void aiTransposeMatrix4 (aiMatrix4x4 *mat)
 
void CallbackToLogRedirector (const char *msg, char *dt)
 
void Assimp::DeleteImporterInstanceList (std::vector< BaseImporter * > &out)
 will delete all registered importers. More...
 
void Assimp::GetImporterInstanceList (std::vector< BaseImporter * > &out)
 will return all registered importers. More...
 
void ReportSceneNotFoundError ()
 

Variables

static LogStreamMap Assimp::gActiveLogStreams
 Local storage of all active log streams. More...
 
static std::string Assimp::gLastErrorString
 Error message of the last failed import process. More...
 
static std::mutex gLogStreamMutex
 Global mutex to manage the access to the log-stream map. More...
 
static PredefLogStreamMap Assimp::gPredefinedStreams
 Local storage of LogStreams allocated by aiGetPredefinedLogStream. More...
 
static aiBool Assimp::gVerboseLogging = false
 Verbose logging active or not? More...
 

Detailed Description

Implementation of the Plain-C API.

Function Documentation

◆ aiApplyCustomizedPostProcessing()

ASSIMP_API const aiScene* aiApplyCustomizedPostProcessing ( const aiScene scene,
BaseProcess process,
bool  requestValidation 
)

◆ aiApplyPostProcessing()

ASSIMP_API const aiScene* aiApplyPostProcessing ( const aiScene pScene,
unsigned int  pFlags 
)

◆ aiAttachLogStream()

ASSIMP_API void aiAttachLogStream ( const aiLogStream stream)

◆ aiCreatePropertyStore()

ASSIMP_API aiPropertyStore* aiCreatePropertyStore ( void  )

Create an empty property store.

Property stores are used to collect import settings.

Returns
New property store. Property stores need to be manually destroyed using the aiReleasePropertyStore API function.

◆ aiCreateQuaternionFromMatrix()

ASSIMP_API void aiCreateQuaternionFromMatrix ( aiQuaternion quat,
const aiMatrix3x3 mat 
)

◆ aiDecomposeMatrix()

ASSIMP_API void aiDecomposeMatrix ( const aiMatrix4x4 mat,
aiVector3D scaling,
aiQuaternion rotation,
aiVector3D position 
)

◆ aiDetachAllLogStreams()

ASSIMP_API void aiDetachAllLogStreams ( void  )

Detach all active log streams from the libraries' logging system.

This ensures that the logging system is terminated properly and all resources allocated by it are actually freed. If you attached a stream, don't forget to detach it again.

See also
aiAttachLogStream
aiDetachLogStream

◆ aiDetachLogStream()

ASSIMP_API aiReturn aiDetachLogStream ( const aiLogStream stream)

◆ aiEnableVerboseLogging()

ASSIMP_API void aiEnableVerboseLogging ( aiBool  d)

Enable verbose logging.

Verbose logging includes debug-related stuff and detailed import statistics. This can have severe impact on import performance and memory consumption. However, it might be useful to find out why a file didn't read correctly.

Parameters
dAI_TRUE or AI_FALSE, your decision.

◆ aiGetErrorString()

const char* aiGetErrorString ( void  )

Returns the error text of the last failed import process.

Returns
A textual description of the error that occurred at the last import process. NULL if there was no error. There can't be an error if you got a non-NULL aiScene from aiImportFile/aiImportFileEx/aiApplyPostProcessing.

◆ aiGetExtensionList()

void aiGetExtensionList ( aiString szOut)

◆ aiGetImporterDesc()

ASSIMP_API C_STRUCT const aiImporterDesc* aiGetImporterDesc ( const char *  extension)

Returns the Importer description for a given extension.

Will return a NULL-pointer if no assigned importer desc. was found for the given extension

Parameters
extension[in] The extension to look for
Returns
A pointer showing to the ImporterDesc,
See also
aiImporterDesc.

◆ aiGetImportFormatCount()

size_t aiGetImportFormatCount ( void  )

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

Use aiGetImportFormatDescription() to retrieve infos of a specific import format.

◆ aiGetImportFormatDescription()

const aiImporterDesc* aiGetImportFormatDescription ( size_t  pIndex)

Returns a description of the nth import file format.

Use aiGetImportFormatCount() to learn how many import formats are supported.

Parameters
pIndexIndex of the import format to retrieve information for. Valid range is 0 to aiGetImportFormatCount()
Returns
A description of that specific import format. NULL if pIndex is out of range.

◆ aiGetMemoryRequirements()

void aiGetMemoryRequirements ( const C_STRUCT aiScene pIn,
C_STRUCT aiMemoryInfo in 
)

Get the approximated storage required by an imported asset.

Parameters
pInInput asset.
inData structure to be filled.

◆ aiGetPredefinedLogStream()

ASSIMP_API aiLogStream aiGetPredefinedLogStream ( aiDefaultLogStream  pStream,
const char *  file 
)

◆ aiIdentityMatrix3()

ASSIMP_API void aiIdentityMatrix3 ( aiMatrix3x3 mat)

◆ aiIdentityMatrix4()

ASSIMP_API void aiIdentityMatrix4 ( aiMatrix4x4 mat)

◆ aiImportFile()

const aiScene* aiImportFile ( const char *  pFile,
unsigned int  pFlags 
)

Reads the given file and returns its content.

If the call succeeds, the imported data is returned in an aiScene structure. The data is intended to be read-only, it stays property of the ASSIMP library and will be stable until aiReleaseImport() is called. After you're done with it, call aiReleaseImport() to free the resources associated with this file. If the import fails, NULL is returned instead. Call aiGetErrorString() to retrieve a human-readable error text.

Parameters
pFilePath and filename of the file to be imported, expected to be a null-terminated c-string. NULL is not a valid value.
pFlagsOptional post processing steps to be executed after a successful import. Provide a bitwise combination of the aiPostProcessSteps flags.
Returns
Pointer to the imported data or NULL if the import failed.

◆ aiImportFileEx()

const aiScene* aiImportFileEx ( const char *  pFile,
unsigned int  pFlags,
aiFileIO pFS 
)

◆ aiImportFileExWithProperties()

const aiScene* aiImportFileExWithProperties ( const char *  pFile,
unsigned int  pFlags,
aiFileIO pFS,
const aiPropertyStore props 
)

◆ aiImportFileFromMemory()

const aiScene* aiImportFileFromMemory ( const char *  pBuffer,
unsigned int  pLength,
unsigned int  pFlags,
const char *  pHint 
)

Reads the given file from a given memory buffer,.

If the call succeeds, the contents of the file are returned as a pointer to an aiScene object. The returned data is intended to be read-only, the importer keeps ownership of the data and will destroy it upon destruction. If the import fails, NULL is returned. A human-readable error description can be retrieved by calling aiGetErrorString().

Parameters
pBufferPointer to the file data
pLengthLength of pBuffer, in bytes
pFlagsOptional post processing steps to be executed after a successful import. Provide a bitwise combination of the aiPostProcessSteps flags. If you wish to inspect the imported scene first in order to fine-tune your post-processing setup, consider to use aiApplyPostProcessing().
pHintAn additional hint to the library. If this is a non empty string, the library looks for a loader to support the file extension specified by pHint and passes the file to the first matching loader. If this loader is unable to completely the request, the library continues and tries to determine the file format on its own, a task that may or may not be successful. Check the return value, and you'll know ...
Returns
A pointer to the imported data, NULL if the import failed.
Note
This is a straightforward way to decode models from memory buffers, but it doesn't handle model formats that spread their data across multiple files or even directories. Examples include OBJ or MD3, which outsource parts of their material info into external scripts. If you need full functionality, provide a custom IOSystem to make Assimp find these files and use the regular aiImportFileEx()/aiImportFileExWithProperties() API.

◆ aiImportFileFromMemoryWithProperties()

const aiScene* aiImportFileFromMemoryWithProperties ( const char *  pBuffer,
unsigned int  pLength,
unsigned int  pFlags,
const char *  pHint,
const aiPropertyStore props 
)

◆ aiIsExtensionSupported()

aiBool aiIsExtensionSupported ( const char *  szExtension)

Returns whether a given file extension is supported by ASSIMP.

Parameters
szExtensionExtension for which the function queries support for. Must include a leading dot '.'. Example: ".3ds", ".md3"
Returns
AI_TRUE if the file extension is supported.

◆ aiMultiplyMatrix3()

ASSIMP_API void aiMultiplyMatrix3 ( aiMatrix3x3 dst,
const aiMatrix3x3 src 
)

◆ aiMultiplyMatrix4()

ASSIMP_API void aiMultiplyMatrix4 ( aiMatrix4x4 dst,
const aiMatrix4x4 src 
)

◆ aiReleaseImport()

void aiReleaseImport ( const aiScene pScene)

◆ aiReleasePropertyStore()

ASSIMP_API void aiReleasePropertyStore ( aiPropertyStore p)

◆ aiSetImportPropertyFloat()

ASSIMP_API void aiSetImportPropertyFloat ( aiPropertyStore p,
const char *  szName,
ai_real  value 
)

◆ aiSetImportPropertyInteger()

ASSIMP_API void aiSetImportPropertyInteger ( aiPropertyStore p,
const char *  szName,
int  value 
)

◆ aiSetImportPropertyMatrix()

ASSIMP_API void aiSetImportPropertyMatrix ( aiPropertyStore p,
const char *  szName,
const C_STRUCT aiMatrix4x4 mat 
)

◆ aiSetImportPropertyString()

ASSIMP_API void aiSetImportPropertyString ( aiPropertyStore p,
const char *  szName,
const C_STRUCT aiString st 
)

◆ aiTransformVecByMatrix3()

ASSIMP_API void aiTransformVecByMatrix3 ( aiVector3D vec,
const aiMatrix3x3 mat 
)

◆ aiTransformVecByMatrix4()

ASSIMP_API void aiTransformVecByMatrix4 ( aiVector3D vec,
const aiMatrix4x4 mat 
)

◆ aiTransposeMatrix3()

ASSIMP_API void aiTransposeMatrix3 ( aiMatrix3x3 mat)

◆ aiTransposeMatrix4()

ASSIMP_API void aiTransposeMatrix4 ( aiMatrix4x4 mat)

◆ CallbackToLogRedirector()

void CallbackToLogRedirector ( const char *  msg,
char *  dt 
)

◆ ReportSceneNotFoundError()

void ReportSceneNotFoundError ( )

Variable Documentation

◆ gLogStreamMutex

std::mutex gLogStreamMutex
static

Global mutex to manage the access to the log-stream map.