|
@@ -417,6 +417,63 @@ namespace glTF2 {
|
|
exts.AddMember("KHR_materials_unlit", unlit, w.mAl);
|
|
exts.AddMember("KHR_materials_unlit", unlit, w.mAl);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (m.materialSheen.isPresent) {
|
|
|
|
+ Value materialSheen(rapidjson::Type::kObjectType);
|
|
|
|
+
|
|
|
|
+ MaterialSheen &sheen = m.materialSheen.value;
|
|
|
|
+
|
|
|
|
+ WriteVec(materialSheen, sheen.sheenColorFactor, "sheenColorFactor", defaultSheenFactor, w.mAl);
|
|
|
|
+
|
|
|
|
+ if (sheen.sheenRoughnessFactor != 0.f) {
|
|
|
|
+ WriteFloat(materialSheen, sheen.sheenRoughnessFactor, "sheenRoughnessFactor", w.mAl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ WriteTex(materialSheen, sheen.sheenColorTexture, "sheenColorTexture", w.mAl);
|
|
|
|
+ WriteTex(materialSheen, sheen.sheenRoughnessTexture, "sheenRoughnessTexture", w.mAl);
|
|
|
|
+
|
|
|
|
+ if (!materialSheen.ObjectEmpty()) {
|
|
|
|
+ exts.AddMember("KHR_materials_sheen", materialSheen, w.mAl);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (m.materialClearcoat.isPresent) {
|
|
|
|
+ Value materialClearcoat(rapidjson::Type::kObjectType);
|
|
|
|
+
|
|
|
|
+ MaterialClearcoat &clearcoat = m.materialClearcoat.value;
|
|
|
|
+
|
|
|
|
+ if (clearcoat.clearcoatFactor != 0.f) {
|
|
|
|
+ WriteFloat(materialClearcoat, clearcoat.clearcoatFactor, "clearcoatFactor", w.mAl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (clearcoat.clearcoatRoughnessFactor != 0.f) {
|
|
|
|
+ WriteFloat(materialClearcoat, clearcoat.clearcoatRoughnessFactor, "clearcoatRoughnessFactor", w.mAl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ WriteTex(materialClearcoat, clearcoat.clearcoatTexture, "clearcoatTexture", w.mAl);
|
|
|
|
+ WriteTex(materialClearcoat, clearcoat.clearcoatRoughnessTexture, "clearcoatRoughnessTexture", w.mAl);
|
|
|
|
+ WriteTex(materialClearcoat, clearcoat.clearcoatNormalTexture, "clearcoatNormalTexture", w.mAl);
|
|
|
|
+
|
|
|
|
+ if (!materialClearcoat.ObjectEmpty()) {
|
|
|
|
+ exts.AddMember("KHR_materials_clearcoat", materialClearcoat, w.mAl);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (m.materialTransmission.isPresent) {
|
|
|
|
+ Value materialTransmission(rapidjson::Type::kObjectType);
|
|
|
|
+
|
|
|
|
+ MaterialTransmission &transmission = m.materialTransmission.value;
|
|
|
|
+
|
|
|
|
+ if (transmission.transmissionFactor != 0.f) {
|
|
|
|
+ WriteFloat(materialTransmission, transmission.transmissionFactor, "transmissionFactor", w.mAl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ WriteTex(materialTransmission, transmission.transmissionTexture, "transmissionTexture", w.mAl);
|
|
|
|
+
|
|
|
|
+ if (!materialTransmission.ObjectEmpty()) {
|
|
|
|
+ exts.AddMember("KHR_materials_transmission", materialTransmission, w.mAl);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!exts.ObjectEmpty()) {
|
|
if (!exts.ObjectEmpty()) {
|
|
obj.AddMember("extensions", exts, w.mAl);
|
|
obj.AddMember("extensions", exts, w.mAl);
|
|
}
|
|
}
|
|
@@ -808,6 +865,18 @@ namespace glTF2 {
|
|
if (this->mAsset.extensionsUsed.KHR_materials_unlit) {
|
|
if (this->mAsset.extensionsUsed.KHR_materials_unlit) {
|
|
exts.PushBack(StringRef("KHR_materials_unlit"), mAl);
|
|
exts.PushBack(StringRef("KHR_materials_unlit"), mAl);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (this->mAsset.extensionsUsed.KHR_materials_sheen) {
|
|
|
|
+ exts.PushBack(StringRef("KHR_materials_sheen"), mAl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (this->mAsset.extensionsUsed.KHR_materials_clearcoat) {
|
|
|
|
+ exts.PushBack(StringRef("KHR_materials_clearcoat"), mAl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (this->mAsset.extensionsUsed.KHR_materials_transmission) {
|
|
|
|
+ exts.PushBack(StringRef("KHR_materials_transmission"), mAl);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (!exts.Empty())
|
|
if (!exts.Empty())
|