From 439b4861c82f15c4f6180a7b61771a0a160cd98d Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Sun, 20 Nov 2016 14:06:56 +1100 Subject: [PATCH] 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)