diff options
Diffstat (limited to 'src/3rdparty/assimp/code/MDLMaterialLoader.cpp')
-rw-r--r-- | src/3rdparty/assimp/code/MDLMaterialLoader.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/3rdparty/assimp/code/MDLMaterialLoader.cpp b/src/3rdparty/assimp/code/MDLMaterialLoader.cpp index d1502d6fb..9086925aa 100644 --- a/src/3rdparty/assimp/code/MDLMaterialLoader.cpp +++ b/src/3rdparty/assimp/code/MDLMaterialLoader.cpp @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -52,8 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <assimp/IOSystem.hpp> #include <assimp/DefaultLogger.hpp> #include <assimp/scene.h> +#include <assimp/Defines.h> #include "qnan.h" -#include "Defines.h" using namespace Assimp; @@ -488,7 +489,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( unsigned int iWidth, unsigned int iHeight) { - aiTexture* pcNew = NULL; + aiTexture* pcNew = nullptr; // get the type of the skin unsigned int iMasked = (unsigned int)(iType & 0xF); @@ -522,7 +523,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( memcpy(pcNew->pcData,szCurrent,pcNew->mWidth); szCurrent += iWidth; } - if (0x7 == iMasked) + else if (0x7 == iMasked) { // ***** REFERENCE TO EXTERNAL FILE ***** if (1 != iHeight) @@ -545,7 +546,6 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( } else if (iMasked || !iType || (iType && iWidth && iHeight)) { - // ***** STANDARD COLOR TEXTURE ***** pcNew = new aiTexture(); if (!iHeight || !iWidth) { @@ -657,7 +657,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( if (is_not_qnan(clrTexture.r)) { clrTemp.r *= clrTexture.a; } - pcMatOut->AddProperty<float>(&clrTemp.r,1,AI_MATKEY_OPACITY); + pcMatOut->AddProperty<ai_real>(&clrTemp.r,1,AI_MATKEY_OPACITY); // read phong power int iShadingMode = (int)aiShadingMode_Gouraud; @@ -665,7 +665,9 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( if (0.0f != pcMatIn->Power) { iShadingMode = (int)aiShadingMode_Phong; - pcMatOut->AddProperty<float>(&pcMatIn->Power,1,AI_MATKEY_SHININESS); + // pcMatIn is packed, we can't form pointers to its members + float power = pcMatIn->Power; + pcMatOut->AddProperty<float>(&power,1,AI_MATKEY_SHININESS); } pcMatOut->AddProperty<int>(&iShadingMode,1,AI_MATKEY_SHADING_MODEL); } @@ -731,6 +733,9 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( } VALIDATE_FILE_SIZE(szCurrent); *szCurrentOut = szCurrent; + if ( nullptr != pcNew ) { + delete pcNew; + } } // ------------------------------------------------------------------------------------------------ |