diff options
Diffstat (limited to 'src/3rdparty/assimp/code/ASEParser.cpp')
-rw-r--r-- | src/3rdparty/assimp/code/ASEParser.cpp | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/src/3rdparty/assimp/code/ASEParser.cpp b/src/3rdparty/assimp/code/ASEParser.cpp index 204f8bf62..7de80a2d8 100644 --- a/src/3rdparty/assimp/code/ASEParser.cpp +++ b/src/3rdparty/assimp/code/ASEParser.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. @@ -25,8 +26,8 @@ conditions are met: derived from this software without specific prior written permission of the assimp team. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, @@ -45,11 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_ASE_IMPORTER +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER // internal headers #include "TextureTransform.h" #include "ASELoader.h" -#include "MaterialSystem.h" #include "fast_atof.h" #include <assimp/DefaultLogger.hpp> @@ -431,7 +432,7 @@ void Parser::ParseLV1SoftSkinBlock() ParseString(bone,"*MESH_SOFTSKINVERTS.Bone"); // Find the bone in the mesh's list - std::pair<int,float> me; + std::pair<int,ai_real> me; me.first = -1; for (unsigned int n = 0; n < curMesh->mBones.size();++n) @@ -618,12 +619,13 @@ void Parser::ParseLV2MaterialBlock(ASE::Material& mat) if (TokenMatch(filePtr,"MATERIAL_TRANSPARENCY",21)) { ParseLV4MeshFloat(mat.mTransparency); - mat.mTransparency = 1.0f - mat.mTransparency;continue; + mat.mTransparency = ai_real( 1.0 ) - mat.mTransparency; + continue; } // material self illumination if (TokenMatch(filePtr,"MATERIAL_SELFILLUM",18)) { - float f = 0.0f; + ai_real f = 0.0; ParseLV4MeshFloat(f); mat.mEmissive.r = f; @@ -1134,7 +1136,7 @@ void Parser::ParseLV3ScaleAnimationBlock(ASE::Animation& anim) bool b = false; // For the moment we're just reading the three floats - - // we ignore the �dditional information for bezier's and TCBs + // we ignore the additional information for bezier's and TCBs // simple scaling keyframe if (TokenMatch(filePtr,"CONTROL_SCALE_SAMPLE" ,20)) @@ -1180,7 +1182,7 @@ void Parser::ParseLV3PosAnimationBlock(ASE::Animation& anim) bool b = false; // For the moment we're just reading the three floats - - // we ignore the �dditional information for bezier's and TCBs + // we ignore the additional information for bezier's and TCBs // simple scaling keyframe if (TokenMatch(filePtr,"CONTROL_POS_SAMPLE" ,18)) @@ -1226,7 +1228,7 @@ void Parser::ParseLV3RotAnimationBlock(ASE::Animation& anim) bool b = false; // For the moment we're just reading the floats - - // we ignore the �dditional information for bezier's and TCBs + // we ignore the additional information for bezier's and TCBs // simple scaling keyframe if (TokenMatch(filePtr,"CONTROL_ROT_SAMPLE" ,18)) @@ -1251,7 +1253,7 @@ void Parser::ParseLV3RotAnimationBlock(ASE::Animation& anim) { anim.akeyRotations.push_back(aiQuatKey()); aiQuatKey& key = anim.akeyRotations.back(); - aiVector3D v;float f; + aiVector3D v;ai_real f; ParseLV4MeshFloatTriple(&v.x,iIndex); ParseLV4MeshFloat(f); key.mTime = (double)iIndex; @@ -1463,30 +1465,29 @@ void Parser::ParseLV2MeshBlock(ASE::Mesh& mesh) continue; } // another mesh UV channel ... - if (TokenMatch(filePtr,"MESH_MAPPINGCHANNEL" ,19)) - { - - unsigned int iIndex = 0; + if (TokenMatch(filePtr,"MESH_MAPPINGCHANNEL" ,19)) { + unsigned int iIndex( 0 ); ParseLV4MeshLong(iIndex); - - if (iIndex < 2) - { - LogWarning("Mapping channel has an invalid index. Skipping UV channel"); + if ( 0 == iIndex ) { + LogWarning( "Mapping channel has an invalid index. Skipping UV channel" ); // skip it ... SkipSection(); + } else { + if ( iIndex < 2 ) { + LogWarning( "Mapping channel has an invalid index. Skipping UV channel" ); + // skip it ... + SkipSection(); + } + if ( iIndex > AI_MAX_NUMBER_OF_TEXTURECOORDS ) { + LogWarning( "Too many UV channels specified. Skipping channel .." ); + // skip it ... + SkipSection(); + } else { + // parse the mapping channel + ParseLV3MappingChannel( iIndex - 1, mesh ); + } + continue; } - if (iIndex > AI_MAX_NUMBER_OF_TEXTURECOORDS) - { - LogWarning("Too many UV channels specified. Skipping channel .."); - // skip it ... - SkipSection(); - } - else - { - // parse the mapping channel - ParseLV3MappingChannel(iIndex-1,mesh); - } - continue; } // mesh animation keyframe. Not supported if (TokenMatch(filePtr,"MESH_ANIMATION" ,14)) @@ -1604,7 +1605,7 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices,ASE::Mesh& mesh } // --- ignored - float afVert[3]; + ai_real afVert[3]; ParseLV4MeshFloatTriple(afVert); std::pair<int,float> pairOut; @@ -1858,7 +1859,7 @@ void Parser::ParseLV3MeshCFaceListBlock(unsigned int iNumFaces, ASE::Mesh& mesh) ++filePtr; // Face entry - if (TokenMatch(filePtr,"MESH_CFACE" ,11)) + if (TokenMatch(filePtr,"MESH_CFACE" ,10)) { unsigned int aiValues[3]; unsigned int iIndex = 0; @@ -2102,7 +2103,7 @@ void Parser::ParseLV4MeshLongTriple(unsigned int* apOut, unsigned int& rIndexOut ParseLV4MeshLongTriple(apOut); } // ------------------------------------------------------------------------------------------------ -void Parser::ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut) +void Parser::ParseLV4MeshFloatTriple(ai_real* apOut, unsigned int& rIndexOut) { ai_assert(NULL != apOut); @@ -2113,7 +2114,7 @@ void Parser::ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut) ParseLV4MeshFloatTriple(apOut); } // ------------------------------------------------------------------------------------------------ -void Parser::ParseLV4MeshFloatTriple(float* apOut) +void Parser::ParseLV4MeshFloatTriple(ai_real* apOut) { ai_assert(NULL != apOut); @@ -2121,19 +2122,19 @@ void Parser::ParseLV4MeshFloatTriple(float* apOut) ParseLV4MeshFloat(apOut[i]); } // ------------------------------------------------------------------------------------------------ -void Parser::ParseLV4MeshFloat(float& fOut) +void Parser::ParseLV4MeshFloat(ai_real& fOut) { // skip spaces and tabs if(!SkipSpaces(&filePtr)) { // LOG LogWarning("Unable to parse float: unexpected EOL [#1]"); - fOut = 0.0f; + fOut = 0.0; ++iLineNumber; return; } // parse the first float - filePtr = fast_atoreal_move<float>(filePtr,fOut); + filePtr = fast_atoreal_move<ai_real>(filePtr,fOut); } // ------------------------------------------------------------------------------------------------ void Parser::ParseLV4MeshLong(unsigned int& iOut) @@ -2151,4 +2152,6 @@ void Parser::ParseLV4MeshLong(unsigned int& iOut) iOut = strtoul10(filePtr,&filePtr); } +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER + #endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER |