From f80e8b39a18f1fc24b46a7693fc73c2f0553a228 Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Fri, 24 Nov 2017 22:08:50 +0100 Subject: [PATCH 1/4] Fix warning C4138: '*/' found outside of comment on MSVC14 --- code/D3MFImporter.cpp | 2 +- code/FIReader.cpp | 4 ++-- code/MMDImporter.cpp | 2 +- code/MMDPmxParser.cpp | 2 +- code/OpenGEXExporter.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/D3MFImporter.cpp b/code/D3MFImporter.cpp index 6d61a0669..e52c72346 100644 --- a/code/D3MFImporter.cpp +++ b/code/D3MFImporter.cpp @@ -344,7 +344,7 @@ bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool return false; } -void D3MFImporter::SetupProperties(const Importer */*pImp*/) +void D3MFImporter::SetupProperties(const Importer * /*pImp*/) { } diff --git a/code/FIReader.cpp b/code/FIReader.cpp index 53cff257a..a0b9b39e1 100755 --- a/code/FIReader.cpp +++ b/code/FIReader.cpp @@ -1790,9 +1790,9 @@ public: return nullptr; } - virtual void registerDecoder(const std::string &/*algorithmUri*/, std::unique_ptr /*decoder*/) /*override*/ {} + virtual void registerDecoder(const std::string & /*algorithmUri*/, std::unique_ptr /*decoder*/) /*override*/ {} - virtual void registerVocabulary(const std::string &/*vocabularyUri*/, const FIVocabulary */*vocabulary*/) /*override*/ {} + virtual void registerVocabulary(const std::string & /*vocabularyUri*/, const FIVocabulary * /*vocabulary*/) /*override*/ {} private: diff --git a/code/MMDImporter.cpp b/code/MMDImporter.cpp index cf7c87c8a..01f009519 100644 --- a/code/MMDImporter.cpp +++ b/code/MMDImporter.cpp @@ -107,7 +107,7 @@ const aiImporterDesc *MMDImporter::GetInfo() const { return &desc; } // ------------------------------------------------------------------------------------------------ // MMD import implementation void MMDImporter::InternReadFile(const std::string &file, aiScene *pScene, - IOSystem */*pIOHandler*/) { + IOSystem * /*pIOHandler*/) { // Read file by istream std::filebuf fb; if (!fb.open(file, std::ios::in | std::ios::binary)) { diff --git a/code/MMDPmxParser.cpp b/code/MMDPmxParser.cpp index 5be370f26..970cbc31e 100644 --- a/code/MMDPmxParser.cpp +++ b/code/MMDPmxParser.cpp @@ -471,7 +471,7 @@ namespace pmx stream->read((char*) &this->is_near, sizeof(uint8_t)); } - void PmxSoftBody::Read(std::istream */*stream*/, PmxSetting */*setting*/) + void PmxSoftBody::Read(std::istream * /*stream*/, PmxSetting * /*setting*/) { // 未実装 std::cerr << "Not Implemented Exception" << std::endl; diff --git a/code/OpenGEXExporter.cpp b/code/OpenGEXExporter.cpp index b3597656b..0f2b1c35b 100644 --- a/code/OpenGEXExporter.cpp +++ b/code/OpenGEXExporter.cpp @@ -51,7 +51,7 @@ OpenGEXExporter::OpenGEXExporter() { OpenGEXExporter::~OpenGEXExporter() { } -bool OpenGEXExporter::exportScene( const char */*filename*/, const aiScene* /*pScene*/ ) { +bool OpenGEXExporter::exportScene( const char * /*filename*/, const aiScene* /*pScene*/ ) { return true; } From 273f6b0267a04aabbde3e3b92e4ae48bb01e2aae Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Fri, 24 Nov 2017 22:13:38 +0100 Subject: [PATCH 2/4] Fix MSVC14 warning cast double to real --- code/FindDegenerates.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/FindDegenerates.cpp b/code/FindDegenerates.cpp index 5a4a132ef..f9c04133a 100644 --- a/code/FindDegenerates.cpp +++ b/code/FindDegenerates.cpp @@ -93,7 +93,7 @@ void FindDegeneratesProcess::Execute( aiScene* pScene) { static ai_real heron( ai_real a, ai_real b, ai_real c ) { ai_real s = (a + b + c) / 2; - ai_real area = pow((s * ( s - a ) * ( s - b ) * ( s - c ) ), 0.5 ); + ai_real area = pow((s * ( s - a ) * ( s - b ) * ( s - c ) ), (ai_real)0.5 ); return area; } @@ -102,7 +102,7 @@ static ai_real distance3D( const aiVector3D &vA, aiVector3D &vB ) { const ai_real ly = ( vB.y - vA.y ); const ai_real lz = ( vB.z - vA.z ); ai_real a = lx*lx + ly*ly + lz*lz; - ai_real d = pow( a, 0.5 ); + ai_real d = pow( a, (ai_real)0.5 ); return d; } From d529dd17f920a8d5fb33547f866c26b668a265ec Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Fri, 24 Nov 2017 22:29:58 +0100 Subject: [PATCH 3/4] Fix warning cast double to float --- code/FIReader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/FIReader.cpp b/code/FIReader.cpp index a0b9b39e1..7aaa32fd2 100755 --- a/code/FIReader.cpp +++ b/code/FIReader.cpp @@ -60,6 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "MemoryIOWrapper.h" #include "irrXMLWrapper.h" #include "../contrib/utf8cpp/source/utf8.h" +#include "fast_atof.h" #include #include #include @@ -714,7 +715,7 @@ public: if (floatValue) { return floatValue->value.size() == 1 ? floatValue->value.front() : 0; } - return atof(attr->value->toString().c_str()); + return fast_atof(attr->value->toString().c_str()); } virtual float getAttributeValueAsFloat(int idx) const /*override*/ { @@ -725,7 +726,7 @@ public: if (floatValue) { return floatValue->value.size() == 1 ? floatValue->value.front() : 0; } - return atof(attributes[idx].value->toString().c_str()); + return fast_atof(attributes[idx].value->toString().c_str()); } virtual const char* getNodeName() const /*override*/ { From eb452b28a286f706c8936292884c3a35972659e9 Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Sat, 25 Nov 2017 11:38:12 +0100 Subject: [PATCH 4/4] Fix warning on MSVC14 --- code/ColladaExporter.cpp | 2 +- code/FindInvalidDataProcess.cpp | 2 +- code/STLLoader.cpp | 4 ++-- code/glTF2Asset.inl | 2 +- code/glTF2Exporter.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index 03a955b8f..4a10d5845 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -1309,7 +1309,7 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex) // Combine the above transformations aiMatrix4x4 mat = TranslationM * RotationM * ScalingM; - for( size_t j = 0; j < 4; ++j) { + for( unsigned int j = 0; j < 4; ++j) { keyframes.insert(keyframes.end(), mat[j], mat[j] + 4); } } diff --git a/code/FindInvalidDataProcess.cpp b/code/FindInvalidDataProcess.cpp index 0113e4c5b..c37d8956c 100644 --- a/code/FindInvalidDataProcess.cpp +++ b/code/FindInvalidDataProcess.cpp @@ -339,7 +339,7 @@ void FindInvalidDataProcess::ProcessAnimationChannel (aiNodeAnim* anim) int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh) { bool ret = false; - std::vector dirtyMask(pMesh->mNumVertices, pMesh->mNumFaces); + std::vector dirtyMask(pMesh->mNumVertices, pMesh->mNumFaces != 0); // Ignore elements that are not referenced by vertices. // (they are, for example, caused by the FindDegenerates step) diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index 41f8aad03..ab2dcf36e 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -248,7 +248,7 @@ void STLImporter::LoadASCIIFile( aiNode *root ) { std::vector meshIndices; aiMesh* pMesh = new aiMesh(); pMesh->mMaterialIndex = 0; - meshIndices.push_back( meshes.size() ); + meshIndices.push_back((unsigned int) meshes.size() ); meshes.push_back(pMesh); aiNode *node = new aiNode; node->mParent = root; @@ -383,7 +383,7 @@ void STLImporter::LoadASCIIFile( aiNode *root ) { pScene->mMeshes[ i ] = meshes[i]; } - root->mNumChildren = nodes.size(); + root->mNumChildren = (unsigned int) nodes.size(); root->mChildren = new aiNode*[ root->mNumChildren ]; for ( size_t i=0; imChildren[ i ] = nodes[ i ]; diff --git a/code/glTF2Asset.inl b/code/glTF2Asset.inl index ca18e87e0..246cc1c93 100644 --- a/code/glTF2Asset.inl +++ b/code/glTF2Asset.inl @@ -212,7 +212,7 @@ unsigned int LazyDict::Remove(const char* id) mObjs.erase(mObjs.begin() + index); //update index of object in mObjs; - for (size_t i = index; i < mObjs.size(); ++i) { + for (unsigned int i = index; i < mObjs.size(); ++i) { T *obj = mObjs[i]; obj->index = i; diff --git a/code/glTF2Exporter.cpp b/code/glTF2Exporter.cpp index e6d4d1a3b..c1a803c1f 100644 --- a/code/glTF2Exporter.cpp +++ b/code/glTF2Exporter.cpp @@ -445,7 +445,7 @@ void glTF2Exporter::ExportMaterials() mat->Get(AI_MATKEY_SHININESS, shininess) == AI_SUCCESS ) { // convert specular color to luminance - float specularIntensity = specularColor[0] * 0.2125 + specularColor[1] * 0.7154 + specularColor[2] * 0.0721; + float specularIntensity = specularColor[0] * 0.2125f + specularColor[1] * 0.7154f + specularColor[2] * 0.0721f; //normalize shininess (assuming max is 1000) with an inverse exponentional curve float normalizedShininess = std::sqrt(shininess / 1000);