Added gltf2 KHR_materials_volume write support.
parent
200bf8df7a
commit
d3276de47d
|
@ -49,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* KHR_materials_sheen: full
|
* KHR_materials_sheen: full
|
||||||
* KHR_materials_clearcoat: full
|
* KHR_materials_clearcoat: full
|
||||||
* KHR_materials_transmission: full
|
* KHR_materials_transmission: full
|
||||||
|
* KHR_materials_volume: full
|
||||||
*/
|
*/
|
||||||
#ifndef GLTF2ASSETWRITER_H_INC
|
#ifndef GLTF2ASSETWRITER_H_INC
|
||||||
#define GLTF2ASSETWRITER_H_INC
|
#define GLTF2ASSETWRITER_H_INC
|
||||||
|
|
|
@ -474,6 +474,28 @@ namespace glTF2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m.materialVolume.isPresent) {
|
||||||
|
Value materialVolume(rapidjson::Type::kObjectType);
|
||||||
|
|
||||||
|
MaterialVolume &volume = m.materialVolume.value;
|
||||||
|
|
||||||
|
if (volume.thicknessFactor != 0.f) {
|
||||||
|
WriteFloat(materialVolume, volume.thicknessFactor, "thicknessFactor", w.mAl);
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteTex(materialVolume, volume.thicknessTexture, "thicknessTexture", w.mAl);
|
||||||
|
|
||||||
|
if (volume.attenuationDistance != INFINITY) {
|
||||||
|
WriteFloat(materialVolume, volume.attenuationDistance, "attenuationDistance", w.mAl);
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteVec(materialVolume, volume.attenuationColor, "attenuationColor", defaultAttenuationColor, w.mAl);
|
||||||
|
|
||||||
|
if (!materialVolume.ObjectEmpty()) {
|
||||||
|
exts.AddMember("KHR_materials_volume", materialVolume, w.mAl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!exts.ObjectEmpty()) {
|
if (!exts.ObjectEmpty()) {
|
||||||
obj.AddMember("extensions", exts, w.mAl);
|
obj.AddMember("extensions", exts, w.mAl);
|
||||||
}
|
}
|
||||||
|
@ -890,6 +912,10 @@ namespace glTF2 {
|
||||||
exts.PushBack(StringRef("KHR_materials_transmission"), mAl);
|
exts.PushBack(StringRef("KHR_materials_transmission"), mAl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->mAsset.extensionsUsed.KHR_materials_volume) {
|
||||||
|
exts.PushBack(StringRef("KHR_materials_volume"), mAl);
|
||||||
|
}
|
||||||
|
|
||||||
if (this->mAsset.extensionsUsed.FB_ngon_encoding) {
|
if (this->mAsset.extensionsUsed.FB_ngon_encoding) {
|
||||||
exts.PushBack(StringRef("FB_ngon_encoding"), mAl);
|
exts.PushBack(StringRef("FB_ngon_encoding"), mAl);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue