From: Jared Mulconry Date: Sat, 19 Nov 2016 13:18:29 +0000 (+1100) Subject: Fixed build warnings on MSVC14 x64 in the glTF format sources. One warning X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9b0449e835f3cdee66845295c5cbc15d1f7992d;p=platform%2Fupstream%2Fassimp.git Fixed build warnings on MSVC14 x64 in the glTF format sources. One warning yet to be resolved. --- diff --git a/code/glTFAsset.inl b/code/glTFAsset.inl index a7afb34..315d6be 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 0e7a71e..1e545b4 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 f220392..66d45ab 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