mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +02:00
Fixed metallic material import for GLTF
This commit is contained in:
parent
528020417a
commit
9a3686ccb6
1 changed files with 7 additions and 2 deletions
|
@ -495,9 +495,13 @@ bool GLTFSerializer::addMaterial(const QJsonObject& object) {
|
||||||
getIndexFromObject(jsMetallicRoughness, "baseColorTexture",
|
getIndexFromObject(jsMetallicRoughness, "baseColorTexture",
|
||||||
material.pbrMetallicRoughness.baseColorTexture,
|
material.pbrMetallicRoughness.baseColorTexture,
|
||||||
material.pbrMetallicRoughness.defined);
|
material.pbrMetallicRoughness.defined);
|
||||||
getDoubleVal(jsMetallicRoughness, "metallicFactor",
|
// Undefined metallicFactor used with pbrMetallicRoughness means metallicFactor == 1.0
|
||||||
|
if (!getDoubleVal(jsMetallicRoughness, "metallicFactor",
|
||||||
material.pbrMetallicRoughness.metallicFactor,
|
material.pbrMetallicRoughness.metallicFactor,
|
||||||
material.pbrMetallicRoughness.defined);
|
material.pbrMetallicRoughness.defined)) {
|
||||||
|
material.pbrMetallicRoughness.metallicFactor = 1.0;
|
||||||
|
material.pbrMetallicRoughness.defined["metallicFactor"] = true;
|
||||||
|
}
|
||||||
getDoubleVal(jsMetallicRoughness, "roughnessFactor",
|
getDoubleVal(jsMetallicRoughness, "roughnessFactor",
|
||||||
material.pbrMetallicRoughness.roughnessFactor,
|
material.pbrMetallicRoughness.roughnessFactor,
|
||||||
material.pbrMetallicRoughness.defined);
|
material.pbrMetallicRoughness.defined);
|
||||||
|
@ -1856,6 +1860,7 @@ void GLTFSerializer::setHFMMaterial(HFMMaterial& hfmMat, const GLTFMaterial& mat
|
||||||
|
|
||||||
if (material.pbrMetallicRoughness.defined["metallicFactor"]) {
|
if (material.pbrMetallicRoughness.defined["metallicFactor"]) {
|
||||||
hfmMat.metallic = material.pbrMetallicRoughness.metallicFactor;
|
hfmMat.metallic = material.pbrMetallicRoughness.metallicFactor;
|
||||||
|
hfmMat._material->setMetallic(hfmMat.metallic);
|
||||||
}
|
}
|
||||||
if (material.pbrMetallicRoughness.defined["baseColorTexture"]) {
|
if (material.pbrMetallicRoughness.defined["baseColorTexture"]) {
|
||||||
hfmMat.opacityTexture = getHFMTexture(_file.textures[material.pbrMetallicRoughness.baseColorTexture]);
|
hfmMat.opacityTexture = getHFMTexture(_file.textures[material.pbrMetallicRoughness.baseColorTexture]);
|
||||||
|
|
Loading…
Reference in a new issue