From 3e7946bbbf905418595b0632388fb3de4d673312 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 5 Aug 2022 23:36:13 +0300 Subject: SL-17888 Clamp some gltf material values --- indra/newview/llgltfmateriallist.cpp | 6 +++--- indra/newview/skins/default/xui/en/floater_material_editor.xml | 5 ++++- indra/newview/skins/default/xui/en/floater_tools.xml | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'indra') 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; } diff --git a/indra/newview/skins/default/xui/en/floater_material_editor.xml b/indra/newview/skins/default/xui/en/floater_material_editor.xml index 74adc86126..0a05a4f868 100644 --- a/indra/newview/skins/default/xui/en/floater_material_editor.xml +++ b/indra/newview/skins/default/xui/en/floater_material_editor.xml @@ -111,6 +111,7 @@ layout="topleft" left_delta="0" top_pad="5" + min_val="0" max_val="1" name="transparency" width="64" @@ -169,6 +170,7 @@ layout="topleft" left_delta="0" top_pad="5" + min_val="0" max_val="1" name="alpha cutoff" width="64" @@ -245,6 +247,7 @@ layout="topleft" left_delta="0" top_pad="5" + min_val="0" max_val="1" name="metalness factor" width="64" @@ -270,7 +273,7 @@ layout="topleft" left_delta="0" top_pad="5" - + min_val="0" max_val="1" name="roughness factor" width="64" diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 8f2acc8df4..4700488197 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -820,7 +820,7 @@ width="282"/>