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 );