From 505928cc023c2d5880143f4625ca936cd7aa7841 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 00:08:44 +1100 Subject: [PATCH 01/52] Fixed build warnings on MSVC14 x64 in the 3DS format sources. --- code/3DSConverter.cpp | 4 ++-- code/3DSExporter.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/3DSConverter.cpp b/code/3DSConverter.cpp index 619360524..8390dd216 100644 --- a/code/3DSConverter.cpp +++ b/code/3DSConverter.cpp @@ -690,7 +690,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut, pcOut->mChildren = new aiNode*[pcIn->mChildren.size()]; // Recursively process all children - const unsigned int size = pcIn->mChildren.size(); + const unsigned int size = static_cast(pcIn->mChildren.size()); for (unsigned int i = 0; i < size;++i) { pcOut->mChildren[i] = new aiNode(); @@ -742,7 +742,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut) DefaultLogger::get()->warn("No hierarchy information has been found in the file. "); pcOut->mRootNode->mNumChildren = pcOut->mNumMeshes + - mScene->mCameras.size() + mScene->mLights.size(); + static_cast(mScene->mCameras.size() + mScene->mLights.size()); pcOut->mRootNode->mChildren = new aiNode* [ pcOut->mRootNode->mNumChildren ]; pcOut->mRootNode->mName.Set("<3DSDummyRoot>"); diff --git a/code/3DSExporter.cpp b/code/3DSExporter.cpp index d34901854..1d49a536b 100644 --- a/code/3DSExporter.cpp +++ b/code/3DSExporter.cpp @@ -87,7 +87,7 @@ namespace { const std::size_t chunk_size = head_pos - chunk_start_pos; writer.SetCurrentPos(chunk_start_pos + SIZE_OFFSET); - writer.PutU4(chunk_size); + writer.PutU4(static_cast(chunk_size)); writer.SetCurrentPos(head_pos); } From 6ba2dc4db318fc7ef72f486f6fa5e347bc3353de Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 00:31:32 +1100 Subject: [PATCH 02/52] Fixed build warnings on MSVC14 x64 in the postprocessing of AMF format. --- code/AMFImporter_Postprocess.cpp | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/code/AMFImporter_Postprocess.cpp b/code/AMFImporter_Postprocess.cpp index 41b16035e..e21601c75 100644 --- a/code/AMFImporter_Postprocess.cpp +++ b/code/AMFImporter_Postprocess.cpp @@ -344,7 +344,7 @@ void AMFImporter::Postprocess_AddMetadata(const std::listmNumProperties = pMetadataList.size(); + pSceneNode.mMetaData->mNumProperties = static_cast(pMetadataList.size()); pSceneNode.mMetaData->mKeys = new aiString[pSceneNode.mMetaData->mNumProperties]; pSceneNode.mMetaData->mValues = new aiMetadataEntry[pSceneNode.mMetaData->mNumProperties]; @@ -352,7 +352,7 @@ void AMFImporter::Postprocess_AddMetadata(const std::listSet(meta_idx++, metadata.Type, metadata.Value.c_str()); + pSceneNode.mMetaData->Set(static_cast(meta_idx++), metadata.Type, metadata.Value.c_str()); } }// if(pMetadataList.size() > 0) } @@ -441,9 +441,9 @@ std::list mesh_idx; // create new face and store it. complex_face.Face.mNumIndices = 3; complex_face.Face.mIndices = new unsigned int[3]; - complex_face.Face.mIndices[0] = tri_al.V[0]; - complex_face.Face.mIndices[1] = tri_al.V[1]; - complex_face.Face.mIndices[2] = tri_al.V[2]; + complex_face.Face.mIndices[0] = static_cast(tri_al.V[0]); + complex_face.Face.mIndices[1] = static_cast(tri_al.V[1]); + complex_face.Face.mIndices[2] = static_cast(tri_al.V[2]); complex_faces_list.push_back(complex_face); } }// for(const CAMFImporter_NodeElement* ne_volume_child: ne_volume->Child) @@ -512,7 +512,7 @@ std::list mesh_idx; { for(size_t vi = 0; vi < face.Face.mNumIndices; vi++) { - if(face.Face.mIndices[vi] == pIdx_From) face.Face.mIndices[vi] = pIdx_To; + if(face.Face.mIndices[vi] == pIdx_From) face.Face.mIndices[vi] = static_cast(pIdx_To); } } };// auto VertexIndex_Replace = [](std::list& pFaceList, const size_t pIdx_From, const size_t pIdx_To) -> void @@ -567,7 +567,7 @@ std::list mesh_idx; // set geometry and colors (vertices) // // copy faces/triangles - tmesh->mNumFaces = face_list_cur.size(); + tmesh->mNumFaces = static_cast(face_list_cur.size()); tmesh->mFaces = new aiFace[tmesh->mNumFaces]; // Create vertices list and optimize indices. Optimisation mean following.In AMF all volumes use one big list of vertices. And one volume @@ -623,7 +623,7 @@ std::list mesh_idx; { vert_arr.push_back(vert_arr.at(face_cur.Face.mIndices[idx_ind])); col_arr.push_back(face_color); - face_cur.Face.mIndices[idx_ind] = vert_idx_new++; + face_cur.Face.mIndices[idx_ind] = static_cast(vert_idx_new++); } }// if(face_cur.Color != nullptr) }// for(const SComplexFace& face_cur: face_list_cur) @@ -643,10 +643,10 @@ std::list mesh_idx; for(size_t i = 0, i_e = VertexCount_Max * 2; i < i_e; i++) idx_vert_used[i] = false; // This ID's will be used when set materials ID in scene. - tmesh->mMaterialIndex = PostprocessHelper_GetTextureID_Or_Create(face_list_cur.front().TexMap->TextureID_R, + tmesh->mMaterialIndex = static_cast(PostprocessHelper_GetTextureID_Or_Create(face_list_cur.front().TexMap->TextureID_R, face_list_cur.front().TexMap->TextureID_G, face_list_cur.front().TexMap->TextureID_B, - face_list_cur.front().TexMap->TextureID_A); + face_list_cur.front().TexMap->TextureID_A)); texcoord_arr.resize(VertexCount_Max * 2); for(const SComplexFace& face_cur: face_list_cur) { @@ -666,7 +666,7 @@ std::list mesh_idx; vert_arr.push_back(vert_arr.at(idx_vert)); col_arr.push_back(col_arr.at(idx_vert)); texcoord_arr.at(idx_vert_new) = face_cur.TexMap->TextureCoordinate[idx_ind]; - face_cur.Face.mIndices[idx_ind] = idx_vert_new++; + face_cur.Face.mIndices[idx_ind] = static_cast(idx_vert_new++); } }// for(size_t idx_ind = 0; idx_ind < face_cur.Face.mNumIndices; idx_ind++) }// for(const SComplexFace& face_cur: face_list_cur) @@ -679,7 +679,7 @@ std::list mesh_idx; // // copy collected data to mesh // - tmesh->mNumVertices = vert_arr.size(); + tmesh->mNumVertices = static_cast(vert_arr.size()); tmesh->mVertices = new aiVector3D[tmesh->mNumVertices]; tmesh->mColors[0] = new aiColor4D[tmesh->mNumVertices]; tmesh->mFaces = new aiFace[face_list_cur.size()]; @@ -697,7 +697,7 @@ std::list mesh_idx; for(const SComplexFace& face_cur: face_list_cur) tmesh->mFaces[idx_face++] = face_cur.Face; // store new aiMesh - mesh_idx.push_back(pMeshList.size()); + mesh_idx.push_back(static_cast(pMeshList.size())); pMeshList.push_back(tmesh); }// for(const std::list& face_list_cur: complex_faces_toplist) }// if(ne_child->Type == CAMFImporter_NodeElement::ENET_Volume) @@ -708,7 +708,7 @@ std::list mesh_idx; { std::list::const_iterator mit = mesh_idx.begin(); - pSceneNode.mNumMeshes = mesh_idx.size(); + pSceneNode.mNumMeshes = static_cast(mesh_idx.size()); pSceneNode.mMeshes = new unsigned int[pSceneNode.mNumMeshes]; for(size_t i = 0; i < pSceneNode.mNumMeshes; i++) pSceneNode.mMeshes[i] = *mit++; }// if(mesh_idx.size() > 0) @@ -783,7 +783,7 @@ std::list ch_node; size_t ch_idx = 0; - con_node->mNumChildren = ch_node.size(); + con_node->mNumChildren = static_cast(ch_node.size()); con_node->mChildren = new aiNode*[con_node->mNumChildren]; for(aiNode* node: ch_node) con_node->mChildren[ch_idx++] = node; @@ -903,7 +903,7 @@ nl_clean_loop: { std::list::const_iterator nl_it = node_list.begin(); - pScene->mRootNode->mNumChildren = node_list.size(); + pScene->mRootNode->mNumChildren = static_cast(node_list.size()); pScene->mRootNode->mChildren = new aiNode*[pScene->mRootNode->mNumChildren]; for(size_t i = 0; i < pScene->mRootNode->mNumChildren; i++) { @@ -920,14 +920,14 @@ nl_clean_loop: { std::list::const_iterator ml_it = mesh_list.begin(); - pScene->mNumMeshes = mesh_list.size(); + pScene->mNumMeshes = static_cast(mesh_list.size()); pScene->mMeshes = new aiMesh*[pScene->mNumMeshes]; for(size_t i = 0; i < pScene->mNumMeshes; i++) pScene->mMeshes[i] = *ml_it++; }// if(mesh_list.size() > 0) // // Textures - pScene->mNumTextures = mTexture_Converted.size(); + pScene->mNumTextures = static_cast(mTexture_Converted.size()); if(pScene->mNumTextures > 0) { size_t idx; @@ -937,8 +937,8 @@ nl_clean_loop: for(const SPP_Texture& tex_convd: mTexture_Converted) { pScene->mTextures[idx] = new aiTexture; - pScene->mTextures[idx]->mWidth = tex_convd.Width; - pScene->mTextures[idx]->mHeight = tex_convd.Height; + pScene->mTextures[idx]->mWidth = static_cast(tex_convd.Width); + pScene->mTextures[idx]->mHeight = static_cast(tex_convd.Height); pScene->mTextures[idx]->pcData = (aiTexel*)tex_convd.Data; // texture format description. strcpy(pScene->mTextures[idx]->achFormatHint, tex_convd.FormatHint); @@ -947,7 +947,7 @@ nl_clean_loop: // Create materials for embedded textures. idx = 0; - pScene->mNumMaterials = mTexture_Converted.size(); + pScene->mNumMaterials = static_cast(mTexture_Converted.size()); pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials]; for(const SPP_Texture& tex_convd: mTexture_Converted) { From a2dadbbe5216674890da5e90e7aef4c913c76e0e Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 00:39:11 +1100 Subject: [PATCH 03/52] Fixed build warnings on MSVC14 x64 in the AssBin sources. --- code/AssbinExporter.cpp | 2 +- code/AssbinLoader.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/AssbinExporter.cpp b/code/AssbinExporter.cpp index 9240d3739..fcb32c70a 100644 --- a/code/AssbinExporter.cpp +++ b/code/AssbinExporter.cpp @@ -737,7 +737,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size) AssbinChunkWriter uncompressedStream( NULL, 0 ); WriteBinaryScene( &uncompressedStream, pScene ); - uLongf uncompressedSize = uncompressedStream.Tell(); + uLongf uncompressedSize = static_cast(uncompressedStream.Tell()); uLongf compressedSize = (uLongf)(uncompressedStream.Tell() * 1.001 + 12.); uint8_t* compressedBuffer = new uint8_t[ compressedSize ]; diff --git a/code/AssbinLoader.cpp b/code/AssbinLoader.cpp index c4261c4cb..7a17d5ad5 100644 --- a/code/AssbinLoader.cpp +++ b/code/AssbinLoader.cpp @@ -659,7 +659,7 @@ void AssbinImporter::InternReadFile( const std::string& pFile, aiScene* pScene, if (compressed) { uLongf uncompressedSize = Read(stream); - uLongf compressedSize = stream->FileSize() - stream->Tell(); + uLongf compressedSize = static_cast(stream->FileSize() - stream->Tell()); unsigned char * compressedData = new unsigned char[ compressedSize ]; stream->Read( compressedData, 1, compressedSize ); From bf5fc593eb10bf49538d89d94e415e06bf3546a1 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 01:21:59 +1100 Subject: [PATCH 04/52] Fixed build warnings on MSVC14 x64 in the B3D format sources. --- code/B3DImporter.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/code/B3DImporter.cpp b/code/B3DImporter.cpp index 1b9ba1433..d28d41518 100644 --- a/code/B3DImporter.cpp +++ b/code/B3DImporter.cpp @@ -331,7 +331,7 @@ void B3DImporter::ReadVRTS(){ int sz=12+(_vflags&1?12:0)+(_vflags&2?16:0)+(_tcsets*_tcsize*4); int n_verts=ChunkSize()/sz; - int v0=_vertices.size(); + int v0=static_cast(_vertices.size()); _vertices.resize( v0+n_verts ); for( int i=0;i(_vertices.size()); while( ChunkSize() ){ string t=ReadChunk(); @@ -462,17 +462,17 @@ void B3DImporter::ReadKEYS( aiNodeAnim *nodeAnim ){ } if( flags & 1 ){ - nodeAnim->mNumPositionKeys=trans.size(); + nodeAnim->mNumPositionKeys=static_cast(trans.size()); nodeAnim->mPositionKeys=to_array( trans ); } if( flags & 2 ){ - nodeAnim->mNumScalingKeys=scale.size(); + nodeAnim->mNumScalingKeys=static_cast(scale.size()); nodeAnim->mScalingKeys=to_array( scale ); } if( flags & 4 ){ - nodeAnim->mNumRotationKeys=rot.size(); + nodeAnim->mNumRotationKeys=static_cast(rot.size()); nodeAnim->mRotationKeys=to_array( rot ); } } @@ -506,7 +506,7 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){ aiMatrix4x4 tform=trans * rot * scale; - int nodeid=_nodes.size(); + int nodeid=static_cast(_nodes.size()); aiNode *node=new aiNode( name ); _nodes.push_back( node ); @@ -521,9 +521,9 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){ while( ChunkSize() ){ string t=ReadChunk(); if( t=="MESH" ){ - int n=_meshes.size(); + unsigned int n= static_cast(_meshes.size()); ReadMESH(); - for( int i=n;i<(int)_meshes.size();++i ){ + for( unsigned int i=n;i(_meshes.size());++i ){ meshes.push_back( i ); } }else if( t=="BONE" ){ @@ -544,10 +544,10 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){ ExitChunk(); } - node->mNumMeshes=meshes.size(); + node->mNumMeshes= static_cast(meshes.size()); node->mMeshes=to_array( meshes ); - node->mNumChildren=children.size(); + node->mNumChildren=static_cast(children.size()); node->mChildren=to_array( children ); return node; @@ -645,7 +645,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){ aiNode *bnode=_nodes[i]; bone->mName=bnode->mName; - bone->mNumWeights=weights.size(); + bone->mNumWeights= static_cast(weights.size()); bone->mWeights=to_array( weights ); aiMatrix4x4 mat=bnode->mTransformation; @@ -655,7 +655,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){ } bone->mOffsetMatrix=mat.Inverse(); } - mesh->mNumBones=bones.size(); + mesh->mNumBones= static_cast(bones.size()); mesh->mBones=to_array( bones ); } } @@ -667,21 +667,21 @@ void B3DImporter::ReadBB3D( aiScene *scene ){ if( !_materials.size() ){ _materials.push_back( new aiMaterial ); } - scene->mNumMaterials=_materials.size(); + scene->mNumMaterials= static_cast(_materials.size()); scene->mMaterials=to_array( _materials ); //meshes - scene->mNumMeshes=_meshes.size(); + scene->mNumMeshes= static_cast(_meshes.size()); scene->mMeshes=to_array( _meshes ); //animations if( _animations.size()==1 && _nodeAnims.size() ){ aiAnimation *anim=_animations.back(); - anim->mNumChannels=_nodeAnims.size(); + anim->mNumChannels=static_cast(_nodeAnims.size()); anim->mChannels=to_array( _nodeAnims ); - scene->mNumAnimations=_animations.size(); + scene->mNumAnimations=static_cast(_animations.size()); scene->mAnimations=to_array( _animations ); } From 06beb5039107c297a3a477b09af1ff5bf7e34c7f Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 01:54:27 +1100 Subject: [PATCH 05/52] Fixed build warnings on MSVC14 x64 in the Blender format sources, as well as build warnings in tests. --- code/BlenderBMesh.cpp | 2 +- code/BlenderLoader.cpp | 4 ++-- code/BlenderTessellator.cpp | 8 ++++---- test/unit/utBlenderIntermediate.cpp | 4 ++++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/code/BlenderBMesh.cpp b/code/BlenderBMesh.cpp index bf27a9396..c328947ae 100644 --- a/code/BlenderBMesh.cpp +++ b/code/BlenderBMesh.cpp @@ -180,7 +180,7 @@ void BlenderBMeshConverter::AddFace( int v1, int v2, int v3, int v4 ) // TODO - Work out how materials work face.mat_nr = 0; triMesh->mface.push_back( face ); - triMesh->totface = triMesh->mface.size( ); + triMesh->totface = static_cast(triMesh->mface.size( )); } // ------------------------------------------------------------------------------------------------ diff --git a/code/BlenderLoader.cpp b/code/BlenderLoader.cpp index 68388235f..713146eea 100644 --- a/code/BlenderLoader.cpp +++ b/code/BlenderLoader.cpp @@ -421,7 +421,7 @@ void BlenderImporter::ResolveImage(aiMaterial* out, const Material* mat, const M // check if the file contents are bundled with the BLEND file if (img->packedfile) { name.data[0] = '*'; - name.length = 1+ ASSIMP_itoa10(name.data+1,MAXLEN-1,conv_data.textures->size()); + name.length = 1+ ASSIMP_itoa10(name.data+1,static_cast(MAXLEN-1), static_cast(conv_data.textures->size())); conv_data.textures->push_back(new aiTexture()); aiTexture* tex = conv_data.textures->back(); @@ -1228,7 +1228,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers if (conv_data.meshes->size() > old) { node->mMeshes = new unsigned int[node->mNumMeshes = static_cast(conv_data.meshes->size()-old)]; for (unsigned int i = 0; i < node->mNumMeshes; ++i) { - node->mMeshes[i] = i + old; + node->mMeshes[i] = static_cast(i + old); } }} break; diff --git a/code/BlenderTessellator.cpp b/code/BlenderTessellator.cpp index c29b27de1..60879b417 100644 --- a/code/BlenderTessellator.cpp +++ b/code/BlenderTessellator.cpp @@ -412,9 +412,9 @@ float BlenderTessellatorP2T::FindLargestMatrixElem( const aiMatrix3x3& mtx ) con { float result = 0.0f; - for ( size_t x = 0; x < 3; ++x ) + for ( unsigned int x = 0; x < 3; ++x ) { - for ( size_t y = 0; y < 3; ++y ) + for ( unsigned int y = 0; y < 3; ++y ) { result = p2tMax( std::fabs( mtx[ x ][ y ] ), result ); } @@ -429,9 +429,9 @@ aiMatrix3x3 BlenderTessellatorP2T::ScaleMatrix( const aiMatrix3x3& mtx, float sc { aiMatrix3x3 result; - for ( size_t x = 0; x < 3; ++x ) + for ( unsigned int x = 0; x < 3; ++x ) { - for ( size_t y = 0; y < 3; ++y ) + for ( unsigned int y = 0; y < 3; ++y ) { result[ x ][ y ] = mtx[ x ][ y ] * scale; } diff --git a/test/unit/utBlenderIntermediate.cpp b/test/unit/utBlenderIntermediate.cpp index 0bf40936b..98c87f9c8 100644 --- a/test/unit/utBlenderIntermediate.cpp +++ b/test/unit/utBlenderIntermediate.cpp @@ -40,6 +40,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "UnitTestPCH.h" #include "BlenderIntermediate.h" +#include "./../include/assimp/camera.h" +#include "./../include/assimp/light.h" +#include "./../include/assimp/mesh.h" +#include "./../include/assimp/texture.h" using namespace ::Assimp; using namespace ::Assimp::Blender; From df6707a26234af5880294159aad3f45ede97bf3f Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 02:33:58 +1100 Subject: [PATCH 06/52] Fixed build warnings on MSVC14 x64 in the BVH format sources. --- code/BVHLoader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BVHLoader.cpp b/code/BVHLoader.cpp index ca6c5d36c..e5821fdaf 100644 --- a/code/BVHLoader.cpp +++ b/code/BVHLoader.cpp @@ -237,7 +237,7 @@ aiNode* BVHLoader::ReadNode() // add the child nodes if there are any if( childNodes.size() > 0) { - node->mNumChildren = childNodes.size(); + node->mNumChildren = static_cast(childNodes.size()); node->mChildren = new aiNode*[node->mNumChildren]; std::copy( childNodes.begin(), childNodes.end(), node->mChildren); } @@ -443,7 +443,7 @@ void BVHLoader::CreateAnimation( aiScene* pScene) anim->mDuration = double( mAnimNumFrames - 1); // now generate the tracks for all nodes - anim->mNumChannels = mNodes.size(); + anim->mNumChannels = static_cast(mNodes.size()); anim->mChannels = new aiNodeAnim*[anim->mNumChannels]; // FIX: set the array elements to NULL to ensure proper deletion if an exception is thrown From 2866da1262d0c5229363c3127d090cecc8eea0d7 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 02:35:30 +1100 Subject: [PATCH 07/52] Fixed build warnings on MSVC14 x64 in the COB format sources. --- code/COBLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/COBLoader.cpp b/code/COBLoader.cpp index 4f0ad3980..441dd1c56 100644 --- a/code/COBLoader.cpp +++ b/code/COBLoader.cpp @@ -181,7 +181,7 @@ void COBImporter::InternReadFile( const std::string& pFile, if (n->type == Node::TYPE_MESH) { Mesh& mesh = (Mesh&)(*n.get()); if (mesh.vertex_positions.size() && mesh.texture_coords.size()) { - pScene->mNumMeshes += mesh.temp_map.size(); + pScene->mNumMeshes += static_cast(mesh.temp_map.size()); } } } From 3b63e4af54d1bff093fb73885c59554fe477baf4 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 02:42:51 +1100 Subject: [PATCH 08/52] Fixed build warnings on MSVC14 x64 in the Collada parser. --- code/ColladaParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index 1fd762e40..fe2f04782 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -2535,7 +2535,7 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si aiColor4D result(0, 0, 0, 1); for (size_t i = 0; i < pInput.mResolved->mSize; ++i) { - result[i] = obj[pInput.mResolved->mSubOffset[i]]; + result[static_cast(i)] = obj[pInput.mResolved->mSubOffset[i]]; } pMesh->mColors[pInput.mIndex].push_back(result); } else From 128c27e89ce88b577138373f560ae8547943c22d Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 03:16:06 +1100 Subject: [PATCH 09/52] Fixed build warnings on MSVC14 x64 in the Collada loader. --- code/ColladaLoader.cpp | 60 ++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 81a43754e..5de48120c 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -58,6 +58,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "time.h" #include "math.h" +#include +#include #include #include "Defines.h" @@ -240,7 +242,7 @@ aiNode* ColladaLoader::BuildHierarchy( const ColladaParser& pParser, const Colla ResolveNodeInstances(pParser,pNode,instances); // add children. first the *real* ones - node->mNumChildren = pNode->mChildren.size()+instances.size(); + node->mNumChildren = static_cast(pNode->mChildren.size()+instances.size()); node->mChildren = new aiNode*[node->mNumChildren]; for( size_t a = 0; a < pNode->mChildren.size(); a++) @@ -506,7 +508,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll std::map::const_iterator matIt = mMaterialIndexByName.find( meshMaterial); unsigned int matIdx; if( matIt != mMaterialIndexByName.end()) - matIdx = matIt->second; + matIdx = static_cast(matIt->second); else matIdx = 0; @@ -553,11 +555,19 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll } // now place all mesh references we gathered in the target node - pTarget->mNumMeshes = newMeshRefs.size(); + pTarget->mNumMeshes = static_cast(newMeshRefs.size()); if( newMeshRefs.size()) { + struct UIntTypeConverter + { + unsigned int operator()(const size_t& v) const + { + return static_cast(v); + } + }; + pTarget->mMeshes = new unsigned int[pTarget->mNumMeshes]; - std::copy( newMeshRefs.begin(), newMeshRefs.end(), pTarget->mMeshes); + std::transform( newMeshRefs.begin(), newMeshRefs.end(), pTarget->mMeshes, UIntTypeConverter()); } } @@ -572,10 +582,10 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: // count the vertices addressed by its faces const size_t numVertices = std::accumulate( pSrcMesh->mFaceSize.begin() + pStartFace, - pSrcMesh->mFaceSize.begin() + pStartFace + pSubMesh.mNumFaces, 0); + pSrcMesh->mFaceSize.begin() + pStartFace + pSubMesh.mNumFaces, size_t(0)); // copy positions - dstMesh->mNumVertices = numVertices; + dstMesh->mNumVertices = static_cast(numVertices); dstMesh->mVertices = new aiVector3D[numVertices]; std::copy( pSrcMesh->mPositions.begin() + pStartVertex, pSrcMesh->mPositions.begin() + pStartVertex + numVertices, dstMesh->mVertices); @@ -634,16 +644,16 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: // create faces. Due to the fact that each face uses unique vertices, we can simply count up on each vertex size_t vertex = 0; - dstMesh->mNumFaces = pSubMesh.mNumFaces; + dstMesh->mNumFaces = static_cast(pSubMesh.mNumFaces); dstMesh->mFaces = new aiFace[dstMesh->mNumFaces]; for( size_t a = 0; a < dstMesh->mNumFaces; ++a) { size_t s = pSrcMesh->mFaceSize[ pStartFace + a]; aiFace& face = dstMesh->mFaces[a]; - face.mNumIndices = s; + face.mNumIndices = static_cast(s); face.mIndices = new unsigned int[s]; for( size_t b = 0; b < s; ++b) - face.mIndices[b] = vertex++; + face.mIndices[b] = static_cast(vertex++); } // create bones if given @@ -710,7 +720,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: if( weight > 0.0f) { aiVertexWeight w; - w.mVertexId = a - pStartVertex; + w.mVertexId = static_cast(a - pStartVertex); w.mWeight = weight; dstBones[jointIndex].push_back( w); } @@ -724,7 +734,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: numRemainingBones++; // create bone array and copy bone weights one by one - dstMesh->mNumBones = numRemainingBones; + dstMesh->mNumBones = static_cast(numRemainingBones); dstMesh->mBones = new aiBone*[numRemainingBones]; size_t boneCount = 0; for( size_t a = 0; a < numBones; ++a) @@ -748,7 +758,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: bone->mOffsetMatrix.c2 = ReadFloat( jointMatrixAcc, jointMatrices, a, 9); bone->mOffsetMatrix.c3 = ReadFloat( jointMatrixAcc, jointMatrices, a, 10); bone->mOffsetMatrix.c4 = ReadFloat( jointMatrixAcc, jointMatrices, a, 11); - bone->mNumWeights = dstBones[a].size(); + bone->mNumWeights = static_cast(dstBones[a].size()); bone->mWeights = new aiVertexWeight[bone->mNumWeights]; std::copy( dstBones[a].begin(), dstBones[a].end(), bone->mWeights); @@ -798,7 +808,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada:: // Stores all meshes in the given scene void ColladaLoader::StoreSceneMeshes( aiScene* pScene) { - pScene->mNumMeshes = mMeshes.size(); + pScene->mNumMeshes = static_cast(mMeshes.size()); if( mMeshes.size() > 0) { pScene->mMeshes = new aiMesh*[mMeshes.size()]; @@ -811,7 +821,7 @@ void ColladaLoader::StoreSceneMeshes( aiScene* pScene) // Stores all cameras in the given scene void ColladaLoader::StoreSceneCameras( aiScene* pScene) { - pScene->mNumCameras = mCameras.size(); + pScene->mNumCameras = static_cast(mCameras.size()); if( mCameras.size() > 0) { pScene->mCameras = new aiCamera*[mCameras.size()]; @@ -824,7 +834,7 @@ void ColladaLoader::StoreSceneCameras( aiScene* pScene) // Stores all lights in the given scene void ColladaLoader::StoreSceneLights( aiScene* pScene) { - pScene->mNumLights = mLights.size(); + pScene->mNumLights = static_cast(mLights.size()); if( mLights.size() > 0) { pScene->mLights = new aiLight*[mLights.size()]; @@ -837,7 +847,7 @@ void ColladaLoader::StoreSceneLights( aiScene* pScene) // Stores all textures in the given scene void ColladaLoader::StoreSceneTextures( aiScene* pScene) { - pScene->mNumTextures = mTextures.size(); + pScene->mNumTextures = static_cast(mTextures.size()); if( mTextures.size() > 0) { pScene->mTextures = new aiTexture*[mTextures.size()]; @@ -850,7 +860,7 @@ void ColladaLoader::StoreSceneTextures( aiScene* pScene) // Stores all materials in the given scene void ColladaLoader::StoreSceneMaterials( aiScene* pScene) { - pScene->mNumMaterials = newMats.size(); + pScene->mNumMaterials = static_cast(newMats.size()); if (newMats.size() > 0) { pScene->mMaterials = new aiMaterial*[newMats.size()]; @@ -891,7 +901,7 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars combinedAnim->mName = aiString( std::string( "combinedAnim_") + char( '0' + a)); combinedAnim->mDuration = templateAnim->mDuration; combinedAnim->mTicksPerSecond = templateAnim->mTicksPerSecond; - combinedAnim->mNumChannels = collectedAnimIndices.size() + 1; + combinedAnim->mNumChannels = static_cast(collectedAnimIndices.size() + 1); combinedAnim->mChannels = new aiNodeAnim*[combinedAnim->mNumChannels]; // add the template anim as first channel by moving its aiNodeAnim to the combined animation combinedAnim->mChannels[0] = templateAnim->mChannels[0]; @@ -923,7 +933,7 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars // now store all anims in the scene if( !mAnims.empty()) { - pScene->mNumAnimations = mAnims.size(); + pScene->mNumAnimations = static_cast(mAnims.size()); pScene->mAnimations = new aiAnimation*[mAnims.size()]; std::copy( mAnims.begin(), mAnims.end(), pScene->mAnimations); } @@ -1207,9 +1217,9 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars { aiNodeAnim* dstAnim = new aiNodeAnim; dstAnim->mNodeName = nodeName; - dstAnim->mNumPositionKeys = resultTrafos.size(); - dstAnim->mNumRotationKeys= resultTrafos.size(); - dstAnim->mNumScalingKeys = resultTrafos.size(); + dstAnim->mNumPositionKeys = static_cast(resultTrafos.size()); + dstAnim->mNumRotationKeys= static_cast(resultTrafos.size()); + dstAnim->mNumScalingKeys = static_cast(resultTrafos.size()); dstAnim->mPositionKeys = new aiVectorKey[resultTrafos.size()]; dstAnim->mRotationKeys = new aiQuatKey[resultTrafos.size()]; dstAnim->mScalingKeys = new aiVectorKey[resultTrafos.size()]; @@ -1237,7 +1247,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars { aiAnimation* anim = new aiAnimation; anim->mName.Set( pName); - anim->mNumChannels = anims.size(); + anim->mNumChannels = static_cast(anims.size()); anim->mChannels = new aiNodeAnim*[anims.size()]; std::copy( anims.begin(), anims.end(), anim->mChannels); anim->mDuration = 0.0f; @@ -1520,13 +1530,13 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars // and copy texture data tex->mHeight = 0; - tex->mWidth = imIt->second.mImageData.size(); + tex->mWidth = static_cast(imIt->second.mImageData.size()); tex->pcData = (aiTexel*)new char[tex->mWidth]; memcpy(tex->pcData,&imIt->second.mImageData[0],tex->mWidth); // setup texture reference string result.data[0] = '*'; - result.length = 1 + ASSIMP_itoa10(result.data+1,MAXLEN-1,mTextures.size()); + result.length = 1 + ASSIMP_itoa10(result.data+1,static_cast(MAXLEN-1),static_cast(mTextures.size())); // and add this texture to the list mTextures.push_back(tex); From 4b6c69c4f8859db108dc40b10840b06b5af62f7b Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 03:17:39 +1100 Subject: [PATCH 10/52] Fixed an incorrect cast introduced in an earlier commit. --- code/BlenderLoader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/BlenderLoader.cpp b/code/BlenderLoader.cpp index 713146eea..bf6acf907 100644 --- a/code/BlenderLoader.cpp +++ b/code/BlenderLoader.cpp @@ -59,6 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StreamReader.h" #include "MemoryIOWrapper.h" #include +#include // zlib is needed for compressed blend files @@ -421,7 +422,7 @@ void BlenderImporter::ResolveImage(aiMaterial* out, const Material* mat, const M // check if the file contents are bundled with the BLEND file if (img->packedfile) { name.data[0] = '*'; - name.length = 1+ ASSIMP_itoa10(name.data+1,static_cast(MAXLEN-1), static_cast(conv_data.textures->size())); + name.length = 1+ ASSIMP_itoa10(name.data+1,static_cast(MAXLEN-1), static_cast(conv_data.textures->size())); conv_data.textures->push_back(new aiTexture()); aiTexture* tex = conv_data.textures->back(); From d16b8953b58f27958641b69009d3a62264d98638 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 03:24:55 +1100 Subject: [PATCH 11/52] Fixed build warnings on MSVC14 x64 in the Collada exporter. --- code/ColladaExporter.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index fdb31903f..72ca6aee3 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -524,7 +524,7 @@ void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial* } else { if( pKey ) - poSurface.exist = pSrcMat->Get( pKey, pType, pIndex, poSurface.color) == aiReturn_SUCCESS; + poSurface.exist = pSrcMat->Get( pKey, static_cast(pType), static_cast(pIndex), poSurface.color) == aiReturn_SUCCESS; } } @@ -827,7 +827,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex) // texture coords for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) { - if( mesh->HasTextureCoords( a) ) + if( mesh->HasTextureCoords(static_cast(a)) ) { WriteFloatArray( idstr + "-tex" + to_string(a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2, (ai_real*) mesh->mTextureCoords[a], mesh->mNumVertices); @@ -837,7 +837,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex) // vertex colors for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) { - if( mesh->HasVertexColors( a) ) + if( mesh->HasVertexColors(static_cast(a)) ) WriteFloatArray( idstr + "-color" + to_string(a), FloatType_Color, (ai_real*) mesh->mColors[a], mesh->mNumVertices); } @@ -849,12 +849,12 @@ void ColladaExporter::WriteGeometry( size_t pIndex) mOutput << startstr << "" << endstr; for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a ) { - if( mesh->HasTextureCoords( a) ) + if( mesh->HasTextureCoords(static_cast(a)) ) mOutput << startstr << "" << endstr; } for( size_t a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a ) { - if( mesh->HasVertexColors( a) ) + if( mesh->HasVertexColors(static_cast(a) ) ) mOutput << startstr << "" << endstr; } @@ -899,7 +899,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex) mOutput << startstr << "" << endstr; for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a ) { - if( mesh->HasTextureCoords( a) ) + if( mesh->HasTextureCoords(static_cast(a) ) ) mOutput << startstr << "" << endstr; } @@ -1129,7 +1129,7 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode) PushTag(); for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a ) { - if( mesh->HasTextureCoords( a) ) + if( mesh->HasTextureCoords( static_cast(a) ) ) // semantic as in // input_semantic as in // input_set as in From 9a323d6de3d95abbf2925b2726ac6d998680ebe9 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 03:29:47 +1100 Subject: [PATCH 12/52] Fixed build warnings on MSVC14 x64 in the CSM loader. --- code/CSMLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/CSMLoader.cpp b/code/CSMLoader.cpp index 925abf4bd..5f274c51f 100644 --- a/code/CSMLoader.cpp +++ b/code/CSMLoader.cpp @@ -179,7 +179,7 @@ void CSMImporter::InternReadFile( const std::string& pFile, nda->mNodeName.length = (size_t)(ot-nda->mNodeName.data); } - anim->mNumChannels = anims_temp.size(); + anim->mNumChannels = static_cast(anims_temp.size()); if (!anim->mNumChannels) throw DeadlyImportError("CSM: Empty $order section"); From 43ef4ec715953da08a8a294b0cdadb22311ec40e Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 03:34:39 +1100 Subject: [PATCH 13/52] Fixed build warnings on MSVC14 x64 in the D3MF format sources. --- code/D3MFImporter.cpp | 2 +- code/D3MFOpcPackage.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/D3MFImporter.cpp b/code/D3MFImporter.cpp index e75b89f7e..d8c062de4 100644 --- a/code/D3MFImporter.cpp +++ b/code/D3MFImporter.cpp @@ -172,7 +172,7 @@ private: mesh->mName.Set(name); meshes.push_back(mesh); - meshIds.push_back(meshIdx); + meshIds.push_back(static_cast(meshIdx)); meshIdx++; } diff --git a/code/D3MFOpcPackage.cpp b/code/D3MFOpcPackage.cpp index 2e63a346e..df83e70f5 100644 --- a/code/D3MFOpcPackage.cpp +++ b/code/D3MFOpcPackage.cpp @@ -123,19 +123,19 @@ voidpf IOSystem2Unzip::open(voidpf opaque, const char* filename, int mode) { uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void* buf, uLong size) { IOStream* io_stream = (IOStream*) stream; - return io_stream->Read(buf, 1, size); + return static_cast(io_stream->Read(buf, 1, size)); } uLong IOSystem2Unzip::write(voidpf /*opaque*/, voidpf stream, const void* buf, uLong size) { IOStream* io_stream = (IOStream*) stream; - return io_stream->Write(buf, 1, size); + return static_cast(io_stream->Write(buf, 1, size)); } long IOSystem2Unzip::tell(voidpf /*opaque*/, voidpf stream) { IOStream* io_stream = (IOStream*) stream; - return io_stream->Tell(); + return static_cast(io_stream->Tell()); } long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int origin) { From 0469a5c2e4b82e19be1ca6271d9c20ec9d1b2b68 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 03:45:25 +1100 Subject: [PATCH 14/52] Fixed build warnings on MSVC14 x64 in the debone process. --- code/DeboneProcess.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/DeboneProcess.cpp b/code/DeboneProcess.cpp index 5d688f813..41941b4ac 100644 --- a/code/DeboneProcess.cpp +++ b/code/DeboneProcess.cpp @@ -137,7 +137,7 @@ void DeboneProcess::Execute( aiScene* pScene) const aiString *find = newMeshes[b].second?&newMeshes[b].second->mName:0; aiNode *theNode = find?pScene->mRootNode->FindNode(*find):0; - std::pair push_pair(meshes.size(),theNode); + std::pair push_pair(static_cast(meshes.size()),theNode); mSubMeshIndices[a].push_back(push_pair); meshes.push_back(newMeshes[b].first); @@ -156,13 +156,13 @@ void DeboneProcess::Execute( aiScene* pScene) } else { // Mesh is kept unchanged - store it's new place in the mesh array - mSubMeshIndices[a].push_back(std::pair(meshes.size(),(aiNode*)0)); + mSubMeshIndices[a].push_back(std::pair(static_cast(meshes.size()),(aiNode*)0)); meshes.push_back(srcMesh); } } // rebuild the scene's mesh array - pScene->mNumMeshes = meshes.size(); + pScene->mNumMeshes = static_cast(meshes.size()); delete [] pScene->mMeshes; pScene->mMeshes = new aiMesh*[pScene->mNumMeshes]; std::copy( meshes.begin(), meshes.end(), pScene->mMeshes); @@ -382,7 +382,7 @@ void DeboneProcess::UpdateNode(aiNode* pNode) const // this will require two passes - unsigned int m = pNode->mNumMeshes, n = mSubMeshIndices.size(); + unsigned int m = static_cast(pNode->mNumMeshes), n = static_cast(mSubMeshIndices.size()); // first pass, look for meshes which have not moved @@ -390,7 +390,7 @@ void DeboneProcess::UpdateNode(aiNode* pNode) const unsigned int srcIndex = pNode->mMeshes[a]; const std::vector< std::pair< unsigned int,aiNode* > > &subMeshes = mSubMeshIndices[srcIndex]; - unsigned int nSubmeshes = subMeshes.size(); + unsigned int nSubmeshes = static_cast(subMeshes.size()); for(unsigned int b=0;b > &subMeshes = mSubMeshIndices[a]; - unsigned int nSubmeshes = subMeshes.size(); + unsigned int nSubmeshes = static_cast(subMeshes.size()); for(unsigned int b=0;bmMeshes; pNode->mMeshes = NULL; } - pNode->mNumMeshes = newMeshList.size(); + pNode->mNumMeshes = static_cast(newMeshList.size()); if(pNode->mNumMeshes) { pNode->mMeshes = new unsigned int[pNode->mNumMeshes]; From acad22cc1edecd43f5b8d66376c974597f49ad21 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 03:53:28 +1100 Subject: [PATCH 15/52] Fixed build warnings on MSVC14 x64 in the DXF format sources. --- code/DXFLoader.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/DXFLoader.cpp b/code/DXFLoader.cpp index 3e69eff1e..ab5ca146c 100644 --- a/code/DXFLoader.cpp +++ b/code/DXFLoader.cpp @@ -223,8 +223,8 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output) unsigned int vcount = 0, icount = 0; for (const DXF::Block& bl : output.blocks) { for (std::shared_ptr pl : bl.lines) { - vcount += pl->positions.size(); - icount += pl->counts.size(); + vcount += static_cast(pl->positions.size()); + icount += static_cast(pl->counts.size()); } } @@ -296,7 +296,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output) for(const DXF::PolyLine* pl : corr[elem.second]){ // sum over all faces since we need to 'verbosify' them. cvert += std::accumulate(pl->counts.begin(),pl->counts.end(),0); - cface += pl->counts.size(); + cface += static_cast(pl->counts.size()); } aiVector3D* verts = mesh->mVertices = new aiVector3D[cvert]; @@ -705,7 +705,7 @@ void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output) // closed polyline? if (line.flags & DXF_POLYLINE_FLAG_CLOSED) { - line.indices.push_back(line.positions.size()-1); + line.indices.push_back(static_cast(line.positions.size()-1)); line.indices.push_back(0); line.counts.push_back(2); } @@ -906,7 +906,7 @@ void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output) line.counts.push_back(cnt); for (unsigned int i = 0; i < cnt; ++i) { - line.indices.push_back(line.positions.size()); + line.indices.push_back(static_cast(line.positions.size())); line.positions.push_back(vip[i]); line.colors.push_back(clr); } From 2ac9b0ce45dc581ebbae92863006d4033ab2879e Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sat, 19 Nov 2016 23:50:03 +1100 Subject: [PATCH 16/52] Fixed build warnings on MSVC14 x64 in the FBX format sources. --- code/FBXConverter.cpp | 8 ++++---- code/FBXDocument.h | 2 +- code/FBXImporter.cpp | 2 +- code/FBXParser.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index 365d7fe65..26e5efc71 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -1076,7 +1076,7 @@ void Converter::SetupNodeMetadata( const Model& model, aiNode& nd ) // create metadata on node std::size_t numStaticMetaData = 2; aiMetadata* data = new aiMetadata(); - data->mNumProperties = unparsedProperties.size() + numStaticMetaData; + data->mNumProperties = static_cast(unparsedProperties.size() + numStaticMetaData); data->mKeys = new aiString[ data->mNumProperties ](); data->mValues = new aiMetadataEntry[ data->mNumProperties ](); nd.mMetaData = data; @@ -2964,10 +2964,10 @@ Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector Keys( new KeyTimeList() ); std::shared_ptr Values( new KeyValueList() ); - const int count = curve->GetKeys().size(); + const size_t count = curve->GetKeys().size(); Keys->reserve( count ); Values->reserve( count ); - for ( int n = 0; n < count; n++ ) + for (size_t n = 0; n < count; n++ ) { int64_t k = curve->GetKeys().at( n ); if ( k >= adj_start && k <= adj_stop ) @@ -3068,7 +3068,7 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c const KeyTimeList::value_type timeA = std::get<0>(kfl)->at( id0 ); const KeyTimeList::value_type timeB = std::get<0>(kfl)->at( id1 ); - const ai_real factor = timeB == timeA ? 0. : static_cast( ( time - timeA ) ) / ( timeB - timeA ); + const ai_real factor = timeB == timeA ? ai_real(0.) : static_cast( ( time - timeA ) ) / ( timeB - timeA ); const ai_real interpValue = static_cast( valueA + ( valueB - valueA ) * factor ); result[ std::get<2>(kfl) ] = interpValue; diff --git a/code/FBXDocument.h b/code/FBXDocument.h index 6016805ed..be67e32e6 100644 --- a/code/FBXDocument.h +++ b/code/FBXDocument.h @@ -600,7 +600,7 @@ public: } const int textureCount() const { - return textures.size(); + return static_cast(textures.size()); } const BlendMode GetBlendMode() const { diff --git a/code/FBXImporter.cpp b/code/FBXImporter.cpp index b319da8b6..7cf5dfa9a 100644 --- a/code/FBXImporter.cpp +++ b/code/FBXImporter.cpp @@ -165,7 +165,7 @@ void FBXImporter::InternReadFile( const std::string& pFile, bool is_binary = false; if (!strncmp(begin,"Kaydara FBX Binary",18)) { is_binary = true; - TokenizeBinary(tokens,begin,contents.size()); + TokenizeBinary(tokens,begin,static_cast(contents.size())); } else { Tokenize(tokens,begin); diff --git a/code/FBXParser.cpp b/code/FBXParser.cpp index beca20b14..8e9d40beb 100644 --- a/code/FBXParser.cpp +++ b/code/FBXParser.cpp @@ -583,7 +583,7 @@ void ReadBinaryDataArray(char type, uint32_t count, const char*& data, const cha zstream.next_in = reinterpret_cast( const_cast(data) ); zstream.avail_in = comp_len; - zstream.avail_out = buff.size(); + zstream.avail_out = static_cast(buff.size()); zstream.next_out = reinterpret_cast(&*buff.begin()); const int ret = inflate(&zstream, Z_FINISH); From d9b0449e835f3cdee66845295c5cbc15d1f7992d Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 00:18:29 +1100 Subject: [PATCH 17/52] Fixed build warnings on MSVC14 x64 in the glTF format sources. One warning yet to be resolved. --- code/glTFAsset.inl | 30 +++++++++++++++--------------- code/glTFAssetWriter.inl | 2 +- code/glTFExporter.cpp | 19 +++++++++---------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/code/glTFAsset.inl b/code/glTFAsset.inl index a7afb3424..315d6bec3 100644 --- a/code/glTFAsset.inl +++ b/code/glTFAsset.inl @@ -926,7 +926,7 @@ Ref buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer); // Read data from buffer and place it in BinaryStream for decoder. // Just "Count" because always is used type equivalent to uint8_t. - bstream.LoadFromBuffer(&buf->GetPointer()[pCompression_Open3DGC.Offset], pCompression_Open3DGC.Count); + bstream.LoadFromBuffer(&buf->GetPointer()[pCompression_Open3DGC.Offset], static_cast(pCompression_Open3DGC.Count)); // After decoding header we can get size of primitives. if(decoder.DecodeHeader(ifs, bstream) != o3dgc::O3DGC_OK) throw DeadlyImportError("GLTF: can not decode Open3DGC header."); @@ -970,9 +970,9 @@ Ref buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer); { // size = number_of_elements * components_per_element * size_of_component. // Note. But as you can see above, at first we are use this variable in meaning "count". After checking count of objects... - size_t tval = ifs.GetNFloatAttribute(idx); + size_t tval = ifs.GetNFloatAttribute(static_cast(idx)); - switch(ifs.GetFloatAttributeType(idx)) + switch(ifs.GetFloatAttributeType(static_cast(idx))) { case o3dgc::O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD: // Check situation when encoded data contain texture coordinates but primitive not. @@ -986,15 +986,15 @@ Ref buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer); } else { - ifs.SetNFloatAttribute(idx, 0);// Disable decoding this attribute. + ifs.SetNFloatAttribute(static_cast(idx), 0ul);// Disable decoding this attribute. } break; default: - throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(idx))); + throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(static_cast(idx)))); } - tval *= ifs.GetFloatAttributeDim(idx) * sizeof(o3dgc::Real);// After checking count of objects we can get size of array. + tval *= ifs.GetFloatAttributeDim(static_cast(idx)) * sizeof(o3dgc::Real);// After checking count of objects we can get size of array. size_floatattr[idx] = tval; decoded_data_size += tval; } @@ -1002,14 +1002,14 @@ Ref buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer); for(size_t idx = 0, idx_end = size_intattr.size(); idx < idx_end; idx++) { // size = number_of_elements * components_per_element * size_of_component. See float attributes note. - size_t tval = ifs.GetNIntAttribute(idx); - switch( ifs.GetIntAttributeType( idx ) ) + size_t tval = ifs.GetNIntAttribute(static_cast(idx)); + switch( ifs.GetIntAttributeType(static_cast(idx) ) ) { default: - throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(idx))); + throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(static_cast(idx)))); } - tval *= ifs.GetIntAttributeDim(idx) * sizeof(long);// See float attributes note. + tval *= ifs.GetIntAttributeDim(static_cast(idx)) * sizeof(long);// See float attributes note. size_intattr[idx] = tval; decoded_data_size += tval; } @@ -1033,29 +1033,29 @@ Ref buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer); for(size_t idx = 0, idx_end = size_floatattr.size(), idx_texcoord = 0; idx < idx_end; idx++) { - switch(ifs.GetFloatAttributeType(idx)) + switch(ifs.GetFloatAttributeType(static_cast(idx))) { case o3dgc::O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD: if(idx_texcoord < primitives[0].attributes.texcoord.size()) { // See above about absent attributes. - ifs.SetFloatAttribute(idx, (o3dgc::Real* const)(decoded_data + get_buf_offset(primitives[0].attributes.texcoord[idx]))); + ifs.SetFloatAttribute(static_cast(idx), (o3dgc::Real* const)(decoded_data + get_buf_offset(primitives[0].attributes.texcoord[idx]))); idx_texcoord++; } break; default: - throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(idx))); + throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(static_cast(idx)))); } } for(size_t idx = 0, idx_end = size_intattr.size(); idx < idx_end; idx++) { - switch(ifs.GetIntAttributeType(idx)) + switch(ifs.GetIntAttributeType(static_cast(idx))) { // ifs.SetIntAttribute(idx, (long* const)(decoded_data + get_buf_offset(primitives[0].attributes.joint))); default: - throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(idx))); + throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(static_cast(idx)))); } } diff --git a/code/glTFAssetWriter.inl b/code/glTFAssetWriter.inl index 0e7a71eb5..1e545b497 100644 --- a/code/glTFAssetWriter.inl +++ b/code/glTFAssetWriter.inl @@ -64,7 +64,7 @@ namespace glTF { inline Value& MakeValue(Value& val, const std::vector & r, MemoryPoolAllocator<>& al) { val.SetArray(); - val.Reserve(r.size(), al); + val.Reserve(static_cast(r.size()), al); for (unsigned int i = 0; i < r.size(); ++i) { val.PushBack(r[i], al); } diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index f2203929c..66d45ab9c 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -116,7 +116,6 @@ glTFExporter::glTFExporter(const char* filename, IOSystem* pIOSystem, const aiSc mScene = sceneCopy.get(); - std::unique_ptr asset(); mAsset.reset( new glTF::Asset( pIOSystem ) ); if (isBinary) { @@ -461,7 +460,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aim, Ref& meshRef, RefmOffsetMatrix, tmpMatrix4); inverseBindMatricesData.push_back(tmpMatrix4); - jointNamesIndex = inverseBindMatricesData.size() - 1; + jointNamesIndex = static_cast(inverseBindMatricesData.size() - 1); } // aib->mWeights =====> vertexWeightData @@ -682,13 +681,13 @@ void glTFExporter::ExportMeshes() { size_t num = comp_o3dgc_ifs.GetNumFloatAttributes(); - comp_o3dgc_params.SetFloatAttributeQuantBits(num, quant_texcoord); - comp_o3dgc_params.SetFloatAttributePredMode(num, prediction_texcoord); - comp_o3dgc_ifs.SetNFloatAttribute(num, aim->mNumVertices);// number of elements. - comp_o3dgc_ifs.SetFloatAttributeDim(num, aim->mNumUVComponents[num_tc]);// components per element: aiVector3D => x * float - comp_o3dgc_ifs.SetFloatAttributeType(num, o3dgc::O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD); - comp_o3dgc_ifs.SetFloatAttribute(num, (o3dgc::Real* const)&b->GetPointer()[idx_srcdata_tc[num_tc]]); - comp_o3dgc_ifs.SetNumFloatAttributes(num + 1); + comp_o3dgc_params.SetFloatAttributeQuantBits(static_cast(num), quant_texcoord); + comp_o3dgc_params.SetFloatAttributePredMode(static_cast(num), prediction_texcoord); + comp_o3dgc_ifs.SetNFloatAttribute(static_cast(num), aim->mNumVertices);// number of elements. + comp_o3dgc_ifs.SetFloatAttributeDim(static_cast(num), aim->mNumUVComponents[num_tc]);// components per element: aiVector3D => x * float + comp_o3dgc_ifs.SetFloatAttributeType(static_cast(num), o3dgc::O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD); + comp_o3dgc_ifs.SetFloatAttribute(static_cast(num), (o3dgc::Real* const)&b->GetPointer()[idx_srcdata_tc[num_tc]]); + comp_o3dgc_ifs.SetNumFloatAttributes(static_cast(num + 1)); } // Coordinates indices @@ -736,7 +735,7 @@ void glTFExporter::ExportMeshes() CopyValue(inverseBindMatricesData[idx_joint], invBindMatrixData[idx_joint]); } - Ref invBindMatrixAccessor = ExportData(*mAsset, skinName, b, inverseBindMatricesData.size(), invBindMatrixData, AttribType::MAT4, AttribType::MAT4, ComponentType_FLOAT); + Ref invBindMatrixAccessor = ExportData(*mAsset, skinName, b, static_cast(inverseBindMatricesData.size()), invBindMatrixData, AttribType::MAT4, AttribType::MAT4, ComponentType_FLOAT); if (invBindMatrixAccessor) skinRef->inverseBindMatrices = invBindMatrixAccessor; // Identity Matrix =====> skinRef->bindShapeMatrix From 5f098b2f94b061c818e9fd1bfa54ae331dbed069 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 01:13:55 +1100 Subject: [PATCH 18/52] Fixed build warnings on MSVC14 x64 in the IFC format sources. --- code/IFCBoolean.cpp | 6 +++--- code/IFCGeometry.cpp | 17 ++++++++--------- code/IFCLoader.cpp | 2 +- code/IFCMaterial.cpp | 2 +- code/IFCOpenings.cpp | 4 ++-- code/IFCProfile.cpp | 4 ++-- code/IFCUtil.cpp | 6 +++--- 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/code/IFCBoolean.cpp b/code/IFCBoolean.cpp index 042515311..d3b77d87c 100644 --- a/code/IFCBoolean.cpp +++ b/code/IFCBoolean.cpp @@ -109,7 +109,7 @@ void FilterPolygon(std::vector& resultpoly) } IfcVector3 vmin, vmax; - ArrayBounds(resultpoly.data(), resultpoly.size(), vmin, vmax); + ArrayBounds(resultpoly.data(), static_cast(resultpoly.size()), vmin, vmax); // filter our IfcFloat points - those may happen if a point lies // directly on the intersection line or directly on the clipping plane @@ -132,7 +132,7 @@ void WritePolygon(std::vector& resultpoly, TempMesh& result) if( resultpoly.size() > 2 ) { result.verts.insert(result.verts.end(), resultpoly.begin(), resultpoly.end()); - result.vertcnt.push_back(resultpoly.size()); + result.vertcnt.push_back(static_cast(resultpoly.size())); } } @@ -589,7 +589,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded // to result mesh unchanged if( !startedInside ) { - outvertcnt.push_back(blackside.size()); + outvertcnt.push_back(static_cast(blackside.size())); outvert.insert(outvert.end(), blackside.begin(), blackside.end()); continue; } diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 3d0cda31d..f80fadff9 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -70,7 +70,7 @@ bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData& ++cnt; } - meshout.vertcnt.push_back(cnt); + meshout.vertcnt.push_back(static_cast(cnt)); // zero- or one- vertex polyloops simply ignored if (meshout.vertcnt.back() > 1) { @@ -180,7 +180,7 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m // fill a mesh with ONLY the main polygon TempMesh temp; temp.verts.reserve(outer_polygon_size); - temp.vertcnt.push_back(outer_polygon_size); + temp.vertcnt.push_back(static_cast(outer_polygon_size)); std::copy(outer_vit, outer_vit+outer_polygon_size, std::back_inserter(temp.verts)); @@ -305,8 +305,8 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul for(size_t i = 0; i < size; ++i ) { out.push_back(out[i*4]); } - result.vertcnt.push_back(size); - result.vertcnt.push_back(size); + result.vertcnt.push_back(static_cast(size)); + result.vertcnt.push_back(static_cast(size)); } IfcMatrix4 trafo; @@ -638,7 +638,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv out.push_back(in[i]); } - curmesh.vertcnt.push_back(in.size()); + curmesh.vertcnt.push_back(static_cast(in.size())); if( openings && in.size() > 2 ) { if( GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) { ++sides_with_v_openings; @@ -665,7 +665,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv std::shared_ptr profile2D = std::shared_ptr(new TempMesh()); profile2D->verts.insert(profile2D->verts.end(), in.begin(), in.end()); - profile2D->vertcnt.push_back(in.size()); + profile2D->vertcnt.push_back(static_cast(in.size())); conv.collect_openings->push_back(TempOpening(&solid, dir, profile, profile2D)); ai_assert(result.IsEmpty()); @@ -810,7 +810,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid, aiMesh* const mesh = meshtmp->ToMesh(); if(mesh) { mesh->mMaterialIndex = matid; - mesh_indices.push_back(conv.meshes.size()); + mesh_indices.push_back(static_cast(conv.meshes.size())); conv.meshes.push_back(mesh); return true; } @@ -827,9 +827,8 @@ void AssignAddedMeshes(std::vector& mesh_indices,aiNode* nd, std::sort(mesh_indices.begin(),mesh_indices.end()); std::vector::iterator it_end = std::unique(mesh_indices.begin(),mesh_indices.end()); - const size_t size = std::distance(mesh_indices.begin(),it_end); + nd->mNumMeshes = static_cast(std::distance(mesh_indices.begin(),it_end)); - nd->mNumMeshes = size; nd->mMeshes = new unsigned int[nd->mNumMeshes]; for(unsigned int i = 0; i < nd->mNumMeshes; ++i) { nd->mMeshes[i] = mesh_indices[i]; diff --git a/code/IFCLoader.cpp b/code/IFCLoader.cpp index 34977f5b0..f7fb6e0e4 100644 --- a/code/IFCLoader.cpp +++ b/code/IFCLoader.cpp @@ -708,7 +708,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion if (!properties.empty()) { aiMetadata* data = new aiMetadata(); - data->mNumProperties = properties.size(); + data->mNumProperties = static_cast(properties.size()); data->mKeys = new aiString[data->mNumProperties](); data->mValues = new aiMetadataEntry[data->mNumProperties](); diff --git a/code/IFCMaterial.cpp b/code/IFCMaterial.cpp index 7525db089..ae2fa3619 100644 --- a/code/IFCMaterial.cpp +++ b/code/IFCMaterial.cpp @@ -159,7 +159,7 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat FillMaterial(mat.get(), surf, conv); conv.materials.push_back(mat.release()); - unsigned int matindex = conv.materials.size() - 1; + unsigned int matindex = static_cast(conv.materials.size() - 1); conv.cached_materials[surf] = matindex; return matindex; } diff --git a/code/IFCOpenings.cpp b/code/IFCOpenings.cpp index 3197426cf..c2a7439ee 100644 --- a/code/IFCOpenings.cpp +++ b/code/IFCOpenings.cpp @@ -364,7 +364,7 @@ void InsertWindowContours(const ContourVector& contours, } if (const size_t d = curmesh.verts.size()-old) { - curmesh.vertcnt.push_back(d); + curmesh.vertcnt.push_back(static_cast(d)); std::reverse(curmesh.verts.rbegin(),curmesh.verts.rbegin()+d); } if (n == very_first_hit) { @@ -549,7 +549,7 @@ void CleanupOuterContour(const std::vector& contour_flat, TempMesh& clipper.Execute(ClipperLib::ctIntersection,clipped,ClipperLib::pftNonZero,ClipperLib::pftNonZero); for(const ClipperLib::ExPolygon& ex : clipped) { - iold.push_back(ex.outer.size()); + iold.push_back(static_cast(ex.outer.size())); for(const ClipperLib::IntPoint& point : ex.outer) { vold.push_back(IfcVector3( from_int64(point.X), diff --git a/code/IFCProfile.cpp b/code/IFCProfile.cpp index 01b9008e4..a84f98f58 100644 --- a/code/IFCProfile.cpp +++ b/code/IFCProfile.cpp @@ -59,7 +59,7 @@ void ProcessPolyLine(const IfcPolyline& def, TempMesh& meshout, ConversionData& ConvertCartesianPoint(t,cp); meshout.verts.push_back(t); } - meshout.vertcnt.push_back(meshout.verts.size()); + meshout.vertcnt.push_back(static_cast(meshout.verts.size())); } // ------------------------------------------------------------------------------------------------ @@ -80,7 +80,7 @@ bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& con IFCImporter::LogError(cv.s+ " (error occurred while processing curve)"); return false; } - meshout.vertcnt.push_back(meshout.verts.size()); + meshout.vertcnt.push_back(static_cast(meshout.verts.size())); return true; } diff --git a/code/IFCUtil.cpp b/code/IFCUtil.cpp index 89a6c78c5..7caebbcd4 100644 --- a/code/IFCUtil.cpp +++ b/code/IFCUtil.cpp @@ -180,7 +180,7 @@ IfcVector3 TempMesh::ComputePolygonNormal(const IfcVector3* vtcs, size_t cnt, bo } IfcVector3 nor; - NewellNormal<3, 3, 3>(nor, cnt, &temp[0], &temp[1], &temp[2]); + NewellNormal<3, 3, 3>(nor, static_cast(cnt), &temp[0], &temp[1], &temp[2]); return normalize ? nor.Normalize() : nor; } @@ -548,7 +548,7 @@ void ConvertCartesianPoint(IfcVector3& out, const IfcCartesianPoint& in) { out = IfcVector3(); for(size_t i = 0; i < in.Coordinates.size(); ++i) { - out[i] = in.Coordinates[i]; + out[static_cast(i)] = in.Coordinates[i]; } } @@ -564,7 +564,7 @@ void ConvertDirection(IfcVector3& out, const IfcDirection& in) { out = IfcVector3(); for(size_t i = 0; i < in.DirectionRatios.size(); ++i) { - out[i] = in.DirectionRatios[i]; + out[static_cast(i)] = in.DirectionRatios[i]; } const IfcFloat len = out.Length(); if (len<1e-6) { From c7efb50ad1515dd260e066e835110a6e94b609c9 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 01:36:33 +1100 Subject: [PATCH 19/52] Fixed build warnings on MSVC14 x64 in the core Importer. --- code/Importer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/Importer.cpp b/code/Importer.cpp index 45b91feea..d60dfb6b0 100644 --- a/code/Importer.cpp +++ b/code/Importer.cpp @@ -654,7 +654,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags) uint32_t fileSize = 0; if (fileIO) { - fileSize = fileIO->FileSize(); + fileSize = static_cast(fileIO->FileSize()); pimpl->mIOHandler->Close( fileIO ); } @@ -790,7 +790,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags) for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) { BaseProcess* process = pimpl->mPostProcessingSteps[a]; - pimpl->mProgressHandler->UpdatePostProcess( a, pimpl->mPostProcessingSteps.size() ); + pimpl->mProgressHandler->UpdatePostProcess(static_cast(a), static_cast(pimpl->mPostProcessingSteps.size()) ); if( process->IsActive( pFlags)) { if (profiler) { @@ -825,7 +825,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags) } #endif // ! DEBUG } - pimpl->mProgressHandler->UpdatePostProcess( pimpl->mPostProcessingSteps.size(), pimpl->mPostProcessingSteps.size() ); + pimpl->mProgressHandler->UpdatePostProcess( static_cast(pimpl->mPostProcessingSteps.size()), static_cast(pimpl->mPostProcessingSteps.size()) ); // update private scene flags if( pimpl->mScene ) From 1e2c0279b092020364a5363fb7faf3ff34a59df4 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 01:52:04 +1100 Subject: [PATCH 20/52] Fixed build warnings on MSVC14 x64 in the IRR format sources. --- code/IRRLoader.cpp | 14 +++++++------- code/irrXMLWrapper.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/code/IRRLoader.cpp b/code/IRRLoader.cpp index 6e2a9a5b5..1056893f5 100644 --- a/code/IRRLoader.cpp +++ b/code/IRRLoader.cpp @@ -215,7 +215,7 @@ void IRRImporter::BuildSkybox(std::vector& meshes, std::vectormMaterialIndex = materials.size()-6u; + meshes.back()->mMaterialIndex = static_cast(materials.size()-6u); // LEFT SIDE meshes.push_back( BuildSingleQuadMesh( @@ -223,7 +223,7 @@ void IRRImporter::BuildSkybox(std::vector& meshes, std::vectormMaterialIndex = materials.size()-5u; + meshes.back()->mMaterialIndex = static_cast(materials.size()-5u); // BACK SIDE meshes.push_back( BuildSingleQuadMesh( @@ -231,7 +231,7 @@ void IRRImporter::BuildSkybox(std::vector& meshes, std::vectormMaterialIndex = materials.size()-4u; + meshes.back()->mMaterialIndex = static_cast(materials.size()-4u); // RIGHT SIDE meshes.push_back( BuildSingleQuadMesh( @@ -239,7 +239,7 @@ void IRRImporter::BuildSkybox(std::vector& meshes, std::vectormMaterialIndex = materials.size()-3u; + meshes.back()->mMaterialIndex = static_cast(materials.size()-3u); // TOP SIDE meshes.push_back( BuildSingleQuadMesh( @@ -247,7 +247,7 @@ void IRRImporter::BuildSkybox(std::vector& meshes, std::vectormMaterialIndex = materials.size()-2u; + meshes.back()->mMaterialIndex = static_cast(materials.size()-2u); // BOTTOM SIDE meshes.push_back( BuildSingleQuadMesh( @@ -255,7 +255,7 @@ void IRRImporter::BuildSkybox(std::vector& meshes, std::vectormMaterialIndex = materials.size()-1u; + meshes.back()->mMaterialIndex = static_cast(materials.size()-1u); } // ------------------------------------------------------------------------------------------------ @@ -641,7 +641,7 @@ void SetupMapping (aiMaterial* mat, aiTextureMapping mode, const aiVector3D& axi delete[] mat->mProperties; mat->mProperties = new aiMaterialProperty*[p.size()*2]; - mat->mNumAllocated = p.size()*2; + mat->mNumAllocated = static_cast(p.size()*2); } mat->mNumProperties = (unsigned int)p.size(); ::memcpy(mat->mProperties,&p[0],sizeof(void*)*mat->mNumProperties); diff --git a/code/irrXMLWrapper.h b/code/irrXMLWrapper.h index 41e418811..5b47faefe 100644 --- a/code/irrXMLWrapper.h +++ b/code/irrXMLWrapper.h @@ -92,7 +92,7 @@ public: // Remove null characters from the input sequence otherwise the parsing will utterly fail unsigned int size = 0; - unsigned int size_max = data.size(); + unsigned int size_max = static_cast(data.size()); for(unsigned int i = 0; i < size_max; i++) { if(data[i] != '\0') { data[size++] = data[i]; @@ -117,7 +117,7 @@ public: return 0; } if(t+sizeToRead>data.size()) { - sizeToRead = data.size()-t; + sizeToRead = static_cast(data.size()-t); } memcpy(buffer,&data.front()+t,sizeToRead); From 4df18f93ea473ecdcb71261afe86c5b9e02a551b Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 01:53:47 +1100 Subject: [PATCH 21/52] Fixed build warnings on MSVC14 x64 in the limit bone weights post-process. --- code/LimitBoneWeightsProcess.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/LimitBoneWeightsProcess.cpp b/code/LimitBoneWeightsProcess.cpp index e7fd9ab60..e35fe1462 100644 --- a/code/LimitBoneWeightsProcess.cpp +++ b/code/LimitBoneWeightsProcess.cpp @@ -129,9 +129,9 @@ void LimitBoneWeightsProcess::ProcessMesh( aiMesh* pMesh) std::sort( vit->begin(), vit->end()); // now kill everything beyond the maximum count - unsigned int m = vit->size(); + unsigned int m = static_cast(vit->size()); vit->erase( vit->begin() + mMaxWeights, vit->end()); - removed += m-vit->size(); + removed += static_cast(m-vit->size()); // and renormalize the weights float sum = 0.0f; From 2c93e29dcc33a53f44b7173efe296f4e6bed95f5 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 02:01:57 +1100 Subject: [PATCH 22/52] Fixed build warnings on MSVC14 x64 in the LWO format sources. --- code/LWOAnimation.cpp | 6 +++--- code/LWOLoader.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/LWOAnimation.cpp b/code/LWOAnimation.cpp index f41853dad..10bc54b16 100644 --- a/code/LWOAnimation.cpp +++ b/code/LWOAnimation.cpp @@ -565,7 +565,7 @@ void AnimResolver::ExtractAnimChannel(aiNodeAnim** out, unsigned int flags /*= 0 std::vector keys; GetKeys(keys,trans_x,trans_y,trans_z,flags); - anim->mPositionKeys = new aiVectorKey[ anim->mNumPositionKeys = keys.size() ]; + anim->mPositionKeys = new aiVectorKey[ anim->mNumPositionKeys = static_cast(keys.size()) ]; std::copy(keys.begin(),keys.end(),anim->mPositionKeys); } @@ -574,7 +574,7 @@ void AnimResolver::ExtractAnimChannel(aiNodeAnim** out, unsigned int flags /*= 0 std::vector keys; GetKeys(keys,rotat_x,rotat_y,rotat_z,flags); - anim->mRotationKeys = new aiQuatKey[ anim->mNumRotationKeys = keys.size() ]; + anim->mRotationKeys = new aiQuatKey[ anim->mNumRotationKeys = static_cast(keys.size()) ]; // convert heading, pitch, bank to quaternion // mValue.x=Heading=Rot(Y), mValue.y=Pitch=Rot(X), mValue.z=Bank=Rot(Z) @@ -594,7 +594,7 @@ void AnimResolver::ExtractAnimChannel(aiNodeAnim** out, unsigned int flags /*= 0 std::vector keys; GetKeys(keys,scale_x,scale_y,scale_z,flags); - anim->mScalingKeys = new aiVectorKey[ anim->mNumScalingKeys = keys.size() ]; + anim->mScalingKeys = new aiVectorKey[ anim->mNumScalingKeys = static_cast(keys.size()) ]; std::copy(keys.begin(),keys.end(),anim->mScalingKeys); } } diff --git a/code/LWOLoader.cpp b/code/LWOLoader.cpp index 222ec8e2c..36daa0428 100644 --- a/code/LWOLoader.cpp +++ b/code/LWOLoader.cpp @@ -426,7 +426,7 @@ void LWOImporter::InternReadFile( const std::string& pFile, } // Generate nodes to render the mesh. Store the source layer in the mParent member of the nodes - unsigned int num = apcMeshes.size() - meshStart; + unsigned int num = static_cast(apcMeshes.size() - meshStart); if (layer.mName != "" || num > 0) { aiNode* pcNode = new aiNode(); apcNodes[layer.mIndex] = pcNode; From 335003a5a338af01968b6e13d7fa498dcfbfca2a Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 02:03:53 +1100 Subject: [PATCH 23/52] Fixed build warnings on MSVC14 x64 in the LWS format sources. --- code/LWSLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/LWSLoader.cpp b/code/LWSLoader.cpp index a81c15a6e..6ca3cf589 100644 --- a/code/LWSLoader.cpp +++ b/code/LWSLoader.cpp @@ -902,7 +902,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, anim->mTicksPerSecond = fps; anim->mDuration = last-(first-1); /* fixme ... zero or one-based?*/ - anim->mChannels = new aiNodeAnim*[anim->mNumChannels = anims.size()]; + anim->mChannels = new aiNodeAnim*[anim->mNumChannels = static_cast(anims.size())]; std::copy(anims.begin(),anims.end(),anim->mChannels); } From 60cd4605eb7bfd5d575a21f367fc54f379d8f273 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 02:11:01 +1100 Subject: [PATCH 24/52] Fixed build warnings on MSVC14 x64 in the Material System source. --- code/MaterialSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/MaterialSystem.cpp b/code/MaterialSystem.cpp index 21cd38f79..5fcf28a4f 100644 --- a/code/MaterialSystem.cpp +++ b/code/MaterialSystem.cpp @@ -529,7 +529,7 @@ aiReturn aiMaterial::AddProperty (const aiString* pInput, s[1] = static_cast(pInput->length); return AddBinaryProperty(s+1, - pInput->length+1+4, + static_cast(pInput->length+1+4), pKey, type, index, @@ -537,7 +537,7 @@ aiReturn aiMaterial::AddProperty (const aiString* pInput, } ai_assert(sizeof(size_t)==4); return AddBinaryProperty(pInput, - pInput->length+1+4, + static_cast(pInput->length+1+4), pKey, type, index, From 923b0144722248c80b093afa1ec80c971fdb2e86 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 02:40:18 +1100 Subject: [PATCH 25/52] Fixed build warnings on MSVC14 x64 in the MD3 and MD5 format sources. --- code/MD3Loader.cpp | 2 +- code/MD5Loader.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/MD3Loader.cpp b/code/MD3Loader.cpp index a99fb06b1..0736e84b9 100644 --- a/code/MD3Loader.cpp +++ b/code/MD3Loader.cpp @@ -709,7 +709,7 @@ void MD3Importer::ConvertPath(const char* texture_name, const char* header_name, } } else len2 = std::min (len1, (size_t)(end2 - texture_name )); - if (!ASSIMP_strincmp(texture_name,header_name,len2)) { + if (!ASSIMP_strincmp(texture_name,header_name,static_cast(len2))) { // Use the file name only out = end2+1; return; diff --git a/code/MD5Loader.cpp b/code/MD5Loader.cpp index 8c66f6507..0703e92de 100644 --- a/code/MD5Loader.cpp +++ b/code/MD5Loader.cpp @@ -228,8 +228,8 @@ void MD5Importer::MakeDataUnique (MD5::MeshDesc& meshSrc) std::vector abHad(meshSrc.mVertices.size(),false); // allocate enough storage to keep the output structures - const unsigned int iNewNum = meshSrc.mFaces.size()*3; - unsigned int iNewIndex = meshSrc.mVertices.size(); + const unsigned int iNewNum = static_cast(meshSrc.mFaces.size()*3); + unsigned int iNewIndex = static_cast(meshSrc.mVertices.size()); meshSrc.mVertices.resize(iNewNum); // try to guess how much storage we'll need for new weights @@ -719,16 +719,16 @@ void MD5Importer::LoadMD5CameraFile () // every cut is written to a separate aiAnimation if (!cuts.size()) { cuts.push_back(0); - cuts.push_back(frames.size()-1); + cuts.push_back(static_cast(frames.size()-1)); } else { cuts.insert(cuts.begin(),0); if (cuts.back() < frames.size()-1) - cuts.push_back(frames.size()-1); + cuts.push_back(static_cast(frames.size()-1)); } - pScene->mNumAnimations = cuts.size()-1; + pScene->mNumAnimations = static_cast(cuts.size()-1); aiAnimation** tmp = pScene->mAnimations = new aiAnimation*[pScene->mNumAnimations]; for (std::vector::const_iterator it = cuts.begin(); it != cuts.end()-1; ++it) { From 2946a7349bf471450b51c29cc2acc383e4df1e5c Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 02:40:36 +1100 Subject: [PATCH 26/52] Fixed build warnings on MSVC14 x64 in the MS3D format sources. --- code/MS3DLoader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/MS3DLoader.cpp b/code/MS3DLoader.cpp index ef16a756a..c50ccc46e 100644 --- a/code/MS3DLoader.cpp +++ b/code/MS3DLoader.cpp @@ -423,7 +423,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile, for (unsigned int i = 0; i < groups.size(); ++i) { TempGroup& g = groups[i]; if (g.mat == UINT_MAX) { - g.mat = materials.size()-1; + g.mat = static_cast(materials.size()-1); } } } @@ -483,7 +483,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile, m->mMaterialIndex = g.mat; m->mPrimitiveTypes = aiPrimitiveType_TRIANGLE; - m->mFaces = new aiFace[m->mNumFaces = g.triangles.size()]; + m->mFaces = new aiFace[m->mNumFaces = static_cast(g.triangles.size())]; m->mNumVertices = m->mNumFaces*3; // storage for vertices - verbose format, as requested by the postprocessing pipeline From 745f75431083f88e91fa1437f7401b201898c0a1 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 12:04:50 +1100 Subject: [PATCH 27/52] Fixed build warnings on MSVC14 x64 in the Message Proc source. --- tools/assimp_view/MessageProc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/assimp_view/MessageProc.cpp b/tools/assimp_view/MessageProc.cpp index 74c94d7d6..4595c58cd 100644 --- a/tools/assimp_view/MessageProc.cpp +++ b/tools/assimp_view/MessageProc.cpp @@ -1537,7 +1537,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, SetTextColor(pcStruct->hDC,RGB(0xFF-r,0xFF-g,0xFF-b)); SetBkMode(pcStruct->hDC,TRANSPARENT); - TextOut(pcStruct->hDC,4,1,szText,strlen(szText)); + TextOut(pcStruct->hDC,4,1,szText, static_cast(strlen(szText))); bDraw = true; } else if(IDC_LCOLOR2 == pcStruct->CtlID) @@ -1568,7 +1568,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, SetTextColor(pcStruct->hDC,RGB(0xFF-r,0xFF-g,0xFF-b)); SetBkMode(pcStruct->hDC,TRANSPARENT); - TextOut(pcStruct->hDC,4,1,szText,strlen(szText)); + TextOut(pcStruct->hDC,4,1,szText, static_cast(strlen(szText))); bDraw = true; } else if(IDC_LCOLOR3 == pcStruct->CtlID) @@ -1597,7 +1597,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, SetTextColor(pcStruct->hDC,RGB(0xFF-r,0xFF-g,0xFF-b)); SetBkMode(pcStruct->hDC,TRANSPARENT); - TextOut(pcStruct->hDC,4,1,szText,strlen(szText)); + TextOut(pcStruct->hDC,4,1,szText,static_cast(strlen(szText))); bDraw = true; } // draw the black border around the rects From 8478b03f2204201ace0e6c4eb60f1e0a17194898 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 12:27:04 +1100 Subject: [PATCH 28/52] Fixed build warnings on MSVC14 x64 in the NDO format sources. --- code/NDOLoader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/NDOLoader.cpp b/code/NDOLoader.cpp index f04eb5345..219057c47 100644 --- a/code/NDOLoader.cpp +++ b/code/NDOLoader.cpp @@ -257,7 +257,7 @@ void NDOImporter::InternReadFile( const std::string& pFile, } aiMesh* mesh = new aiMesh(); - aiFace* faces = mesh->mFaces = new aiFace[mesh->mNumFaces=face_table.size()]; + aiFace* faces = mesh->mFaces = new aiFace[mesh->mNumFaces=static_cast(face_table.size())]; vertices.clear(); vertices.reserve(4 * face_table.size()); // arbitrarily chosen @@ -278,7 +278,7 @@ void NDOImporter::InternReadFile( const std::string& pFile, next_edge = obj.edges[cur_edge].edge[4]; next_vert = obj.edges[cur_edge].edge[0]; } - indices.push_back( vertices.size() ); + indices.push_back( static_cast(vertices.size()) ); vertices.push_back(obj.vertices[ next_vert ].val); cur_edge = next_edge; @@ -287,11 +287,11 @@ void NDOImporter::InternReadFile( const std::string& pFile, } } - f.mIndices = new unsigned int[f.mNumIndices = indices.size()]; + f.mIndices = new unsigned int[f.mNumIndices = static_cast(indices.size())]; std::copy(indices.begin(),indices.end(),f.mIndices); } - mesh->mVertices = new aiVector3D[mesh->mNumVertices = vertices.size()]; + mesh->mVertices = new aiVector3D[mesh->mNumVertices = static_cast(vertices.size())]; std::copy(vertices.begin(),vertices.end(),mesh->mVertices); if (mesh->mNumVertices) { From 12aab0f4ef911d8ffb995d5c5ff9fc351711d2a4 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 12:29:01 +1100 Subject: [PATCH 29/52] Fixed build warnings on MSVC14 x64 in the O3DGC sources. --- contrib/Open3DGC/o3dgcCommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/Open3DGC/o3dgcCommon.h b/contrib/Open3DGC/o3dgcCommon.h index 13af4153d..ff6bf7558 100644 --- a/contrib/Open3DGC/o3dgcCommon.h +++ b/contrib/Open3DGC/o3dgcCommon.h @@ -383,7 +383,7 @@ namespace o3dgc r = (maxTab[d] - minTab[d]); diag += r*r; } - diag = sqrt(diag); + diag = static_cast(sqrt(diag)); for(unsigned long d = 0; d < dim; ++d) { maxTab[d] = minTab[d] + diag; From 0c1332208998b965eba651c655fe24a59761f037 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 12:29:26 +1100 Subject: [PATCH 30/52] Fixed build warnings on MSVC14 x64 in the Obj format sources. --- code/ObjFileImporter.cpp | 6 ++--- code/ObjFileMtlImporter.cpp | 50 ++++++++++++++++++------------------- code/ObjFileParser.cpp | 12 ++++----- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index 97ae29996..d93d9c97e 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -152,7 +152,7 @@ void ObjFileImporter::InternReadFile( const std::string &file, aiScene* pScene, unsigned int progress = 0; unsigned int progressCounter = 0; const unsigned int updateProgressEveryBytes = 100 * 1024; - const unsigned int progressTotal = (3*m_Buffer.size()/updateProgressEveryBytes); + const unsigned int progressTotal = static_cast(3*m_Buffer.size()/updateProgressEveryBytes); // process all '\' /*std::vector ::iterator iter = m_Buffer.begin(); while (iter != m_Buffer.end()) @@ -326,10 +326,10 @@ aiMesh *ObjFileImporter::createTopology( const ObjFile::Model* pModel, const Obj ai_assert( NULL != inp ); if (inp->m_PrimitiveType == aiPrimitiveType_LINE) { - pMesh->mNumFaces += inp->m_vertices.size() - 1; + pMesh->mNumFaces += static_cast(inp->m_vertices.size() - 1); pMesh->mPrimitiveTypes |= aiPrimitiveType_LINE; } else if (inp->m_PrimitiveType == aiPrimitiveType_POINT) { - pMesh->mNumFaces += inp->m_vertices.size(); + pMesh->mNumFaces += static_cast(inp->m_vertices.size()); pMesh->mPrimitiveTypes |= aiPrimitiveType_POINT; } else { ++pMesh->mNumFaces; diff --git a/code/ObjFileMtlImporter.cpp b/code/ObjFileMtlImporter.cpp index 0228ef224..f6dc739ab 100644 --- a/code/ObjFileMtlImporter.cpp +++ b/code/ObjFileMtlImporter.cpp @@ -307,49 +307,49 @@ void ObjFileMtlImporter::getTexture() { int clampIndex = -1; const char *pPtr( &(*m_DataIt) ); - if ( !ASSIMP_strincmp( pPtr, DiffuseTexture.c_str(), DiffuseTexture.size() ) ) { + if ( !ASSIMP_strincmp( pPtr, DiffuseTexture.c_str(), static_cast(DiffuseTexture.size()) ) ) { // Diffuse texture out = & m_pModel->m_pCurrentMaterial->texture; clampIndex = ObjFile::Material::TextureDiffuseType; - } else if ( !ASSIMP_strincmp( pPtr,AmbientTexture.c_str(),AmbientTexture.size() ) ) { + } else if ( !ASSIMP_strincmp( pPtr,AmbientTexture.c_str(), static_cast(AmbientTexture.size()) ) ) { // Ambient texture out = & m_pModel->m_pCurrentMaterial->textureAmbient; clampIndex = ObjFile::Material::TextureAmbientType; - } else if (!ASSIMP_strincmp( pPtr, SpecularTexture.c_str(), SpecularTexture.size())) { + } else if (!ASSIMP_strincmp( pPtr, SpecularTexture.c_str(), static_cast(SpecularTexture.size()) ) ) { // Specular texture out = & m_pModel->m_pCurrentMaterial->textureSpecular; clampIndex = ObjFile::Material::TextureSpecularType; - } else if ( !ASSIMP_strincmp( pPtr, OpacityTexture.c_str(), OpacityTexture.size() ) ) { + } else if ( !ASSIMP_strincmp( pPtr, OpacityTexture.c_str(), static_cast(OpacityTexture.size()) ) ) { // Opacity texture out = & m_pModel->m_pCurrentMaterial->textureOpacity; clampIndex = ObjFile::Material::TextureOpacityType; - } else if (!ASSIMP_strincmp( pPtr, EmmissiveTexture.c_str(), EmmissiveTexture.size())) { + } else if (!ASSIMP_strincmp( pPtr, EmmissiveTexture.c_str(), static_cast(EmmissiveTexture.size()) ) ) { // Emissive texture out = & m_pModel->m_pCurrentMaterial->textureEmissive; clampIndex = ObjFile::Material::TextureEmissiveType; - } else if ( !ASSIMP_strincmp( pPtr, EmmissiveTexture_1.c_str(), EmmissiveTexture_1.size() ) ) { + } else if ( !ASSIMP_strincmp( pPtr, EmmissiveTexture_1.c_str(), static_cast(EmmissiveTexture_1.size()) ) ) { // Emissive texture out = &m_pModel->m_pCurrentMaterial->textureEmissive; clampIndex = ObjFile::Material::TextureEmissiveType; - } else if ( !ASSIMP_strincmp( pPtr, BumpTexture1.c_str(), BumpTexture1.size() ) || - !ASSIMP_strincmp( pPtr, BumpTexture2.c_str(), BumpTexture2.size() ) || - !ASSIMP_strincmp( pPtr, BumpTexture3.c_str(), BumpTexture3.size() ) ) { + } else if ( !ASSIMP_strincmp( pPtr, BumpTexture1.c_str(), static_cast(BumpTexture1.size()) ) || + !ASSIMP_strincmp( pPtr, BumpTexture2.c_str(), static_cast(BumpTexture2.size()) ) || + !ASSIMP_strincmp( pPtr, BumpTexture3.c_str(), static_cast(BumpTexture3.size()) ) ) { // Bump texture out = & m_pModel->m_pCurrentMaterial->textureBump; clampIndex = ObjFile::Material::TextureBumpType; - } else if (!ASSIMP_strincmp( pPtr,NormalTexture.c_str(), NormalTexture.size())) { + } else if (!ASSIMP_strincmp( pPtr,NormalTexture.c_str(), static_cast(NormalTexture.size()) ) ) { // Normal map out = & m_pModel->m_pCurrentMaterial->textureNormal; clampIndex = ObjFile::Material::TextureNormalType; - } else if(!ASSIMP_strincmp( pPtr, ReflectionTexture.c_str(), ReflectionTexture.size() ) ) { + } else if(!ASSIMP_strincmp( pPtr, ReflectionTexture.c_str(), static_cast(ReflectionTexture.size()) ) ) { // Reflection texture(s) //Do nothing here return; - } else if (!ASSIMP_strincmp( pPtr, DisplacementTexture.c_str(), DisplacementTexture.size() ) ) { + } else if (!ASSIMP_strincmp( pPtr, DisplacementTexture.c_str(), static_cast(DisplacementTexture.size()) ) ) { // Displacement texture out = &m_pModel->m_pCurrentMaterial->textureDisp; clampIndex = ObjFile::Material::TextureDispType; - } else if (!ASSIMP_strincmp( pPtr, SpecularityTexture.c_str(),SpecularityTexture.size() ) ) { + } else if (!ASSIMP_strincmp( pPtr, SpecularityTexture.c_str(), static_cast(SpecularityTexture.size()) ) ) { // Specularity scaling (glossiness) out = & m_pModel->m_pCurrentMaterial->textureSpecularity; clampIndex = ObjFile::Material::TextureSpecularityType; @@ -394,7 +394,7 @@ void ObjFileMtlImporter::getTextureOption(bool &clamp, int &clampIndex, aiString //skip option key and value int skipToken = 1; - if (!ASSIMP_strincmp(pPtr, ClampOption.c_str(), ClampOption.size())) + if (!ASSIMP_strincmp(pPtr, ClampOption.c_str(), static_cast(ClampOption.size()))) { DataArrayIt it = getNextToken(m_DataIt, m_DataItEnd); char value[3]; @@ -406,7 +406,7 @@ void ObjFileMtlImporter::getTextureOption(bool &clamp, int &clampIndex, aiString skipToken = 2; } - else if( !ASSIMP_strincmp( pPtr, TypeOption.c_str(), TypeOption.size() ) ) + else if( !ASSIMP_strincmp( pPtr, TypeOption.c_str(), static_cast(TypeOption.size()) ) ) { DataArrayIt it = getNextToken( m_DataIt, m_DataItEnd ); char value[ 12 ]; @@ -449,22 +449,22 @@ void ObjFileMtlImporter::getTextureOption(bool &clamp, int &clampIndex, aiString skipToken = 2; } - else if (!ASSIMP_strincmp(pPtr, BlendUOption.c_str(), BlendUOption.size()) - || !ASSIMP_strincmp(pPtr, BlendVOption.c_str(), BlendVOption.size()) - || !ASSIMP_strincmp(pPtr, BoostOption.c_str(), BoostOption.size()) - || !ASSIMP_strincmp(pPtr, ResolutionOption.c_str(), ResolutionOption.size()) - || !ASSIMP_strincmp(pPtr, BumpOption.c_str(), BumpOption.size()) - || !ASSIMP_strincmp(pPtr, ChannelOption.c_str(), ChannelOption.size())) + else if (!ASSIMP_strincmp(pPtr, BlendUOption.c_str(), static_cast(BlendUOption.size())) + || !ASSIMP_strincmp(pPtr, BlendVOption.c_str(), static_cast(BlendVOption.size())) + || !ASSIMP_strincmp(pPtr, BoostOption.c_str(), static_cast(BoostOption.size())) + || !ASSIMP_strincmp(pPtr, ResolutionOption.c_str(), static_cast(ResolutionOption.size())) + || !ASSIMP_strincmp(pPtr, BumpOption.c_str(), static_cast(BumpOption.size())) + || !ASSIMP_strincmp(pPtr, ChannelOption.c_str(), static_cast(ChannelOption.size()))) { skipToken = 2; } - else if (!ASSIMP_strincmp(pPtr, ModifyMapOption.c_str(), ModifyMapOption.size())) + else if (!ASSIMP_strincmp(pPtr, ModifyMapOption.c_str(), static_cast(ModifyMapOption.size()))) { skipToken = 3; } - else if ( !ASSIMP_strincmp(pPtr, OffsetOption.c_str(), OffsetOption.size()) - || !ASSIMP_strincmp(pPtr, ScaleOption.c_str(), ScaleOption.size()) - || !ASSIMP_strincmp(pPtr, TurbulenceOption.c_str(), TurbulenceOption.size()) + else if ( !ASSIMP_strincmp(pPtr, OffsetOption.c_str(), static_cast(OffsetOption.size())) + || !ASSIMP_strincmp(pPtr, ScaleOption.c_str(), static_cast(ScaleOption.size())) + || !ASSIMP_strincmp(pPtr, TurbulenceOption.c_str(), static_cast(TurbulenceOption.size())) ) { skipToken = 4; diff --git a/code/ObjFileParser.cpp b/code/ObjFileParser.cpp index 27e4b27c4..251d71627 100644 --- a/code/ObjFileParser.cpp +++ b/code/ObjFileParser.cpp @@ -104,7 +104,7 @@ void ObjFileParser::parseFile( IOStreamBuffer &streamBuffer ) { // only update every 100KB or it'll be too slow const unsigned int updateProgressEveryBytes = 100 * 1024; unsigned int progressCounter = 0; - const unsigned int bytesToProcess = streamBuffer.size(); + const unsigned int bytesToProcess = static_cast(streamBuffer.size()); const unsigned int progressTotal = 3 * bytesToProcess; const unsigned int progressOffset = bytesToProcess; unsigned int processed = 0; @@ -118,7 +118,7 @@ void ObjFileParser::parseFile( IOStreamBuffer &streamBuffer ) { // Handle progress reporting const size_t filePos( streamBuffer.getFilePos() ); if ( lastFilePos < filePos ) { - processed += filePos; + processed += static_cast(filePos); lastFilePos = filePos; progressCounter++; m_progress->UpdateFileRead( progressOffset + processed * 2, progressTotal ); @@ -377,9 +377,9 @@ void ObjFileParser::getFace( aiPrimitiveType type ) { ObjFile::Face *face = new ObjFile::Face( type ); bool hasNormal = false; - const int vSize = m_pModel->m_Vertices.size(); - const int vtSize = m_pModel->m_TextureCoord.size(); - const int vnSize = m_pModel->m_Normals.size(); + const int vSize = static_cast(m_pModel->m_Vertices.size()); + const int vtSize = static_cast(m_pModel->m_TextureCoord.size()); + const int vnSize = static_cast(m_pModel->m_Normals.size()); const bool vt = (!m_pModel->m_TextureCoord.empty()); const bool vn = (!m_pModel->m_Normals.empty()); @@ -771,7 +771,7 @@ void ObjFileParser::createMesh( const std::string &meshName ) ai_assert( NULL != m_pModel ); m_pModel->m_pCurrentMesh = new ObjFile::Mesh( meshName ); m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh ); - unsigned int meshId = m_pModel->m_Meshes.size()-1; + unsigned int meshId = static_cast(m_pModel->m_Meshes.size()-1); if ( NULL != m_pModel->m_pCurrent ) { m_pModel->m_pCurrent->m_Meshes.push_back( meshId ); From 4a63f1759c7f9e520920ea3bcc130f8cdd17a5d6 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 12:49:33 +1100 Subject: [PATCH 31/52] Fixed build warnings on MSVC14 x64 in the Ogre format sources. --- code/OgreBinarySerializer.cpp | 2 +- code/OgreMaterial.cpp | 6 ++-- code/OgreStructs.cpp | 54 +++++++++++++++++------------------ code/OgreXmlSerializer.cpp | 2 +- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/code/OgreBinarySerializer.cpp b/code/OgreBinarySerializer.cpp index ce17cea6a..7b45cf50f 100644 --- a/code/OgreBinarySerializer.cpp +++ b/code/OgreBinarySerializer.cpp @@ -483,7 +483,7 @@ void OgreBinarySerializer::ReadSubMesh(Mesh *mesh) NormalizeBoneWeights(submesh->vertexData); - submesh->index = mesh->subMeshes.size(); + submesh->index = static_cast(mesh->subMeshes.size()); mesh->subMeshes.push_back(submesh); } diff --git a/code/OgreMaterial.cpp b/code/OgreMaterial.cpp index a221ab274..bdcd0285a 100644 --- a/code/OgreMaterial.cpp +++ b/code/OgreMaterial.cpp @@ -77,7 +77,7 @@ void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIO aiMaterial *material = ReadMaterial(pFile, pIOHandler, submesh->materialRef); if (material) { - submesh->materialIndex = materials.size(); + submesh->materialIndex = static_cast(materials.size()); materials.push_back(material); } } @@ -99,7 +99,7 @@ void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIO aiMaterial *material = ReadMaterial(pFile, pIOHandler, submesh->materialRef); if (material) { - submesh->materialIndex = materials.size(); + submesh->materialIndex = static_cast(materials.size()); materials.push_back(material); } } @@ -110,7 +110,7 @@ void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIO void OgreImporter::AssignMaterials(aiScene *pScene, std::vector &materials) { - pScene->mNumMaterials = materials.size(); + pScene->mNumMaterials = static_cast(materials.size()); if (pScene->mNumMaterials > 0) { pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials]; diff --git a/code/OgreStructs.cpp b/code/OgreStructs.cpp index e2e8c8103..d9cd547d6 100644 --- a/code/OgreStructs.cpp +++ b/code/OgreStructs.cpp @@ -274,12 +274,12 @@ AssimpVertexBoneWeightList IVertexData::AssimpBoneWeights(size_t vertices) AssimpVertexBoneWeightList weights; for(size_t vi=0; vi(vi)]; for (VertexBoneAssignmentList::const_iterator iter=vertexWeights.begin(), end=vertexWeights.end(); iter!=end; ++iter) { std::vector &boneWeights = weights[iter->boneIndex]; - boneWeights.push_back(aiVertexWeight(vi, iter->weight)); + boneWeights.push_back(aiVertexWeight(static_cast(vi), iter->weight)); } } return weights; @@ -319,7 +319,7 @@ uint32_t VertexData::VertexSize(uint16_t source) const for(const auto &element : vertexElements) { if (element.source == source) - size += element.Size(); + size += static_cast(element.Size()); } return size; } @@ -460,7 +460,7 @@ void Mesh::ConvertToAssimpScene(aiScene* dest) } // Setup - dest->mNumMeshes = NumSubMeshes(); + dest->mNumMeshes = static_cast(NumSubMeshes()); dest->mMeshes = new aiMesh*[dest->mNumMeshes]; // Create root node @@ -471,7 +471,7 @@ void Mesh::ConvertToAssimpScene(aiScene* dest) // Export meshes for(size_t i=0; imNumMeshes; ++i) { dest->mMeshes[i] = subMeshes[i]->ConvertToAssimpMesh(this); - dest->mRootNode->mMeshes[i] = i; + dest->mRootNode->mMeshes[i] = static_cast(i); } // Export skeleton @@ -481,7 +481,7 @@ void Mesh::ConvertToAssimpScene(aiScene* dest) if (!skeleton->bones.empty()) { BoneList rootBones = skeleton->RootBones(); - dest->mRootNode->mNumChildren = rootBones.size(); + dest->mRootNode->mNumChildren = static_cast(rootBones.size()); dest->mRootNode->mChildren = new aiNode*[dest->mRootNode->mNumChildren]; for(size_t i=0, len=rootBones.size(); ianimations.empty()) { - dest->mNumAnimations = skeleton->animations.size(); + dest->mNumAnimations = static_cast(skeleton->animations.size()); dest->mAnimations = new aiAnimation*[dest->mNumAnimations]; for(size_t i=0, len=skeleton->animations.size(); imNumFaces * 3; - dest->mNumVertices = uniqueVertexCount; + dest->mNumVertices = static_cast(uniqueVertexCount); dest->mVertices = new aiVector3D[dest->mNumVertices]; // Source streams @@ -604,7 +604,7 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent) { if (uv1Element->type == VertexElement::VET_FLOAT2 || uv1Element->type == VertexElement::VET_FLOAT3) { - dest->mNumUVComponents[0] = uv1Element->ComponentCount(); + dest->mNumUVComponents[0] = static_cast(uv1Element->ComponentCount()); dest->mTextureCoords[0] = new aiVector3D[dest->mNumVertices]; } else @@ -617,7 +617,7 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent) { if (uv2Element->type == VertexElement::VET_FLOAT2 || uv2Element->type == VertexElement::VET_FLOAT3) { - dest->mNumUVComponents[1] = uv2Element->ComponentCount(); + dest->mNumUVComponents[1] = static_cast(uv2Element->ComponentCount()); dest->mTextureCoords[1] = new aiVector3D[dest->mNumVertices]; } else @@ -665,11 +665,11 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent) const size_t newIndex = pos + v; // Write face index - face.mIndices[v] = newIndex; + face.mIndices[v] = static_cast(newIndex); // Ogres vertex index to ref into the source buffers. const size_t ogreVertexIndex = ogreFace.mIndices[v]; - src->AddVertexMapping(ogreVertexIndex, newIndex); + src->AddVertexMapping(static_cast(ogreVertexIndex), static_cast(newIndex)); // Position positions->Seek((vWidthPosition * ogreVertexIndex) + positionsElement->offset, aiOrigin_SET); @@ -704,7 +704,7 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent) AssimpVertexBoneWeightList weights = src->AssimpBoneWeights(dest->mNumVertices); std::set referencedBones = src->ReferencedBonesByWeights(); - dest->mNumBones = referencedBones.size(); + dest->mNumBones = static_cast(referencedBones.size()); dest->mBones = new aiBone*[dest->mNumBones]; size_t assimpBoneIndex = 0; @@ -758,7 +758,7 @@ SubMeshXml *MeshXml::GetSubMesh(uint16_t index) const void MeshXml::ConvertToAssimpScene(aiScene* dest) { // Setup - dest->mNumMeshes = NumSubMeshes(); + dest->mNumMeshes = static_cast(NumSubMeshes()); dest->mMeshes = new aiMesh*[dest->mNumMeshes]; // Create root node @@ -770,7 +770,7 @@ void MeshXml::ConvertToAssimpScene(aiScene* dest) for(size_t i=0; imNumMeshes; ++i) { dest->mMeshes[i] = subMeshes[i]->ConvertToAssimpMesh(this); - dest->mRootNode->mMeshes[i] = i; + dest->mRootNode->mMeshes[i] = static_cast(i); } // Export skeleton @@ -780,7 +780,7 @@ void MeshXml::ConvertToAssimpScene(aiScene* dest) if (!skeleton->bones.empty()) { BoneList rootBones = skeleton->RootBones(); - dest->mRootNode->mNumChildren = rootBones.size(); + dest->mRootNode->mNumChildren = static_cast(rootBones.size()); dest->mRootNode->mChildren = new aiNode*[dest->mRootNode->mNumChildren]; for(size_t i=0, len=rootBones.size(); ianimations.empty()) { - dest->mNumAnimations = skeleton->animations.size(); + dest->mNumAnimations = static_cast(skeleton->animations.size()); dest->mAnimations = new aiAnimation*[dest->mNumAnimations]; for(size_t i=0, len=skeleton->animations.size(); imNumFaces * 3; - dest->mNumVertices = uniqueVertexCount; + dest->mNumVertices = static_cast(uniqueVertexCount); dest->mVertices = new aiVector3D[dest->mNumVertices]; VertexDataXml *src = (!usesSharedVertexData ? vertexData : parent->sharedVertexData); @@ -875,11 +875,11 @@ aiMesh *SubMeshXml::ConvertToAssimpMesh(MeshXml *parent) const size_t newIndex = pos + v; // Write face index - face.mIndices[v] = newIndex; + face.mIndices[v] = static_cast(newIndex); // Ogres vertex index to ref into the source buffers. const size_t ogreVertexIndex = ogreFace.mIndices[v]; - src->AddVertexMapping(ogreVertexIndex, newIndex); + src->AddVertexMapping(static_cast(ogreVertexIndex), static_cast(newIndex)); // Position dest->mVertices[newIndex] = src->positions[ogreVertexIndex]; @@ -904,7 +904,7 @@ aiMesh *SubMeshXml::ConvertToAssimpMesh(MeshXml *parent) AssimpVertexBoneWeightList weights = src->AssimpBoneWeights(dest->mNumVertices); std::set referencedBones = src->ReferencedBonesByWeights(); - dest->mNumBones = referencedBones.size(); + dest->mNumBones = static_cast(referencedBones.size()); dest->mBones = new aiBone*[dest->mNumBones]; size_t assimpBoneIndex = 0; @@ -958,7 +958,7 @@ aiAnimation *Animation::ConvertToAssimpAnimation() // Tracks if (!tracks.empty()) { - anim->mNumChannels = tracks.size(); + anim->mNumChannels = static_cast(tracks.size()); anim->mChannels = new aiNodeAnim*[anim->mNumChannels]; for(size_t i=0, len=tracks.size(); imNumChildren = children.size(); + node->mNumChildren = static_cast(children.size()); node->mChildren = new aiNode*[node->mNumChildren]; for(size_t i=0, len=children.size(); imNumWeights = boneWeights.size(); + bone->mNumWeights = static_cast(boneWeights.size()); bone->mWeights = new aiVertexWeight[boneWeights.size()]; memcpy(bone->mWeights, &boneWeights[0], boneWeights.size() * sizeof(aiVertexWeight)); } @@ -1158,9 +1158,9 @@ aiNodeAnim *VertexAnimationTrack::ConvertToAssimpAnimationNode(Skeleton *skeleto nodeAnim->mPositionKeys = new aiVectorKey[numKeyframes]; nodeAnim->mRotationKeys = new aiQuatKey[numKeyframes]; nodeAnim->mScalingKeys = new aiVectorKey[numKeyframes]; - nodeAnim->mNumPositionKeys = numKeyframes; - nodeAnim->mNumRotationKeys = numKeyframes; - nodeAnim->mNumScalingKeys = numKeyframes; + nodeAnim->mNumPositionKeys = static_cast(numKeyframes); + nodeAnim->mNumRotationKeys = static_cast(numKeyframes); + nodeAnim->mNumScalingKeys = static_cast(numKeyframes); for(size_t kfi=0; kfiindex = mesh->subMeshes.size(); + submesh->index = static_cast(mesh->subMeshes.size()); mesh->subMeshes.push_back(submesh); } From 48e542d8d4347b3b1d01d3cc54a5c7a9a195de33 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 13:02:26 +1100 Subject: [PATCH 32/52] Fixed build warnings on MSVC14 x64 in the OpenGEX format sources. --- code/OpenGEXImporter.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index 1a4d511c4..a605e0f41 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -518,7 +518,7 @@ void OpenGEXImporter::handleObjectRefNode( DDLNode *node, aiScene *pScene ) { // when we are dealing with a geometry node prepare the mesh cache if ( m_tokenType == Grammar::GeometryNodeToken ) { - m_currentNode->mNumMeshes = objRefNames.size(); + m_currentNode->mNumMeshes = static_cast(objRefNames.size()); m_currentNode->mMeshes = new unsigned int[ objRefNames.size() ]; if ( !objRefNames.empty() ) { m_unresolvedRefStack.push_back( new RefInfo( m_currentNode, RefInfo::MeshRef, objRefNames ) ); @@ -863,9 +863,9 @@ void OpenGEXImporter::handleIndexArrayNode( ODDLParser::DDLNode *node, aiScene * } const size_t numItems( countDataArrayListItems( vaList ) ); - m_currentMesh->mNumFaces = numItems; + m_currentMesh->mNumFaces = static_cast(numItems); m_currentMesh->mFaces = new aiFace[ numItems ]; - m_currentMesh->mNumVertices = numItems * 3; + m_currentMesh->mNumVertices = static_cast(numItems * 3); m_currentMesh->mVertices = new aiVector3D[ m_currentMesh->mNumVertices ]; bool hasColors( false ); if ( m_currentVertices.m_numColors > 0 ) { @@ -1086,7 +1086,7 @@ void OpenGEXImporter::copyMeshes( aiScene *pScene ) { return; } - pScene->mNumMeshes = m_meshCache.size(); + pScene->mNumMeshes = static_cast(m_meshCache.size()); pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes ]; std::copy( m_meshCache.begin(), m_meshCache.end(), pScene->mMeshes ); } @@ -1099,7 +1099,7 @@ void OpenGEXImporter::copyCameras( aiScene *pScene ) { return; } - pScene->mNumCameras = m_cameraCache.size(); + pScene->mNumCameras = static_cast(m_cameraCache.size()); pScene->mCameras = new aiCamera*[ pScene->mNumCameras ]; std::copy( m_cameraCache.begin(), m_cameraCache.end(), pScene->mCameras ); } @@ -1112,7 +1112,7 @@ void OpenGEXImporter::copyLights( aiScene *pScene ) { return; } - pScene->mNumLights = m_lightCache.size(); + pScene->mNumLights = static_cast(m_lightCache.size()); pScene->mLights = new aiLight*[ pScene->mNumLights ]; std::copy( m_lightCache.begin(), m_lightCache.end(), pScene->mLights ); } @@ -1133,7 +1133,7 @@ void OpenGEXImporter::resolveReferences() { const std::string &name( currentRefInfo->m_Names[ i ] ); ReferenceMap::const_iterator it( m_mesh2refMap.find( name ) ); if( m_mesh2refMap.end() != it ) { - unsigned int meshIdx = m_mesh2refMap[ name ]; + unsigned int meshIdx = static_cast(m_mesh2refMap[ name ]); node->mMeshes[ i ] = meshIdx; } } @@ -1156,7 +1156,7 @@ void OpenGEXImporter::createNodeTree( aiScene *pScene ) { return; } - pScene->mRootNode->mNumChildren = m_root->m_children.size(); + pScene->mRootNode->mNumChildren = static_cast(m_root->m_children.size()); pScene->mRootNode->mChildren = new aiNode*[ pScene->mRootNode->mNumChildren ]; std::copy( m_root->m_children.begin(), m_root->m_children.end(), pScene->mRootNode->mChildren ); } From 3e08a47d4f25838dbe8e43a153d100017e7deefb Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 13:04:56 +1100 Subject: [PATCH 33/52] Fixed build warnings on MSVC14 x64 in some scene optimisations. --- code/OptimizeGraph.cpp | 4 ++-- code/OptimizeMeshes.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/OptimizeGraph.cpp b/code/OptimizeGraph.cpp index ec37bd447..4d033ee31 100644 --- a/code/OptimizeGraph.cpp +++ b/code/OptimizeGraph.cpp @@ -230,7 +230,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list& no else nd->mChildren = NULL; } - nd->mNumChildren = child_nodes.size(); + nd->mNumChildren = static_cast(child_nodes.size()); aiNode** tmp = nd->mChildren; for (std::list::iterator it = child_nodes.begin(); it != child_nodes.end(); ++it) { @@ -238,7 +238,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list& no node->mParent = nd; } - nodes_out += child_nodes.size(); + nodes_out += static_cast(child_nodes.size()); } // ------------------------------------------------------------------------------------------------ diff --git a/code/OptimizeMeshes.cpp b/code/OptimizeMeshes.cpp index 8d830bb9b..2bb9c5717 100644 --- a/code/OptimizeMeshes.cpp +++ b/code/OptimizeMeshes.cpp @@ -145,7 +145,7 @@ void OptimizeMeshesProcess::Execute( aiScene* pScene) meshes.resize( 0 ); ai_assert(output.size() <= num_old); - mScene->mNumMeshes = output.size(); + mScene->mNumMeshes = static_cast(output.size()); std::copy(output.begin(),output.end(),mScene->mMeshes); if (output.size() != num_old) { @@ -199,7 +199,7 @@ void OptimizeMeshesProcess::ProcessNode( aiNode* pNode) } else { output.push_back(mScene->mMeshes[im]); } - im = output.size()-1; + im = static_cast(output.size()-1); } } From f81e28f3201289f51fbeb72ef5ea15e64ea33a53 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 13:06:50 +1100 Subject: [PATCH 34/52] Fixed build warnings on MSVC14 x64 in the pre-transform vertices post-process. --- code/PretransformVertices.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/PretransformVertices.cpp b/code/PretransformVertices.cpp index 90a58e321..bcb3913c3 100644 --- a/code/PretransformVertices.cpp +++ b/code/PretransformVertices.cpp @@ -397,7 +397,7 @@ void PretransformVertices::BuildWCSMeshes(std::vector& out, aiMesh** in out.push_back(ntz); - node->mMeshes[i] = numIn + out.size() - 1; + node->mMeshes[i] = static_cast(numIn + out.size() - 1); } } } @@ -483,7 +483,7 @@ void PretransformVertices::Execute( aiScene* pScene) memcpy(npp,pScene->mMeshes,sizeof(aiMesh*)*pScene->mNumMeshes); memcpy(npp+pScene->mNumMeshes,&apcOutMeshes[0],sizeof(aiMesh*)*apcOutMeshes.size()); - pScene->mNumMeshes += apcOutMeshes.size(); + pScene->mNumMeshes += static_cast(apcOutMeshes.size()); delete[] pScene->mMeshes; pScene->mMeshes = npp; } From 98aea657ff0c97aee9c1dccd45899a9b491c36fa Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 13:18:11 +1100 Subject: [PATCH 35/52] Fixed build warnings on MSVC14 x64 in some helpers. --- code/ProcessHelper.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/ProcessHelper.cpp b/code/ProcessHelper.cpp index 4bfbbd5a3..501d44484 100644 --- a/code/ProcessHelper.cpp +++ b/code/ProcessHelper.cpp @@ -308,7 +308,7 @@ aiMesh* MakeSubmesh(const aiMesh *pMesh, const std::vector &subMes for(unsigned int j=0;j(numSubVerts++); } } } @@ -320,8 +320,8 @@ aiMesh* MakeSubmesh(const aiMesh *pMesh, const std::vector &subMes // create all the arrays for this mesh if the old mesh contained them - oMesh->mNumFaces = subMeshFaces.size(); - oMesh->mNumVertices = numSubVerts; + oMesh->mNumFaces = static_cast(subMeshFaces.size()); + oMesh->mNumVertices = static_cast(numSubVerts); oMesh->mVertices = new aiVector3D[numSubVerts]; if( pMesh->HasNormals() ) { oMesh->mNormals = new aiVector3D[numSubVerts]; @@ -332,12 +332,12 @@ aiMesh* MakeSubmesh(const aiMesh *pMesh, const std::vector &subMes oMesh->mBitangents = new aiVector3D[numSubVerts]; } - for( size_t a = 0; pMesh->HasTextureCoords( a) ; ++a ) { + for( size_t a = 0; pMesh->HasTextureCoords(static_cast(a)) ; ++a ) { oMesh->mTextureCoords[a] = new aiVector3D[numSubVerts]; oMesh->mNumUVComponents[a] = pMesh->mNumUVComponents[a]; } - for( size_t a = 0; pMesh->HasVertexColors( a); ++a ) { + for( size_t a = 0; pMesh->HasVertexColors( static_cast(a)); ++a ) { oMesh->mColors[a] = new aiColor4D[numSubVerts]; } From 655a470fc93ebcb41fdba728c8e1f8479c123807 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 13:30:20 +1100 Subject: [PATCH 36/52] Fixed build warnings on MSVC14 x64 in the Quake 3 format sources. --- code/Q3BSPFileImporter.cpp | 16 ++++++++-------- code/Q3BSPZipArchive.cpp | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/code/Q3BSPFileImporter.cpp b/code/Q3BSPFileImporter.cpp index 1433dda9c..198ecdd73 100644 --- a/code/Q3BSPFileImporter.cpp +++ b/code/Q3BSPFileImporter.cpp @@ -330,14 +330,14 @@ void Q3BSPFileImporter::CreateNodes( const Q3BSP::Q3BSPModel *pModel, aiScene* p } } - pParent->mNumChildren = MeshArray.size(); + pParent->mNumChildren = static_cast(MeshArray.size()); pParent->mChildren = new aiNode*[ pScene->mRootNode->mNumChildren ]; for ( size_t i=0; imParent = pParent; pParent->mChildren[ i ] = pNode; - pParent->mChildren[ i ]->mMeshes[ 0 ] = i; + pParent->mChildren[ i ]->mMeshes[ 0 ] = static_cast(i); } } @@ -364,9 +364,9 @@ aiNode *Q3BSPFileImporter::CreateTopology( const Q3BSP::Q3BSPModel *pModel, pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE; pMesh->mFaces = new aiFace[ numTriangles ]; - pMesh->mNumFaces = numTriangles; + pMesh->mNumFaces = static_cast(numTriangles); - pMesh->mNumVertices = numVerts; + pMesh->mNumVertices = static_cast(numVerts); pMesh->mVertices = new aiVector3D[ numVerts ]; pMesh->mNormals = new aiVector3D[ numVerts ]; pMesh->mTextureCoords[ 0 ] = new aiVector3D[ numVerts ]; @@ -515,7 +515,7 @@ void Q3BSPFileImporter::createMaterials( const Q3BSP::Q3BSPModel *pModel, aiScen pScene->mMaterials[ pScene->mNumMaterials ] = pMatHelper; pScene->mNumMaterials++; } - pScene->mNumTextures = mTextures.size(); + pScene->mNumTextures = static_cast(mTextures.size()); pScene->mTextures = new aiTexture*[ pScene->mNumTextures ]; std::copy( mTextures.begin(), mTextures.end(), pScene->mTextures ); } @@ -649,7 +649,7 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pMode size_t texSize = pTextureStream->FileSize(); aiTexture *pTexture = new aiTexture; pTexture->mHeight = 0; - pTexture->mWidth = texSize; + pTexture->mWidth = static_cast(texSize); unsigned char *pData = new unsigned char[ pTexture->mWidth ]; size_t readSize = pTextureStream->Read( pData, sizeof( unsigned char ), pTexture->mWidth ); (void)readSize; @@ -663,7 +663,7 @@ bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pMode aiString name; name.data[ 0 ] = '*'; - name.length = 1 + ASSIMP_itoa10( name.data + 1, MAXLEN-1, mTextures.size() ); + name.length = 1 + ASSIMP_itoa10( name.data + 1, static_cast(MAXLEN-1), static_cast(mTextures.size()) ); pArchive->Close( pTextureStream ); @@ -721,7 +721,7 @@ bool Q3BSPFileImporter::importLightmap( const Q3BSP::Q3BSPModel *pModel, aiScene aiString name; name.data[ 0 ] = '*'; - name.length = 1 + ASSIMP_itoa10( name.data + 1, MAXLEN-1, mTextures.size() ); + name.length = 1 + ASSIMP_itoa10( name.data + 1, static_cast(MAXLEN-1), static_cast(mTextures.size()) ); pMatHelper->AddProperty( &name,AI_MATKEY_TEXTURE_LIGHTMAP( 1 ) ); mTextures.push_back( pTexture ); diff --git a/code/Q3BSPZipArchive.cpp b/code/Q3BSPZipArchive.cpp index 80b3e9c6b..16455c10a 100644 --- a/code/Q3BSPZipArchive.cpp +++ b/code/Q3BSPZipArchive.cpp @@ -73,19 +73,19 @@ voidpf IOSystem2Unzip::open(voidpf opaque, const char* filename, int mode) { uLong IOSystem2Unzip::read(voidpf /*opaque*/, voidpf stream, void* buf, uLong size) { IOStream* io_stream = (IOStream*) stream; - return io_stream->Read(buf, 1, size); + return static_cast(io_stream->Read(buf, 1, size)); } uLong IOSystem2Unzip::write(voidpf /*opaque*/, voidpf stream, const void* buf, uLong size) { IOStream* io_stream = (IOStream*) stream; - return io_stream->Write(buf, 1, size); + return static_cast(io_stream->Write(buf, 1, size)); } long IOSystem2Unzip::tell(voidpf /*opaque*/, voidpf stream) { IOStream* io_stream = (IOStream*) stream; - return io_stream->Tell(); + return static_cast(io_stream->Tell()); } long IOSystem2Unzip::seek(voidpf /*opaque*/, voidpf stream, uLong offset, int origin) { From 439b4861c82f15c4f6180a7b61771a0a160cd98d Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 14:06:56 +1100 Subject: [PATCH 37/52] Fixed build warnings on MSVC14 x64 in the SIB format sources. --- code/SIBImporter.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/code/SIBImporter.cpp b/code/SIBImporter.cpp index 05afb5198..b1e836260 100644 --- a/code/SIBImporter.cpp +++ b/code/SIBImporter.cpp @@ -131,7 +131,7 @@ static SIBEdge& GetEdge(SIBMesh* mesh, uint32_t posA, uint32_t posB) SIBEdge edge; edge.creased = false; edge.faceA = edge.faceB = 0xffffffff; - mesh->edgeMap[pair] = mesh->edges.size(); + mesh->edgeMap[pair] = static_cast(mesh->edges.size()); mesh->edges.push_back(edge); return mesh->edges.back(); } @@ -244,7 +244,7 @@ static void ReadFaces(SIBMesh* mesh, StreamReaderLE* stream) mesh->idx[pos-1] = numPoints; uint32_t *idx = &mesh->idx[pos]; - mesh->faceStart.push_back(pos-1); + mesh->faceStart.push_back(static_cast(pos-1)); mesh->mtls.push_back(0); // Read all the position data. @@ -385,9 +385,9 @@ static void ConnectFaces(SIBMesh* mesh) // This gives potentially undesirable normals when used // with non-2-manifold surfaces, but then so does Silo to begin with. if (edge.faceA == 0xffffffff) - edge.faceA = faceIdx; + edge.faceA = static_cast(faceIdx); else - edge.faceB = faceIdx; + edge.faceB = static_cast(faceIdx); prev = next; } @@ -496,7 +496,7 @@ static void CalculateNormals(SIBMesh* mesh) { uint32_t pos = idx[i*N+POS]; uint32_t nrm = idx[i*N+NRM]; - aiVector3D vtxNorm = CalculateVertexNormal(mesh, faceIdx, pos, faceNormals); + aiVector3D vtxNorm = CalculateVertexNormal(mesh, static_cast(faceIdx), pos, faceNormals); mesh->nrm[nrm] = vtxNorm; } } @@ -586,7 +586,7 @@ static void ReadShape(SIB* sib, StreamReaderLE* stream) for (unsigned pt=0;pt(vtxIdx); // De-index it. We don't need to validate here as // we did it when creating the data. @@ -621,14 +621,14 @@ static void ReadShape(SIB* sib, StreamReaderLE* stream) aiMesh* mesh = new aiMesh; mesh->mName = name; - mesh->mNumFaces = src.faces.size(); + mesh->mNumFaces = static_cast(src.faces.size()); mesh->mFaces = new aiFace[mesh->mNumFaces]; - mesh->mNumVertices = src.vtx.size(); + mesh->mNumVertices = static_cast(src.vtx.size()); mesh->mVertices = new aiVector3D[mesh->mNumVertices]; mesh->mNormals = new aiVector3D[mesh->mNumVertices]; mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices]; mesh->mNumUVComponents[0] = 2; - mesh->mMaterialIndex = n; + mesh->mMaterialIndex = static_cast(n); for (unsigned i=0;imNumVertices;i++) { @@ -862,9 +862,9 @@ void SIBImporter::InternReadFile(const std::string& pFile, sib.insts.clear(); // Transfer to the aiScene. - pScene->mNumMaterials = sib.mtls.size(); - pScene->mNumMeshes = sib.meshes.size(); - pScene->mNumLights = sib.lights.size(); + pScene->mNumMaterials = static_cast(sib.mtls.size()); + pScene->mNumMeshes = static_cast(sib.meshes.size()); + pScene->mNumLights = static_cast(sib.lights.size()); pScene->mMaterials = pScene->mNumMaterials ? new aiMaterial*[pScene->mNumMaterials] : NULL; pScene->mMeshes = pScene->mNumMeshes ? new aiMesh*[pScene->mNumMeshes] : NULL; pScene->mLights = pScene->mNumLights ? new aiLight*[pScene->mNumLights] : NULL; @@ -879,7 +879,7 @@ void SIBImporter::InternReadFile(const std::string& pFile, size_t childIdx = 0; aiNode *root = new aiNode(); root->mName.Set(""); - root->mNumChildren = sib.objs.size() + sib.lights.size(); + root->mNumChildren = static_cast(sib.objs.size() + sib.lights.size()); root->mChildren = root->mNumChildren ? new aiNode*[root->mNumChildren] : NULL; pScene->mRootNode = root; @@ -893,10 +893,10 @@ void SIBImporter::InternReadFile(const std::string& pFile, node->mParent = root; node->mTransformation = obj.axis; - node->mNumMeshes = obj.meshCount; + node->mNumMeshes = static_cast(obj.meshCount); node->mMeshes = node->mNumMeshes ? new unsigned[node->mNumMeshes] : NULL; for (unsigned i=0;imNumMeshes;i++) - node->mMeshes[i] = obj.meshIdx + i; + node->mMeshes[i] = static_cast(obj.meshIdx + i); // Mark instanced objects as being so. if (n >= firstInst) From ff31abf57c884d1cbe45b78f3b0b3189102a48ca Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 14:07:24 +1100 Subject: [PATCH 38/52] Fixed build warnings on MSVC14 x64 in the scene combiner. --- code/SceneCombiner.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/SceneCombiner.cpp b/code/SceneCombiner.cpp index e19741a9d..02c0719eb 100644 --- a/code/SceneCombiner.cpp +++ b/code/SceneCombiner.cpp @@ -90,7 +90,7 @@ void SceneCombiner::AddNodeHashes(aiNode* node, std::set& hashes) // Add node name to hashing set if it is non-empty - empty nodes are allowed // and they can't have any anims assigned so its absolutely safe to duplicate them. if (node->mName.length) { - hashes.insert( SuperFastHash(node->mName.data,node->mName.length) ); + hashes.insert( SuperFastHash(node->mName.data, static_cast(node->mName.length)) ); } // Process all children recursively @@ -114,7 +114,7 @@ void SceneCombiner::AddNodePrefixes(aiNode* node, const char* prefix, unsigned i // Search for matching names bool SceneCombiner::FindNameMatch(const aiString& name, std::vector& input, unsigned int cur) { - const unsigned int hash = SuperFastHash(name.data, name.length); + const unsigned int hash = SuperFastHash(name.data, static_cast(name.length)); // Check whether we find a positive match in one of the given sets for (unsigned int i = 0; i < input.size(); ++i) { @@ -132,7 +132,7 @@ void SceneCombiner::AddNodePrefixesChecked(aiNode* node, const char* prefix, uns std::vector& input, unsigned int cur) { ai_assert(NULL != prefix); - const unsigned int hash = SuperFastHash(node->mName.data,node->mName.length); + const unsigned int hash = SuperFastHash(node->mName.data, static_cast(node->mName.length)); // Check whether we find a positive match in one of the given sets for (unsigned int i = 0; i < input.size(); ++i) { @@ -323,7 +323,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master, for (unsigned int a = 0; a < src[i]->mNumAnimations;++a) { aiAnimation* anim = src[i]->mAnimations[a]; - src[i].hashes.insert(SuperFastHash(anim->mName.data,anim->mName.length)); + src[i].hashes.insert(SuperFastHash(anim->mName.data,static_cast(anim->mName.length))); } } } @@ -485,7 +485,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master, aiAnimation** ppAnims = dest->mAnimations = (dest->mNumAnimations ? new aiAnimation*[dest->mNumAnimations] : NULL); - for ( int n = src.size()-1; n >= 0 ;--n ) /* !!! important !!! */ + for ( int n = static_cast(src.size()-1); n >= 0 ;--n ) /* !!! important !!! */ { SceneHelper* cur = &src[n]; aiNode* node; From 1541db01ccc9b8bc967fc44042886ca81dcbfad8 Mon Sep 17 00:00:00 2001 From: John Senneker Date: Fri, 25 Nov 2016 10:56:11 -0500 Subject: [PATCH 39/52] Remove scaling of specular exponent in OBJFileImporter.cpp --- code/ObjFileImporter.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index f0746085b..ad3cbf0ea 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -600,9 +600,6 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc mat->AddProperty( &sm, 1, AI_MATKEY_SHADING_MODEL); - // multiplying the specular exponent with 2 seems to yield better results - pCurrentMaterial->shineness *= 4.f; - // Adding material colors mat->AddProperty( &pCurrentMaterial->ambient, 1, AI_MATKEY_COLOR_AMBIENT ); mat->AddProperty( &pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE ); From 578ed3f5d0daebc9cf30e683a6a2ccce92ad74dd Mon Sep 17 00:00:00 2001 From: John Senneker Date: Fri, 25 Nov 2016 12:09:49 -0500 Subject: [PATCH 40/52] Properly export COLLADA value --- code/ColladaExporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index fdb31903f..ee29e93ec 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -691,7 +691,7 @@ void ColladaExporter::WriteMaterials() materials[a].shininess.exist = mat->Get( AI_MATKEY_SHININESS, materials[a].shininess.value) == aiReturn_SUCCESS; materials[a].transparency.exist = mat->Get( AI_MATKEY_OPACITY, materials[a].transparency.value) == aiReturn_SUCCESS; - materials[a].transparency.value = 1 - materials[a].transparency.value; + materials[a].transparency.value = materials[a].transparency.value; materials[a].index_refraction.exist = mat->Get( AI_MATKEY_REFRACTI, materials[a].index_refraction.value) == aiReturn_SUCCESS; } From 20318811ff526f3eff7602b2ad9ec5301163704a Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 13:17:02 +1100 Subject: [PATCH 41/52] Fixed build warnings on MSVC14 x64 in the skeleton mesh builder. --- code/SkeletonMeshBuilder.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/SkeletonMeshBuilder.cpp b/code/SkeletonMeshBuilder.cpp index d929ac361..c01b575da 100644 --- a/code/SkeletonMeshBuilder.cpp +++ b/code/SkeletonMeshBuilder.cpp @@ -85,7 +85,7 @@ SkeletonMeshBuilder::SkeletonMeshBuilder( aiScene* pScene, aiNode* root, bool bK void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode) { // add a joint entry for the node. - const unsigned int vertexStartIndex = mVertices.size(); + const unsigned int vertexStartIndex = static_cast(mVertices.size()); // now build the geometry. if( pNode->mNumChildren > 0 && !mKnobsOnly) @@ -108,7 +108,7 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode) aiVector3D front = (up ^ orth).Normalize(); aiVector3D side = (front ^ up).Normalize(); - unsigned int localVertexStart = mVertices.size(); + unsigned int localVertexStart = static_cast(mVertices.size()); mVertices.push_back( -front * distanceToChild * (ai_real)0.1); mVertices.push_back( childpos); mVertices.push_back( -side * distanceToChild * (ai_real)0.1); @@ -170,7 +170,7 @@ void SkeletonMeshBuilder::CreateGeometry( const aiNode* pNode) mFaces.push_back( Face( vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23)); } - unsigned int numVertices = mVertices.size() - vertexStartIndex; + unsigned int numVertices = static_cast(mVertices.size() - vertexStartIndex); if( numVertices > 0) { // create a bone affecting all the newly created vertices @@ -208,14 +208,14 @@ aiMesh* SkeletonMeshBuilder::CreateMesh() aiMesh* mesh = new aiMesh(); // add points - mesh->mNumVertices = mVertices.size(); + mesh->mNumVertices = static_cast(mVertices.size()); mesh->mVertices = new aiVector3D[mesh->mNumVertices]; std::copy( mVertices.begin(), mVertices.end(), mesh->mVertices); mesh->mNormals = new aiVector3D[mesh->mNumVertices]; // add faces - mesh->mNumFaces = mFaces.size(); + mesh->mNumFaces = static_cast(mFaces.size()); mesh->mFaces = new aiFace[mesh->mNumFaces]; for( unsigned int a = 0; a < mesh->mNumFaces; a++) { @@ -240,7 +240,7 @@ aiMesh* SkeletonMeshBuilder::CreateMesh() } // add the bones - mesh->mNumBones = mBones.size(); + mesh->mNumBones = static_cast(mBones.size()); mesh->mBones = new aiBone*[mesh->mNumBones]; std::copy( mBones.begin(), mBones.end(), mesh->mBones); From f2e2aad647d8b2e698b558ac08e9c0440816cda0 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 13:28:40 +1100 Subject: [PATCH 42/52] Fixed build warnings on MSVC14 x64 in spacial sort. --- code/SpatialSort.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/SpatialSort.cpp b/code/SpatialSort.cpp index 722ec5f24..e7d64fec5 100644 --- a/code/SpatialSort.cpp +++ b/code/SpatialSort.cpp @@ -108,7 +108,7 @@ void SpatialSort::Append( const aiVector3D* pPositions, unsigned int pNumPositio // store position by index and distance ai_real distance = *vec * mPlaneNormal; - mPositions.push_back( Entry( a+initial, *vec, distance)); + mPositions.push_back( Entry( static_cast(a+initial), *vec, distance)); } if (pFinalize) { From 58e0d8c261da2c4401932cd2a724cb0efcb94198 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 13:32:44 +1100 Subject: [PATCH 43/52] Fixed build warnings on MSVC14 x64 in the STL format sources. --- code/STLLoader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index 0571e542b..7d3e3224c 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -245,7 +245,7 @@ void STLImporter::LoadASCIIFile() positionBuffer.reserve(sizeEstimate); normalBuffer.reserve(sizeEstimate); - while (IsAsciiSTL(sz, bufferEnd - sz)) + while (IsAsciiSTL(sz, static_cast(bufferEnd - sz))) { aiMesh* pMesh = new aiMesh(); pMesh->mMaterialIndex = 0; @@ -367,8 +367,8 @@ void STLImporter::LoadASCIIFile() pMesh->mNumFaces = 0; throw DeadlyImportError("Normal buffer size does not match position buffer size"); } - pMesh->mNumFaces = positionBuffer.size() / 3; - pMesh->mNumVertices = positionBuffer.size(); + pMesh->mNumFaces = static_cast(positionBuffer.size() / 3); + pMesh->mNumVertices = static_cast(positionBuffer.size()); pMesh->mVertices = new aiVector3D[pMesh->mNumVertices]; memcpy(pMesh->mVertices, &positionBuffer[0].x, pMesh->mNumVertices * sizeof(aiVector3D)); positionBuffer.clear(); From 387afcf74f1dcd0d7d5a572d529b9e4089b6afb0 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 13:37:32 +1100 Subject: [PATCH 44/52] Fixed build warnings on MSVC14 x64 in subdivision routine. --- code/Subdivision.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Subdivision.cpp b/code/Subdivision.cpp index 0a67ad520..eafb3ebd1 100644 --- a/code/Subdivision.cpp +++ b/code/Subdivision.cpp @@ -188,7 +188,7 @@ void CatmullClarkSubdivider::Subdivide ( } outmeshes.push_back(NULL);inmeshes.push_back(i); - maptbl.push_back(s); + maptbl.push_back(static_cast(s)); } // Do the actual subdivision on the preallocated storage. InternSubdivide From 2d563180ac4c06defbaf37d914a5c3cf748ad971 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 13:39:09 +1100 Subject: [PATCH 45/52] Fixed build warnings on MSVC14 x64 in sweep context sources. --- contrib/poly2tri/poly2tri/sweep/sweep_context.cc | 2 +- contrib/poly2tri/poly2tri/sweep/sweep_context.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc index 235e1eb05..184457cf2 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc @@ -96,7 +96,7 @@ void SweepContext::InitTriangulation() void SweepContext::InitEdges(std::vector polyline) { - int num_points = polyline.size(); + int num_points = static_cast(polyline.size()); for (int i = 0; i < num_points; i++) { int j = i < num_points - 1 ? i + 1 : 0; edge_list.push_back(new Edge(*polyline[i], *polyline[j])); diff --git a/contrib/poly2tri/poly2tri/sweep/sweep_context.h b/contrib/poly2tri/poly2tri/sweep/sweep_context.h index 1010c0e8a..2f7d8e982 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep_context.h +++ b/contrib/poly2tri/poly2tri/sweep/sweep_context.h @@ -158,7 +158,7 @@ inline AdvancingFront* SweepContext::front() inline int SweepContext::point_count() { - return points_.size(); + return static_cast(points_.size()); } inline void SweepContext::set_head(Point* p1) From 39f54bf183b7395d2b7a86dc51e4e7a40702c4d6 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 14:35:49 +1100 Subject: [PATCH 46/52] Fixed build warnings on MSVC14 x64 in Target Animation source. --- code/TargetAnimation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/TargetAnimation.cpp b/code/TargetAnimation.cpp index 97b15edbb..ecf6f0dcf 100644 --- a/code/TargetAnimation.cpp +++ b/code/TargetAnimation.cpp @@ -100,8 +100,8 @@ void KeyIterator::operator ++() // to our current position on the time line double d0,d1; - d0 = objPos->at ( std::min ( nextObjPos, objPos->size()-1) ).mTime; - d1 = targetObjPos->at( std::min ( nextTargetObjPos, targetObjPos->size()-1) ).mTime; + d0 = objPos->at ( std::min ( nextObjPos, static_cast(objPos->size()-1)) ).mTime; + d1 = targetObjPos->at( std::min ( nextTargetObjPos, static_cast(targetObjPos->size()-1)) ).mTime; // Easiest case - all are identical. In this // case we don't need to interpolate so we can From f22d78a3d37bc64fd5ad79f0b4b3b8e6bb7d1892 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 14:36:45 +1100 Subject: [PATCH 47/52] Fixed build warnings on MSVC14 x64 in Unreal importer. --- code/UnrealLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/UnrealLoader.cpp b/code/UnrealLoader.cpp index ad839fb25..790002235 100644 --- a/code/UnrealLoader.cpp +++ b/code/UnrealLoader.cpp @@ -333,7 +333,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile, std::vector::iterator nt = std::find(materials.begin(),materials.end(),mat); if (nt == materials.end()) { // add material - tri.matIndex = materials.size(); + tri.matIndex = static_cast(materials.size()); mat.numFaces = 1; materials.push_back(mat); From dc3f265803be91d79e7c4464509db29a131b8695 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 15:16:19 +1100 Subject: [PATCH 48/52] Fixed build warnings on MSVC14 x64 in the write dumb source. --- tools/assimp_cmd/WriteDumb.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/assimp_cmd/WriteDumb.cpp b/tools/assimp_cmd/WriteDumb.cpp index 12f5bd25a..44b0c6926 100644 --- a/tools/assimp_cmd/WriteDumb.cpp +++ b/tools/assimp_cmd/WriteDumb.cpp @@ -292,14 +292,14 @@ uint32_t WriteBinaryTexture(const aiTexture* tex) len += Write(tex->mWidth); len += Write(tex->mHeight); - len += fwrite(tex->achFormatHint,1,4,out); + len += static_cast(fwrite(tex->achFormatHint,1,4,out)); if(!shortened) { if (!tex->mHeight) { - len += fwrite(tex->pcData,1,tex->mWidth,out); + len += static_cast(fwrite(tex->pcData,1,tex->mWidth,out)); } else { - len += fwrite(tex->pcData,1,tex->mWidth*tex->mHeight*4,out); + len += static_cast(fwrite(tex->pcData,1,tex->mWidth*tex->mHeight*4,out)); } } @@ -321,7 +321,7 @@ uint32_t WriteBinaryBone(const aiBone* b) if (shortened) { len += WriteBounds(b->mWeights,b->mNumWeights); } // else write as usual - else len += fwrite(b->mWeights,1,b->mNumWeights*sizeof(aiVertexWeight),out); + else len += static_cast(fwrite(b->mWeights,1,b->mNumWeights*sizeof(aiVertexWeight),out)); ChangeInteger(old,len); return len; @@ -368,13 +368,13 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh) if (shortened) { len += WriteBounds(mesh->mVertices,mesh->mNumVertices); } // else write as usual - else len += fwrite(mesh->mVertices,1,12*mesh->mNumVertices,out); + else len += static_cast(fwrite(mesh->mVertices,1,12*mesh->mNumVertices,out)); } if (mesh->mNormals) { if (shortened) { len += WriteBounds(mesh->mNormals,mesh->mNumVertices); } // else write as usual - else len += fwrite(mesh->mNormals,1,12*mesh->mNumVertices,out); + else len += static_cast(fwrite(mesh->mNormals,1,12*mesh->mNumVertices,out)); } if (mesh->mTangents && mesh->mBitangents) { if (shortened) { @@ -382,8 +382,8 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh) len += WriteBounds(mesh->mBitangents,mesh->mNumVertices); } // else write as usual else { - len += fwrite(mesh->mTangents,1,12*mesh->mNumVertices,out); - len += fwrite(mesh->mBitangents,1,12*mesh->mNumVertices,out); + len += static_cast(fwrite(mesh->mTangents,1,12*mesh->mNumVertices,out)); + len += static_cast(fwrite(mesh->mBitangents,1,12*mesh->mNumVertices,out)); } } for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_COLOR_SETS;++n) { @@ -393,7 +393,7 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh) if (shortened) { len += WriteBounds(mesh->mColors[n],mesh->mNumVertices); } // else write as usual - else len += fwrite(mesh->mColors[n],16*mesh->mNumVertices,1,out); + else len += static_cast(fwrite(mesh->mColors[n],16*mesh->mNumVertices,1,out)); } for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS;++n) { if (!mesh->mTextureCoords[n]) @@ -405,7 +405,7 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh) if (shortened) { len += WriteBounds(mesh->mTextureCoords[n],mesh->mNumVertices); } // else write as usual - else len += fwrite(mesh->mTextureCoords[n],12*mesh->mNumVertices,1,out); + else len += static_cast(fwrite(mesh->mTextureCoords[n],12*mesh->mNumVertices,1,out)); } // write faces. There are no floating-point calculations involved @@ -472,7 +472,7 @@ uint32_t WriteBinaryMaterialProperty(const aiMaterialProperty* prop) len += Write(prop->mDataLength); len += Write((unsigned int)prop->mType); - len += fwrite(prop->mData,1,prop->mDataLength,out); + len += static_cast(fwrite(prop->mData,1,prop->mDataLength,out)); ChangeInteger(old,len); return len; @@ -509,21 +509,21 @@ uint32_t WriteBinaryNodeAnim(const aiNodeAnim* nd) len += WriteBounds(nd->mPositionKeys,nd->mNumPositionKeys); } // else write as usual - else len += fwrite(nd->mPositionKeys,1,nd->mNumPositionKeys*sizeof(aiVectorKey),out); + else len += static_cast(fwrite(nd->mPositionKeys,1,nd->mNumPositionKeys*sizeof(aiVectorKey),out)); } if (nd->mRotationKeys) { if (shortened) { len += WriteBounds(nd->mRotationKeys,nd->mNumRotationKeys); } // else write as usual - else len += fwrite(nd->mRotationKeys,1,nd->mNumRotationKeys*sizeof(aiQuatKey),out); + else len += static_cast(fwrite(nd->mRotationKeys,1,nd->mNumRotationKeys*sizeof(aiQuatKey),out)); } if (nd->mScalingKeys) { if (shortened) { len += WriteBounds(nd->mScalingKeys,nd->mNumScalingKeys); } // else write as usual - else len += fwrite(nd->mScalingKeys,1,nd->mNumScalingKeys*sizeof(aiVectorKey),out); + else len += static_cast(fwrite(nd->mScalingKeys,1,nd->mNumScalingKeys*sizeof(aiVectorKey),out)); } ChangeInteger(old,len); From cbfbf2a256a96008ee2c8dd61e69e98aa8b0559a Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 15:54:22 +1100 Subject: [PATCH 49/52] Fixed build warnings on MSVC14 x64 in the X3D format sources. --- code/X3DImporter.cpp | 12 ++++++------ code/X3DImporter_Geometry3D.cpp | 18 ++++++++++++------ code/X3DImporter_Postprocess.cpp | 24 ++++++++++++------------ code/X3DImporter_Rendering.cpp | 26 +++++++++++++------------- 4 files changed, 43 insertions(+), 37 deletions(-) diff --git a/code/X3DImporter.cpp b/code/X3DImporter.cpp index 0e4eae0e3..7c2425cf5 100644 --- a/code/X3DImporter.cpp +++ b/code/X3DImporter.cpp @@ -934,7 +934,7 @@ void X3DImporter::GeometryHelper_CoordIdxStr2FacesArr(const std::list& default: prim_type |= aiPrimitiveType_POLYGON; break; } - tface.mNumIndices = ts; + tface.mNumIndices = static_cast(ts); tface.mIndices = new unsigned int[ts]; memcpy(tface.mIndices, inds.data(), ts * sizeof(unsigned int)); pFaces.push_back(tface); @@ -1329,7 +1329,7 @@ aiMesh* X3DImporter::GeometryHelper_MakeMesh(const std::list& pCoordIdx size_t ts = faces.size(); // faces tmesh->mFaces = new aiFace[ts]; - tmesh->mNumFaces = ts; + tmesh->mNumFaces = static_cast(ts); for(size_t i = 0; i < ts; i++) tmesh->mFaces[i] = faces.at(i); // vertices @@ -1337,7 +1337,7 @@ aiMesh* X3DImporter::GeometryHelper_MakeMesh(const std::list& pCoordIdx ts = pVertices.size(); tmesh->mVertices = new aiVector3D[ts]; - tmesh->mNumVertices = ts; + tmesh->mNumVertices = static_cast(ts); for ( size_t i = 0; i < ts; i++ ) { tmesh->mVertices[ i ] = *vit++; @@ -1701,7 +1701,7 @@ void X3DImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSy { std::list::const_iterator it = mesh_list.begin(); - pScene->mNumMeshes = mesh_list.size(); + pScene->mNumMeshes = static_cast(mesh_list.size()); pScene->mMeshes = new aiMesh*[pScene->mNumMeshes]; for(size_t i = 0; i < pScene->mNumMeshes; i++) pScene->mMeshes[i] = *it++; } @@ -1710,7 +1710,7 @@ void X3DImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSy { std::list::const_iterator it = mat_list.begin(); - pScene->mNumMaterials = mat_list.size(); + pScene->mNumMaterials = static_cast(mat_list.size()); pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials]; for(size_t i = 0; i < pScene->mNumMaterials; i++) pScene->mMaterials[i] = *it++; } @@ -1719,7 +1719,7 @@ void X3DImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSy { std::list::const_iterator it = light_list.begin(); - pScene->mNumLights = light_list.size(); + pScene->mNumLights = static_cast(light_list.size()); pScene->mLights = new aiLight*[pScene->mNumLights]; for(size_t i = 0; i < pScene->mNumLights; i++) pScene->mLights[i] = *it++; } diff --git a/code/X3DImporter_Geometry3D.cpp b/code/X3DImporter_Geometry3D.cpp index 252593163..34e295d06 100644 --- a/code/X3DImporter_Geometry3D.cpp +++ b/code/X3DImporter_Geometry3D.cpp @@ -347,8 +347,8 @@ void X3DImporter::ParseNode_Geometry3D_ElevationGrid() ((CX3DImporter_NodeElement_ElevationGrid*)ne)->NumIndices = 2;// will be holded as line set. for(size_t i = 0, i_e = (grid_alias.Vertices.size() - 1); i < i_e; i++) { - grid_alias.CoordIdx.push_back(i); - grid_alias.CoordIdx.push_back(i + 1); + grid_alias.CoordIdx.push_back(static_cast(i)); + grid_alias.CoordIdx.push_back(static_cast(i + 1)); grid_alias.CoordIdx.push_back(-1); } } @@ -758,7 +758,7 @@ void X3DImporter::ParseNode_Geometry3D_Extrusion() if(beginCap) { // add cap as polygon. vertices of cap are places at begin, so just add numbers from zero. - for(size_t i = 0, i_e = crossSection.size(); i < i_e; i++) ext_alias.CoordIndex.push_back(i); + for(size_t i = 0, i_e = crossSection.size(); i < i_e; i++) ext_alias.CoordIndex.push_back(static_cast(i)); // add delimiter ext_alias.CoordIndex.push_back(-1); @@ -769,7 +769,7 @@ void X3DImporter::ParseNode_Geometry3D_Extrusion() // add cap as polygon. vertices of cap are places at end, as for beginCap use just sequence of numbers but with offset. size_t beg = (pointset_arr.size() - 1) * crossSection.size(); - for(size_t i = beg, i_e = (beg + crossSection.size()); i < i_e; i++) ext_alias.CoordIndex.push_back(i); + for(size_t i = beg, i_e = (beg + crossSection.size()); i < i_e; i++) ext_alias.CoordIndex.push_back(static_cast(i)); // add delimiter ext_alias.CoordIndex.push_back(-1); @@ -795,14 +795,20 @@ void X3DImporter::ParseNode_Geometry3D_Extrusion() if(cri != cr_last) { MACRO_FACE_ADD_QUAD(ccw, ext_alias.CoordIndex, - spi * cr_sz + cri, right_col * cr_sz + cri, right_col * cr_sz + cri + 1, spi * cr_sz + cri + 1); + static_cast(spi * cr_sz + cri), + static_cast(right_col * cr_sz + cri), + static_cast(right_col * cr_sz + cri + 1), + static_cast(spi * cr_sz + cri + 1)); // add delimiter ext_alias.CoordIndex.push_back(-1); } else if(cross_closed)// if cross curve is closed then one more quad is needed: between first and last points of curve. { MACRO_FACE_ADD_QUAD(ccw, ext_alias.CoordIndex, - spi * cr_sz + cri, right_col * cr_sz + cri, right_col * cr_sz + 0, spi * cr_sz + 0); + static_cast(spi * cr_sz + cri), + static_cast(right_col * cr_sz + cri), + static_cast(right_col * cr_sz + 0), + static_cast(spi * cr_sz + 0)); // add delimiter ext_alias.CoordIndex.push_back(-1); } diff --git a/code/X3DImporter_Postprocess.cpp b/code/X3DImporter_Postprocess.cpp index 676816be9..8a953b709 100644 --- a/code/X3DImporter_Postprocess.cpp +++ b/code/X3DImporter_Postprocess.cpp @@ -253,7 +253,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle tarr.reserve(tnemesh.Vertices.size()); for(std::list::iterator it = tnemesh.Vertices.begin(); it != tnemesh.Vertices.end(); it++) tarr.push_back(*it); - *pMesh = StandardShapes::MakeMesh(tarr, tnemesh.NumIndices);// create mesh from vertices using Assimp help. + *pMesh = StandardShapes::MakeMesh(tarr, static_cast(tnemesh.NumIndices));// create mesh from vertices using Assimp help. return;// mesh is build, nothing to do anymore. } @@ -272,7 +272,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle tarr.reserve(tnemesh.Vertices.size()); for(std::list::iterator it = tnemesh.Vertices.begin(); it != tnemesh.Vertices.end(); it++) tarr.push_back(*it); - *pMesh = StandardShapes::MakeMesh(tarr, tnemesh.NumIndices);// create mesh from vertices using Assimp help. + *pMesh = StandardShapes::MakeMesh(tarr, static_cast(tnemesh.NumIndices));// create mesh from vertices using Assimp help. return;// mesh is build, nothing to do anymore. } @@ -669,7 +669,7 @@ void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeEle { std::list::const_iterator it = SceneNode_Child.begin(); - pSceneNode.mNumChildren = SceneNode_Child.size(); + pSceneNode.mNumChildren = static_cast(SceneNode_Child.size()); pSceneNode.mChildren = new aiNode*[pSceneNode.mNumChildren]; for(size_t i = 0; i < pSceneNode.mNumChildren; i++) pSceneNode.mChildren[i] = *it++; } @@ -678,7 +678,7 @@ void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeEle { std::list::const_iterator it = SceneNode_Mesh.begin(); - pSceneNode.mNumMeshes = SceneNode_Mesh.size(); + pSceneNode.mNumMeshes = static_cast(SceneNode_Mesh.size()); pSceneNode.mMeshes = new unsigned int[pSceneNode.mNumMeshes]; for(size_t i = 0; i < pSceneNode.mNumMeshes; i++) pSceneNode.mMeshes[i] = *it++; } @@ -702,7 +702,7 @@ void X3DImporter::Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& p if(tmesh != nullptr) { // if mesh successfully built then add data about it to arrays - pNodeMeshInd.push_back(pSceneMeshList.size()); + pNodeMeshInd.push_back(static_cast(pSceneMeshList.size())); pSceneMeshList.push_back(tmesh); // keep mesh type. Need above for texture coordinate generation. mesh_type = (*it)->Type; @@ -714,7 +714,7 @@ void X3DImporter::Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& p if(tmat != nullptr) { // if material successfully built then add data about it to array - mat_ind = pSceneMaterialList.size(); + mat_ind = static_cast(pSceneMaterialList.size()); pSceneMaterialList.push_back(tmat); } } @@ -765,7 +765,7 @@ void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pN } // copy collected metadata to output node. - pSceneNode.mMetaData = aiMetadata::Alloc( meta_list.size() ); + pSceneNode.mMetaData = aiMetadata::Alloc( static_cast(meta_list.size()) ); meta_idx = 0; for(std::list::const_iterator it = meta_list.begin(); it != meta_list.end(); it++, meta_idx++) { @@ -776,22 +776,22 @@ void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pN if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaBoolean) { if(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.size() > 0) - pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, *(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.begin())); + pSceneNode.mMetaData->Set(static_cast(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.begin())); } else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaDouble) { if(((CX3DImporter_NodeElement_MetaDouble*)cur_meta)->Value.size() > 0) - pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, (float)*(((CX3DImporter_NodeElement_MetaDouble*)cur_meta)->Value.begin())); + pSceneNode.mMetaData->Set(static_cast(meta_idx), cur_meta->Name, (float)*(((CX3DImporter_NodeElement_MetaDouble*)cur_meta)->Value.begin())); } else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaFloat) { if(((CX3DImporter_NodeElement_MetaFloat*)cur_meta)->Value.size() > 0) - pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, *(((CX3DImporter_NodeElement_MetaFloat*)cur_meta)->Value.begin())); + pSceneNode.mMetaData->Set(static_cast(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaFloat*)cur_meta)->Value.begin())); } else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaInteger) { if(((CX3DImporter_NodeElement_MetaInteger*)cur_meta)->Value.size() > 0) - pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, *(((CX3DImporter_NodeElement_MetaInteger*)cur_meta)->Value.begin())); + pSceneNode.mMetaData->Set(static_cast(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaInteger*)cur_meta)->Value.begin())); } else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaString) { @@ -799,7 +799,7 @@ void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pN { aiString tstr(((CX3DImporter_NodeElement_MetaString*)cur_meta)->Value.begin()->data()); - pSceneNode.mMetaData->Set(meta_idx, cur_meta->Name, tstr); + pSceneNode.mMetaData->Set(static_cast(meta_idx), cur_meta->Name, tstr); } } else diff --git a/code/X3DImporter_Rendering.cpp b/code/X3DImporter_Rendering.cpp index ce0d7b607..29dc28765 100644 --- a/code/X3DImporter_Rendering.cpp +++ b/code/X3DImporter_Rendering.cpp @@ -524,7 +524,7 @@ void X3DImporter::ParseNode_Rendering_LineSet() { if(*vc_it < 2) throw DeadlyImportError("LineSet. vertexCount shall be greater than or equal to two."); - for(int32_t i = 0; i < *vc_it; i++) ne_alias.CoordIndex.push_back(coord_num++);// add vertices indices + for(int32_t i = 0; i < *vc_it; i++) ne_alias.CoordIndex.push_back(static_cast(coord_num++));// add vertices indices ne_alias.CoordIndex.push_back(-1);// add face delimiter. } @@ -678,17 +678,17 @@ void X3DImporter::ParseNode_Rendering_TriangleFanSet() { // 2 1 // 0 - ne_alias.CoordIndex.push_back(coord_num_first);// first vertex is a center and always is [0]. - ne_alias.CoordIndex.push_back(coord_num_prev++); - ne_alias.CoordIndex.push_back(coord_num_prev); + ne_alias.CoordIndex.push_back(static_cast(coord_num_first));// first vertex is a center and always is [0]. + ne_alias.CoordIndex.push_back(static_cast(coord_num_prev++)); + ne_alias.CoordIndex.push_back(static_cast(coord_num_prev)); } else { // 1 2 // 0 - ne_alias.CoordIndex.push_back(coord_num_first);// first vertex is a center and always is [0]. - ne_alias.CoordIndex.push_back(coord_num_prev + 1); - ne_alias.CoordIndex.push_back(coord_num_prev++); + ne_alias.CoordIndex.push_back(static_cast(coord_num_first));// first vertex is a center and always is [0]. + ne_alias.CoordIndex.push_back(static_cast(coord_num_prev + 1)); + ne_alias.CoordIndex.push_back(static_cast(coord_num_prev++)); }// if(ccw) else ne_alias.CoordIndex.push_back(-1);// add face delimiter. @@ -875,17 +875,17 @@ void X3DImporter::ParseNode_Rendering_TriangleStripSet() { // 0 2 // 1 - ne_alias.CoordIndex.push_back(coord_num0); - ne_alias.CoordIndex.push_back(coord_num1); - ne_alias.CoordIndex.push_back(coord_num2); + ne_alias.CoordIndex.push_back(static_cast(coord_num0)); + ne_alias.CoordIndex.push_back(static_cast(coord_num1)); + ne_alias.CoordIndex.push_back(static_cast(coord_num2)); } else { // 0 1 // 2 - ne_alias.CoordIndex.push_back(coord_num0); - ne_alias.CoordIndex.push_back(coord_num2); - ne_alias.CoordIndex.push_back(coord_num1); + ne_alias.CoordIndex.push_back(static_cast(coord_num0)); + ne_alias.CoordIndex.push_back(static_cast(coord_num2)); + ne_alias.CoordIndex.push_back(static_cast(coord_num1)); }// if(ccw) else ne_alias.CoordIndex.push_back(-1);// add face delimiter. From 7415289649e57aeed10015671bb15d999c7707f0 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 16:02:21 +1100 Subject: [PATCH 50/52] Fixed build warnings on MSVC14 x64 in X file importer. --- code/XFileImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/XFileImporter.cpp b/code/XFileImporter.cpp index da5882f6c..3b149a18a 100644 --- a/code/XFileImporter.cpp +++ b/code/XFileImporter.cpp @@ -286,7 +286,7 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec // or referenced material, it should already have a valid index if( sourceMesh->mFaceMaterials.size() > 0) { - mesh->mMaterialIndex = sourceMesh->mMaterials[b].sceneIndex; + mesh->mMaterialIndex = static_cast(sourceMesh->mMaterials[b].sceneIndex); } else { mesh->mMaterialIndex = 0; From cf151b77d8bed3eac5cb20629ad23038b08afbe3 Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 16:03:25 +1100 Subject: [PATCH 51/52] Fixed build warnings on MSVC14 x64 in the XGL loader. --- code/XGLLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/XGLLoader.cpp b/code/XGLLoader.cpp index 30f520097..d14e9968d 100644 --- a/code/XGLLoader.cpp +++ b/code/XGLLoader.cpp @@ -711,7 +711,7 @@ unsigned int XGLImporter::ResolveMaterialRef(TempScope& scope) const std::string& s = GetElementName(); if (s == "mat") { ReadMaterial(scope); - return scope.materials_linear.size()-1; + return static_cast(scope.materials_linear.size()-1); } const int id = ReadIndexFromText(); From 6f4cb363c8b563d88bb6a078b5bdc9abd6f02ecf Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 27 Nov 2016 17:34:34 +1100 Subject: [PATCH 52/52] Added a preprocessor definition for MSVC to silence safety warnings regarding C library functions. This addresses all warnings for MSVC x86 and x64 when building zlib, tools and viewer as a static lib. --- test/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 038a68d62..911c2eed6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -122,6 +122,10 @@ ELSE( WIN32 ) SET( platform_libs pthread ) ENDIF( WIN32 ) +IF(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +ENDIF(MSVC) + target_link_libraries( unit assimp ${platform_libs} ) add_subdirectory(headercheck)