Use correct lookup if scaling is enabled.

pull/1520/head
Kim Kulling 2017-10-29 23:18:37 +01:00
parent d6f5ad66b2
commit bbeb9dd640
1 changed files with 8 additions and 4 deletions

View File

@ -39,13 +39,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
#include "ScaleProcess.h" #include "ScaleProcess.h"
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/postprocess.h>
namespace Assimp { namespace Assimp {
ScaleProcess::ScaleProcess() ScaleProcess::ScaleProcess()
: BaseProcess() : BaseProcess()
, mScale( 1.0f ) { , mScale( AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT ) {
// empty // empty
} }
@ -62,11 +64,11 @@ ai_real ScaleProcess::getScale() const {
} }
bool ScaleProcess::IsActive( unsigned int pFlags ) const { bool ScaleProcess::IsActive( unsigned int pFlags ) const {
return true; return ( pFlags & aiProcess_GlobalScale ) != 0;
} }
void ScaleProcess::SetupProperties( const Importer* pImp ) { void ScaleProcess::SetupProperties( const Importer* pImp ) {
mScale = pImp->GetPropertyFloat( AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY, AI_CONFIG_GLOBAL_SCALE_FACTOR_DEFAULT ); mScale = pImp->GetPropertyFloat( AI_CONFIG_GLOBAL_SCALE_FACTOR_KEY, 0 );
} }
void ScaleProcess::Execute( aiScene* pScene ) { void ScaleProcess::Execute( aiScene* pScene ) {
@ -87,7 +89,9 @@ void ScaleProcess::Execute( aiScene* pScene ) {
} }
void ScaleProcess::applyScaling( aiNode *currentNode ) { void ScaleProcess::applyScaling( aiNode *currentNode ) {
if ( nullptr != currentNode ) {
currentNode->mTransformation = currentNode->mTransformation * mScale; currentNode->mTransformation = currentNode->mTransformation * mScale;
} }
}
} // Namespace Assimp } // Namespace Assimp