Merge branch 'master' of github.com:assimp/assimp

pull/145/merge
acgessler 2013-10-06 22:30:41 +02:00
commit 7a4edbd126
5 changed files with 27 additions and 5 deletions

View File

@ -73,6 +73,7 @@ ASSIMP_API void aiCopyScene(const aiScene* pIn, aiScene** pOut)
}
SceneCombiner::CopyScene(pOut,pIn,true);
ScenePriv(*pOut)->mIsCopy = true;
}

View File

@ -289,15 +289,16 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
const unsigned int nonIdempotentSteps = aiProcess_FlipWindingOrder | aiProcess_FlipUVs | aiProcess_MakeLeftHanded;
// Erase all pp steps that were already applied to this scene
unsigned int pp = (exp.mEnforcePP | pPreprocessing) & ~(priv
const unsigned int pp = (exp.mEnforcePP | pPreprocessing) & ~(priv && !priv->mIsCopy
? (priv->mPPStepsApplied & ~nonIdempotentSteps)
: 0u);
// If no extra postprocessing was specified, and we obtained this scene from an
// Assimp importer, apply the reverse steps automatically.
if (!pPreprocessing && priv) {
pp |= (nonIdempotentSteps & priv->mPPStepsApplied);
}
// TODO: either drop this, or document it. Otherwise it is just a bad surprise.
//if (!pPreprocessing && priv) {
// pp |= (nonIdempotentSteps & priv->mPPStepsApplied);
//}
// If the input scene is not in verbose format, but there is at least postprocessing step that relies on it,
// we need to run the MakeVerboseFormat step first.

View File

@ -53,6 +53,7 @@ struct ScenePrivateData {
ScenePrivateData()
: mOrigImporter()
, mPPStepsApplied()
, mIsCopy()
{}
// Importer that originally loaded the scene though the C-API
@ -61,6 +62,13 @@ struct ScenePrivateData {
// List of postprocessing steps already applied to the scene.
unsigned int mPPStepsApplied;
// true if the scene is a copy made with aiCopyScene()
// or the corresponding C++ API. This means that user code
// may have made modifications to it, so mPPStepsApplied
// and mOrigImporter are no longer safe to rely on and only
// serve informative purposes.
bool mIsCopy;
};
// Access private data stored in the scene

View File

@ -198,7 +198,13 @@ public:
* 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 even if it wasn't requested.
* triangulate data so they would run the step even if it wasn't requested.
*
* If assimp detects that the input scene was directly taken from the importer side of
* the library (i.e. not copied using aiCopyScene and potetially modified afterwards),
* any postprocessing steps already applied to the scene will not be applied again, unless
* they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and
* #aiProcess_FlipWindingOrder).
* @return AI_SUCCESS if everything was fine.
* @note Use aiCopyScene() to get a modifiable copy of a previously
* imported scene.*/

View File

@ -143,6 +143,12 @@ ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn);
* 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.
*
* If assimp detects that the input scene was directly taken from the importer side of
* the library (i.e. not copied using aiCopyScene and potetially modified afterwards),
* any postprocessing steps already applied to the scene will not be applied again, unless
* they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and
* #aiProcess_FlipWindingOrder).
* @return a status code indicating the result of the export
* @note Use aiCopyScene() to get a modifiable copy of a previously
* imported scene.