summaryrefslogtreecommitdiff
path: root/indra/newview/llgltfmateriallist.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-08-05 23:36:13 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-08-06 10:17:32 +0300
commit3e7946bbbf905418595b0632388fb3de4d673312 (patch)
tree31bdf8a54c5942545d941c00f1b6a4ed7215e8ff /indra/newview/llgltfmateriallist.cpp
parent8007b43876831a0d88833bdc8fd7eb6d543dd38b (diff)
SL-17888 Clamp some gltf material values
Diffstat (limited to 'indra/newview/llgltfmateriallist.cpp')
-rw-r--r--indra/newview/llgltfmateriallist.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 7ecbc6eeac..96c29d7ed2 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -99,13 +99,13 @@ static void set_from_model(LLGLTFMaterial* mat, tinygltf::Model& model)
}
mat->setAlphaMode(material_in.alphaMode);
- mat->mAlphaCutoff = material_in.alphaCutoff;
+ mat->mAlphaCutoff = llclamp((F32)material_in.alphaCutoff, 0.f, 1.f);
mat->mAlbedoColor = get_color(material_in.pbrMetallicRoughness.baseColorFactor);
mat->mEmissiveColor = get_color(material_in.emissiveFactor);
- mat->mMetallicFactor = material_in.pbrMetallicRoughness.metallicFactor;
- mat->mRoughnessFactor = material_in.pbrMetallicRoughness.roughnessFactor;
+ mat->mMetallicFactor = llclamp((F32)material_in.pbrMetallicRoughness.metallicFactor, 0.f, 1.f);
+ mat->mRoughnessFactor = llclamp((F32)material_in.pbrMetallicRoughness.roughnessFactor, 0.f, 1.f);
mat->mDoubleSided = material_in.doubleSided;
}