From da4af965a10811bb17849c6ea468213cd11cbbdb Mon Sep 17 00:00:00 2001 From: sean Date: Sat, 27 Jan 2024 01:09:18 +0100 Subject: [PATCH] Remove remaining usages of float --- src/fastgltf.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fastgltf.cpp b/src/fastgltf.cpp index 9879b9d69..683325578 100644 --- a/src/fastgltf.cpp +++ b/src/fastgltf.cpp @@ -242,14 +242,14 @@ namespace fastgltf { if (type == TextureInfoType::NormalTexture) { double scale; if (auto error = child["scale"].get_double().get(scale); error == SUCCESS) { - reinterpret_cast(info)->scale = static_cast(scale); + reinterpret_cast(info)->scale = static_cast(scale); } else if (error != NO_SUCH_FIELD) { return Error::InvalidGltf; } } else if (type == TextureInfoType::OcclusionTexture) { double strength; if (auto error = child["strength"].get_double().get(strength); error == SUCCESS) { - reinterpret_cast(info)->strength = static_cast(strength); + reinterpret_cast(info)->strength = static_cast(strength); } else if (error != NO_SUCH_FIELD) { return Error::InvalidGltf; } @@ -270,7 +270,7 @@ namespace fastgltf { double rotation = 0.0F; if (textureTransform["rotation"].get_double().get(rotation) == SUCCESS) { - transform->rotation = static_cast(rotation); + transform->rotation = static_cast(rotation); } dom::array array; @@ -280,7 +280,7 @@ namespace fastgltf { if (array.at(i).get_double().get(val) != SUCCESS) { return Error::InvalidGltf; } - transform->uvOffset[i] = static_cast(val); + transform->uvOffset[i] = static_cast(val); } } @@ -290,7 +290,7 @@ namespace fastgltf { if (array.at(i).get_double().get(val) != SUCCESS) { return Error::InvalidGltf; } - transform->uvScale[i] = static_cast(val); + transform->uvScale[i] = static_cast(val); } } @@ -2105,7 +2105,7 @@ fg::Error fg::Parser::parseLights(simdjson::dom::array& lights, Asset& asset) { } } } else if (error == NO_SUCH_FIELD) { - light.color = std::array{{1.0f, 1.0f, 1.0f}}; + light.color = std::array{{1.0f, 1.0f, 1.0f}}; } else { return Error::InvalidGltf; } @@ -3922,7 +3922,7 @@ void fg::Exporter::writeMaterials(const Asset& asset, std::string& json) { json += '{'; json += "\"pbrMetallicRoughness\":{"; - if (it->pbrData.baseColorFactor != std::array{{1.0f, 1.0f, 1.0f, 1.0f}}) { + if (it->pbrData.baseColorFactor != std::array{{1.0f, 1.0f, 1.0f, 1.0f}}) { json += R"("baseColorFactor":[)"; json += std::to_string(it->pbrData.baseColorFactor[0]) + ',' + std::to_string(it->pbrData.baseColorFactor[1]) + ',' + std::to_string(it->pbrData.baseColorFactor[2]) + ',' + std::to_string(it->pbrData.baseColorFactor[3]); @@ -4347,7 +4347,7 @@ void fg::Exporter::writeNodes(const Asset& asset, std::string& json) { std::visit(visitor { [&](const TRS& trs) { - if (trs.rotation != std::array{{.0f, .0f, .0f, 1.0f}}) { + if (trs.rotation != std::array{{.0f, .0f, .0f, 1.0f}}) { if (json.back() != '{') json += ','; json += R"("rotation":[)"; @@ -4355,7 +4355,7 @@ void fg::Exporter::writeNodes(const Asset& asset, std::string& json) { json += "]"; } - if (trs.scale != std::array{{1.0f, 1.0f, 1.0f}}) { + if (trs.scale != std::array{{1.0f, 1.0f, 1.0f}}) { if (json.back() != '{') json += ','; json += R"("scale":[)"; @@ -4363,7 +4363,7 @@ void fg::Exporter::writeNodes(const Asset& asset, std::string& json) { json += "]"; } - if (trs.translation != std::array{{.0f, .0f, .0f}}) { + if (trs.translation != std::array{{.0f, .0f, .0f}}) { if (json.back() != '{') json += ','; json += R"("translation":[)";