update assimp
This commit is contained in:
@@ -75,7 +75,7 @@ void ScaleProcess::SetupProperties( const Importer* pImp ) {
|
||||
// File scaling * Application Scaling
|
||||
float importerScale = pImp->GetPropertyFloat( AI_CONFIG_APP_SCALE_KEY, 1.0f );
|
||||
|
||||
// apply scale to the scale
|
||||
// apply scale to the scale
|
||||
// helps prevent bugs with backward compatibility for anyone using normal scaling.
|
||||
mScale *= importerScale;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||
if(mScale == 1.0f) {
|
||||
return; // nothing to scale
|
||||
}
|
||||
|
||||
|
||||
ai_assert( mScale != 0 );
|
||||
ai_assert( nullptr != pScene );
|
||||
ai_assert( nullptr != pScene->mRootNode );
|
||||
@@ -96,7 +96,7 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||
if ( nullptr == pScene->mRootNode ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Process animations and update position transform to new unit system
|
||||
for( unsigned int animationID = 0; animationID < pScene->mNumAnimations; animationID++ )
|
||||
{
|
||||
@@ -105,7 +105,7 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||
for( unsigned int animationChannel = 0; animationChannel < animation->mNumChannels; animationChannel++)
|
||||
{
|
||||
aiNodeAnim* anim = animation->mChannels[animationChannel];
|
||||
|
||||
|
||||
for( unsigned int posKey = 0; posKey < anim->mNumPositionKeys; posKey++)
|
||||
{
|
||||
aiVectorKey& vectorKey = anim->mPositionKeys[posKey];
|
||||
@@ -116,9 +116,9 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||
|
||||
for( unsigned int meshID = 0; meshID < pScene->mNumMeshes; meshID++)
|
||||
{
|
||||
aiMesh *mesh = pScene->mMeshes[meshID];
|
||||
|
||||
// Reconstruct mesh vertexes to the new unit system
|
||||
aiMesh *mesh = pScene->mMeshes[meshID];
|
||||
|
||||
// Reconstruct mesh vertices to the new unit system
|
||||
for( unsigned int vertexID = 0; vertexID < mesh->mNumVertices; vertexID++)
|
||||
{
|
||||
aiVector3D& vertex = mesh->mVertices[vertexID];
|
||||
@@ -129,9 +129,9 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||
// bone placement / scaling
|
||||
for( unsigned int boneID = 0; boneID < mesh->mNumBones; boneID++)
|
||||
{
|
||||
// Reconstruct matrix by transform rather than by scale
|
||||
// Reconstruct matrix by transform rather than by scale
|
||||
// This prevent scale values being changed which can
|
||||
// be meaningful in some cases
|
||||
// be meaningful in some cases
|
||||
// like when you want the modeller to see 1:1 compatibility.
|
||||
aiBone* bone = mesh->mBones[boneID];
|
||||
|
||||
@@ -139,10 +139,10 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||
aiQuaternion rotation;
|
||||
|
||||
bone->mOffsetMatrix.Decompose( scale, rotation, pos);
|
||||
|
||||
|
||||
aiMatrix4x4 translation;
|
||||
aiMatrix4x4::Translation( pos * mScale, translation );
|
||||
|
||||
|
||||
aiMatrix4x4 scaling;
|
||||
aiMatrix4x4::Scaling( aiVector3D(scale), scaling );
|
||||
|
||||
@@ -157,7 +157,7 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||
for( unsigned int animMeshID = 0; animMeshID < mesh->mNumAnimMeshes; animMeshID++)
|
||||
{
|
||||
aiAnimMesh * animMesh = mesh->mAnimMeshes[animMeshID];
|
||||
|
||||
|
||||
for( unsigned int vertexID = 0; vertexID < animMesh->mNumVertices; vertexID++)
|
||||
{
|
||||
aiVector3D& vertex = animMesh->mVertices[vertexID];
|
||||
@@ -169,31 +169,31 @@ void ScaleProcess::Execute( aiScene* pScene ) {
|
||||
traverseNodes( pScene->mRootNode );
|
||||
}
|
||||
|
||||
void ScaleProcess::traverseNodes( aiNode *node, unsigned int nested_node_id ) {
|
||||
void ScaleProcess::traverseNodes( aiNode *node, unsigned int nested_node_id ) {
|
||||
applyScaling( node );
|
||||
|
||||
for( size_t i = 0; i < node->mNumChildren; i++)
|
||||
{
|
||||
// recurse into the tree until we are done!
|
||||
traverseNodes( node->mChildren[i], nested_node_id+1 );
|
||||
traverseNodes( node->mChildren[i], nested_node_id+1 );
|
||||
}
|
||||
}
|
||||
|
||||
void ScaleProcess::applyScaling( aiNode *currentNode ) {
|
||||
if ( nullptr != currentNode ) {
|
||||
// Reconstruct matrix by transform rather than by scale
|
||||
// Reconstruct matrix by transform rather than by scale
|
||||
// This prevent scale values being changed which can
|
||||
// be meaningful in some cases
|
||||
// like when you want the modeller to
|
||||
// be meaningful in some cases
|
||||
// like when you want the modeller to
|
||||
// see 1:1 compatibility.
|
||||
|
||||
|
||||
aiVector3D pos, scale;
|
||||
aiQuaternion rotation;
|
||||
currentNode->mTransformation.Decompose( scale, rotation, pos);
|
||||
|
||||
|
||||
aiMatrix4x4 translation;
|
||||
aiMatrix4x4::Translation( pos * mScale, translation );
|
||||
|
||||
|
||||
aiMatrix4x4 scaling;
|
||||
|
||||
// note: we do not use mScale here, this is on purpose.
|
||||
|
||||
Reference in New Issue
Block a user