PostProcessing: first prototype of customized post processing.

This commit is contained in:
Kim Kulling
2016-01-27 18:49:01 +01:00
parent 11d0085f4d
commit 8bbd55a790
3 changed files with 124 additions and 12 deletions

View File

@@ -102,7 +102,7 @@ namespace Assimp
#ifndef ASSIMP_BUILD_SINGLETHREADED
/** Global mutex to manage the access to the logstream map */
/** Global mutex to manage the access to the log-stream map */
static boost::mutex gLogStreamMutex;
#endif
@@ -230,7 +230,8 @@ const aiScene* aiImportFileFromMemoryWithProperties(
const char* pHint,
const aiPropertyStore* props)
{
ai_assert(NULL != pBuffer && 0 != pLength);
ai_assert( NULL != pBuffer );
ai_assert( 0 != pLength );
const aiScene* scene = NULL;
ASSIMP_BEGIN_EXCEPTION_REGION();
@@ -319,10 +320,38 @@ ASSIMP_API const aiScene* aiApplyPostProcessing(const aiScene* pScene,
return sc;
}
// ------------------------------------------------------------------------------------------------
ASSIMP_API const aiScene *aiApplyCustomizedPostProcessing( const aiScene *scene,
BaseProcess* process,
bool requestValidation ) {
const aiScene* sc( NULL );
ASSIMP_BEGIN_EXCEPTION_REGION();
// find the importer associated with this data
const ScenePrivateData* priv = ScenePriv( scene );
if ( NULL == priv || NULL == priv->mOrigImporter ) {
ReportSceneNotFoundError();
return NULL;
}
sc = priv->mOrigImporter->ApplyCustomizedPostProcessing( process, requestValidation );
if ( !sc ) {
aiReleaseImport( scene );
return NULL;
}
ASSIMP_END_EXCEPTION_REGION( const aiScene* );
return sc;
}
// ------------------------------------------------------------------------------------------------
void CallbackToLogRedirector (const char* msg, char* dt)
{
ai_assert(NULL != msg && NULL != dt);
ai_assert( NULL != msg );
ai_assert( NULL != dt );
LogStream* s = (LogStream*)dt;
s->write(msg);
@@ -375,7 +404,7 @@ ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
#ifndef ASSIMP_BUILD_SINGLETHREADED
boost::mutex::scoped_lock lock(gLogStreamMutex);
#endif
// find the logstream associated with this data
// find the log-stream associated with this data
LogStreamMap::iterator it = gActiveLogStreams.find( *stream);
// it should be there... else the user is playing fools with us
if( it == gActiveLogStreams.end()) {
@@ -439,7 +468,6 @@ size_t aiGetImportFormatCount(void)
return Importer().GetImporterCount();
}
// ------------------------------------------------------------------------------------------------
// Returns the error text of the last failed import process.
aiBool aiIsExtensionSupported(const char* szExtension)
@@ -494,7 +522,6 @@ ASSIMP_API aiPropertyStore* aiCreatePropertyStore(void)
return reinterpret_cast<aiPropertyStore*>( new PropertyMap() );
}
// ------------------------------------------------------------------------------------------------
ASSIMP_API void aiReleasePropertyStore(aiPropertyStore* p)
{
@@ -553,7 +580,8 @@ ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore* p, const char* szName
// Rotation matrix to quaternion
ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x3* mat)
{
ai_assert(NULL != quat && NULL != mat);
ai_assert( NULL != quat );
ai_assert( NULL != mat );
*quat = aiQuaternion(*mat);
}
@@ -563,7 +591,10 @@ ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4* mat,aiVector3D* scaling,
aiQuaternion* rotation,
aiVector3D* position)
{
ai_assert(NULL != rotation && NULL != position && NULL != scaling && NULL != mat);
ai_assert( NULL != rotation );
ai_assert( NULL != position );
ai_assert( NULL != scaling );
ai_assert( NULL != mat );
mat->Decompose(*scaling,*rotation,*position);
}
@@ -587,7 +618,8 @@ ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4* mat)
ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec,
const aiMatrix3x3* mat)
{
ai_assert(NULL != mat && NULL != vec);
ai_assert( NULL != mat );
ai_assert( NULL != vec);
*vec *= (*mat);
}
@@ -595,7 +627,9 @@ ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec,
ASSIMP_API void aiTransformVecByMatrix4(aiVector3D* vec,
const aiMatrix4x4* mat)
{
ai_assert(NULL != mat && NULL != vec);
ai_assert( NULL != mat );
ai_assert( NULL != vec );
*vec *= (*mat);
}
@@ -605,7 +639,8 @@ ASSIMP_API void aiMultiplyMatrix4(
aiMatrix4x4* dst,
const aiMatrix4x4* src)
{
ai_assert(NULL != dst && NULL != src);
ai_assert( NULL != dst );
ai_assert( NULL != src );
*dst = (*dst) * (*src);
}
@@ -614,7 +649,8 @@ ASSIMP_API void aiMultiplyMatrix3(
aiMatrix3x3* dst,
const aiMatrix3x3* src)
{
ai_assert(NULL != dst && NULL != src);
ai_assert( NULL != dst );
ai_assert( NULL != src );
*dst = (*dst) * (*src);
}