summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-06-20 11:44:56 +0200
committerGitHub <noreply@github.com>2021-06-20 11:44:56 +0200
commit671bd64e4a9984a6a308bc97d6de2eb3bc32fad8 (patch)
tree8a4b1142bccb4264245430abee26b999bc6d9c9e /modules
parent4fcc5891450a7dca9c8ebae6ff3765f5f060c442 (diff)
parent45c24fd039f237fa9eed03d06ccf8b3738b223e3 (diff)
Merge pull request #49754 from aaronfranke/is-eq-approx-sub-opt
Fix sub-optimal uses of is_equal_approx
Diffstat (limited to 'modules')
-rw-r--r--modules/fbx/data/fbx_material.cpp4
-rw-r--r--modules/fbx/fbx_parser/FBXParser.cpp2
-rw-r--r--modules/fbx/tools/import_utils.h6
-rw-r--r--modules/gltf/gltf_document.cpp2
4 files changed, 7 insertions, 7 deletions
diff --git a/modules/fbx/data/fbx_material.cpp b/modules/fbx/data/fbx_material.cpp
index aef61a679b..cf5d70fa5b 100644
--- a/modules/fbx/data/fbx_material.cpp
+++ b/modules/fbx/data/fbx_material.cpp
@@ -420,7 +420,7 @@ Ref<StandardMaterial3D> FBXMaterial::import_material(ImportState &state) {
} break;
case PROPERTY_DESC_COAT_ROUGHNESS: {
// meaning is that approx equal to zero is disabled not actually zero. ;)
- if (real_value && Math::is_equal_approx(real_value->Value(), 0.0f)) {
+ if (real_value && Math::is_zero_approx(real_value->Value())) {
print_verbose("clearcoat real value: " + rtos(real_value->Value()));
spatial_material->set_clearcoat_gloss(1.0 - real_value->Value());
} else {
@@ -428,7 +428,7 @@ Ref<StandardMaterial3D> FBXMaterial::import_material(ImportState &state) {
}
} break;
case PROPERTY_DESC_EMISSIVE: {
- if (real_value && Math::is_equal_approx(real_value->Value(), 0.0f)) {
+ if (real_value && Math::is_zero_approx(real_value->Value())) {
print_verbose("Emissive real value: " + rtos(real_value->Value()));
spatial_material->set_emission_energy(real_value->Value());
} else if (vector_value && !vector_value->Value().is_equal_approx(Vector3(0, 0, 0))) {
diff --git a/modules/fbx/fbx_parser/FBXParser.cpp b/modules/fbx/fbx_parser/FBXParser.cpp
index 163518d18f..a92b23f4ee 100644
--- a/modules/fbx/fbx_parser/FBXParser.cpp
+++ b/modules/fbx/fbx_parser/FBXParser.cpp
@@ -1167,7 +1167,7 @@ Transform3D ReadMatrix(const ElementPtr element) {
// clean values to prevent any IBM damage on inverse() / affine_inverse()
for (float &value : values) {
- if (::Math::is_equal_approx(0, value)) {
+ if (::Math::is_zero_approx(value)) {
value = 0;
}
}
diff --git a/modules/fbx/tools/import_utils.h b/modules/fbx/tools/import_utils.h
index 319a7a4697..fbe7dbd82f 100644
--- a/modules/fbx/tools/import_utils.h
+++ b/modules/fbx/tools/import_utils.h
@@ -137,15 +137,15 @@ public:
static Vector3 safe_import_vector3(const Vector3 &p_vec) {
Vector3 vector = p_vec;
- if (Math::is_equal_approx(0, vector.x)) {
+ if (Math::is_zero_approx(vector.x)) {
vector.x = 0;
}
- if (Math::is_equal_approx(0, vector.y)) {
+ if (Math::is_zero_approx(vector.y)) {
vector.y = 0;
}
- if (Math::is_equal_approx(0, vector.z)) {
+ if (Math::is_zero_approx(vector.z)) {
vector.z = 0;
}
return vector;
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index 2fe28c0ac4..674403905a 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -3596,7 +3596,7 @@ void GLTFDocument::spec_gloss_to_rough_metal(Ref<GLTFSpecGloss> r_spec_gloss, Re
if (!Math::is_equal_approx(mr.g, 1.0f)) {
has_roughness = true;
}
- if (!Math::is_equal_approx(mr.b, 0.0f)) {
+ if (!Math::is_zero_approx(mr.b)) {
has_metal = true;
}
mr.g *= r_spec_gloss->gloss_factor;