diff options
author | Dave Parks <davep@lindenlab.com> | 2022-10-31 15:58:20 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-10-31 15:58:20 -0500 |
commit | 75e743be2f60916e6bf78da24814551bd6415116 (patch) | |
tree | 8a960d0190e2c9d91944fb3d60e02a026325586a /indra | |
parent | 94afae5b1552439f69126ecf7cd6716fa692fed6 (diff) |
SL-18442 Port of Caladbolg's fix for emissive overrides not taking. Remove unused function.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llprimitive/llgltfmaterial.cpp | 67 | ||||
-rw-r--r-- | indra/llprimitive/llgltfmaterial.h | 3 |
2 files changed, 7 insertions, 63 deletions
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index 9743bad7a7..f771337c92 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -241,8 +241,14 @@ void LLGLTFMaterial::writeToModel(tinygltf::Model& model, S32 mat_index) const material_out.alphaCutoff = mAlphaCutoff; mBaseColor.write(material_out.pbrMetallicRoughness.baseColorFactor); + material_out.emissiveFactor.resize(3); // 0 size by default - mEmissiveColor.write(material_out.emissiveFactor); + + if (mEmissiveColor != LLGLTFMaterial::getDefaultEmissiveColor()) + { + material_out.emissiveFactor.resize(3); + mEmissiveColor.write(material_out.emissiveFactor); + } material_out.pbrMetallicRoughness.metallicFactor = mMetallicFactor; material_out.pbrMetallicRoughness.roughnessFactor = mRoughnessFactor; @@ -439,65 +445,6 @@ F32 LLGLTFMaterial::getDefaultTextureRotation() return 0.f; } -void LLGLTFMaterial::writeOverridesToModel(tinygltf::Model& model, S32 mat_index, LLGLTFMaterial const* base_material) const -{ - if (model.materials.size() < mat_index + 1) - { - model.materials.resize(mat_index + 1); - } - - tinygltf::Material& material_out = model.materials[mat_index]; - - // TODO - fix handling of resetting to null/default values - - constexpr bool is_override = true; - - // set base color texture - writeToTexture(model, material_out.pbrMetallicRoughness.baseColorTexture, GLTF_TEXTURE_INFO_BASE_COLOR, mBaseColorId, is_override, base_material->mBaseColorId); - // set normal texture - writeToTexture(model, material_out.normalTexture, GLTF_TEXTURE_INFO_NORMAL, mNormalId, is_override, base_material->mNormalId); - // set metallic-roughness texture - writeToTexture(model, material_out.pbrMetallicRoughness.metallicRoughnessTexture, GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS, mMetallicRoughnessId, is_override, base_material->mMetallicRoughnessId); - // set emissive texture - writeToTexture(model, material_out.emissiveTexture, GLTF_TEXTURE_INFO_EMISSIVE, mEmissiveId, is_override, base_material->mEmissiveId); - - if (mAlphaMode != base_material->mAlphaMode) - { - material_out.alphaMode = getAlphaMode(); - } - - if (mAlphaCutoff != base_material->mAlphaCutoff) - { - material_out.alphaCutoff = mAlphaCutoff; - } - - if (mBaseColor != base_material->mBaseColor) - { - mBaseColor.write(material_out.pbrMetallicRoughness.baseColorFactor); - } - - if (mEmissiveColor != base_material->mEmissiveColor) - { - material_out.emissiveFactor.resize(3); // 0 size by default - mEmissiveColor.write(material_out.emissiveFactor); - } - - if (mMetallicFactor != base_material->mMetallicFactor) - { - material_out.pbrMetallicRoughness.metallicFactor = mMetallicFactor; - } - - if (mRoughnessFactor != base_material->mRoughnessFactor) - { - material_out.pbrMetallicRoughness.roughnessFactor = mRoughnessFactor; - } - - if (mDoubleSided != base_material->mDoubleSided) - { - material_out.doubleSided = mDoubleSided; - } -} - void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) { // TODO: potentially reimplement this with a more general purpose JSON merge diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index b0afb11bb5..d94ce6e281 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -185,9 +185,6 @@ public: // write to given tinygltf::Model void writeToModel(tinygltf::Model& model, S32 mat_index) const; - // calculate the fields in this material that differ from a base material and write them out to a given tinygltf::Model - void writeOverridesToModel(tinygltf::Model& model, S32 mat_index, LLGLTFMaterial const* base_material) const; - void applyOverride(const LLGLTFMaterial& override_mat); private: |