From 326158633b7d6e495096af81c751ee0ea69a002e Mon Sep 17 00:00:00 2001 From: Jared Mulconry Date: Fri, 6 Oct 2017 20:32:33 +1100 Subject: [PATCH] Fixed warnings on MSVC caused by implicit conversions from double to float. --- code/glTF2Asset.inl | 4 ++-- code/glTF2Exporter.cpp | 6 +++--- code/glTFExporter.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/glTF2Asset.inl b/code/glTF2Asset.inl index 3082ebf..8b50fa1 100644 --- a/code/glTF2Asset.inl +++ b/code/glTF2Asset.inl @@ -724,7 +724,7 @@ namespace { SetTextureProperties(r, prop, out); if (Value* scale = FindNumber(*prop, "scale")) { - out.scale = scale->GetDouble(); + out.scale = static_cast(scale->GetDouble()); } } } @@ -735,7 +735,7 @@ namespace { SetTextureProperties(r, prop, out); if (Value* strength = FindNumber(*prop, "strength")) { - out.strength = strength->GetDouble(); + out.strength = static_cast(strength->GetDouble()); } } } diff --git a/code/glTF2Exporter.cpp b/code/glTF2Exporter.cpp index 4ed8f20..8f46f7d 100644 --- a/code/glTF2Exporter.cpp +++ b/code/glTF2Exporter.cpp @@ -563,7 +563,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref& meshRef, Ref(jointNamesIndex); vertexWeightData[vertexId][jointsPerVertex[vertexId]] = vertWeight; jointsPerVertex[vertexId] += 1; @@ -872,7 +872,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, RefmNumPositionKeys / numKeyframes; // mTime is measured in ticks, but GLTF time is measured in seconds, so convert. // Check if we have to cast type here. e.g. uint16_t() - timeData[i] = nodeChannel->mPositionKeys[frameIndex].mTime / ticksPerSecond; + timeData[i] = static_cast(nodeChannel->mPositionKeys[frameIndex].mTime / ticksPerSecond); } Ref timeAccessor = ExportData(mAsset, animId, buffer, static_cast(numKeyframes), &timeData[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT); @@ -953,7 +953,7 @@ void glTF2Exporter::ExportAnimations() Ref animRef = mAsset->animations.Create(name); // Parameters - ExtractAnimationData(*mAsset, name, animRef, bufferRef, nodeChannel, anim->mTicksPerSecond); + ExtractAnimationData(*mAsset, name, animRef, bufferRef, nodeChannel, static_cast(anim->mTicksPerSecond)); for (unsigned int j = 0; j < 3; ++j) { std::string channelType; diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index a5df09a..92abcc1 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -473,7 +473,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref& meshRef, Ref(jointNamesIndex); vertexWeightData[vertexId][jointsPerVertex[vertexId]] = vertWeight; jointsPerVertex[vertexId] += 1; @@ -872,7 +872,7 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, RefmNumPositionKeys / numKeyframes; // mTime is measured in ticks, but GLTF time is measured in seconds, so convert. // Check if we have to cast type here. e.g. uint16_t() - timeData[i] = nodeChannel->mPositionKeys[frameIndex].mTime / ticksPerSecond; + timeData[i] = static_cast(nodeChannel->mPositionKeys[frameIndex].mTime / ticksPerSecond); } Ref timeAccessor = ExportData(mAsset, animId, buffer, static_cast(numKeyframes), &timeData[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT); @@ -953,7 +953,7 @@ void glTFExporter::ExportAnimations() Ref animRef = mAsset->animations.Create(name); /******************* Parameters ********************/ - ExtractAnimationData(*mAsset, name, animRef, bufferRef, nodeChannel, anim->mTicksPerSecond); + ExtractAnimationData(*mAsset, name, animRef, bufferRef, nodeChannel, static_cast(anim->mTicksPerSecond)); for (unsigned int j = 0; j < 3; ++j) { std::string channelType; -- 2.7.4