Added custom root transformation for pre-transform vertices post-process step
parent
843e56c252
commit
f54c85d4e6
|
@ -57,7 +57,7 @@ using namespace Assimp;
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
PretransformVertices::PretransformVertices()
|
||||
: configKeepHierarchy (false)
|
||||
: configKeepHierarchy (false), configNormalize(false), configTransform(false), configTransformation()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -79,9 +79,13 @@ bool PretransformVertices::IsActive( unsigned int pFlags) const
|
|||
// Setup import configuration
|
||||
void PretransformVertices::SetupProperties(const Importer* pImp)
|
||||
{
|
||||
// Get the current value of AI_CONFIG_PP_PTV_KEEP_HIERARCHY and AI_CONFIG_PP_PTV_NORMALIZE
|
||||
// Get the current value of AI_CONFIG_PP_PTV_KEEP_HIERARCHY, AI_CONFIG_PP_PTV_NORMALIZE,
|
||||
// AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION and AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION
|
||||
configKeepHierarchy = (0 != pImp->GetPropertyInteger(AI_CONFIG_PP_PTV_KEEP_HIERARCHY,0));
|
||||
configNormalize = (0 != pImp->GetPropertyInteger(AI_CONFIG_PP_PTV_NORMALIZE,0));
|
||||
configTransform = (0 != pImp->GetPropertyInteger(AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION,0));
|
||||
|
||||
configTransformation = pImp->GetPropertyMatrix(AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION, aiMatrix4x4());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -439,6 +443,10 @@ void PretransformVertices::Execute( aiScene* pScene)
|
|||
const unsigned int iOldAnimationChannels = pScene->mNumAnimations;
|
||||
const unsigned int iOldNodes = CountNodes(pScene->mRootNode);
|
||||
|
||||
if(configTransform) {
|
||||
pScene->mRootNode->mTransformation = configTransformation;
|
||||
}
|
||||
|
||||
// first compute absolute transformation matrices for all nodes
|
||||
ComputeAbsoluteTransform(pScene->mRootNode);
|
||||
|
||||
|
|
|
@ -152,8 +152,10 @@ private:
|
|||
|
||||
|
||||
//! Configuration option: keep scene hierarchy as long as possible
|
||||
bool configKeepHierarchy, configNormalize;
|
||||
|
||||
bool configKeepHierarchy;
|
||||
bool configNormalize;
|
||||
bool configTransform;
|
||||
aiMatrix4x4 configTransformation;
|
||||
};
|
||||
|
||||
} // end of namespace Assimp
|
||||
|
|
|
@ -233,6 +233,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define AI_CONFIG_PP_PTV_NORMALIZE \
|
||||
"PP_PTV_NORMALIZE"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Configures the #aiProcess_PretransformVertices step to use
|
||||
* a users defined matrix as the scene root node transformation before
|
||||
* transforming vertices.
|
||||
* Property type: bool. Default value: false.
|
||||
*/
|
||||
#define AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION \
|
||||
"PP_PTV_ADD_ROOT_TRANSFORMATION"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Configures the #aiProcess_PretransformVertices step to use
|
||||
* a users defined matrix as the scene root node transformation before
|
||||
* transforming vertices. This property correspond to the 'a1' component
|
||||
* of the transformation matrix.
|
||||
* Property type: aiMatrix4x4.
|
||||
*/
|
||||
#define AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION \
|
||||
"PP_PTV_ROOT_TRANSFORMATION"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Configures the #aiProcess_FindDegenerates step to
|
||||
* remove degenerated primitives from the import - immediately.
|
||||
|
|
Loading…
Reference in New Issue