GLTFMaterialsSheenExtension constructor
GLTFMaterialsSheenExtension(
- dynamic parser
Implementation
GLTFMaterialsSheenExtension(this.parser) {
name = gltfExtensions["KHR_MATERIALS_SHEEN"]!;
getMaterialType = (materialIndex) {
var parser = this.parser;
var materialDef = parser.json["materials"][materialIndex];
if (materialDef["extensions"] == null || materialDef["extensions"][name] == null) return null;
return MeshPhysicalMaterial;
};
extendMaterialParams = (materialIndex, materialParams) {
var parser = this.parser;
var materialDef = parser.json["materials"][materialIndex];
if (materialDef["extensions"] == null || materialDef["extensions"][name] == null) {
return null;
}
List<Future> pending = [];
materialParams.sheenColor = Color(0, 0, 0);
materialParams.sheenRoughness = 0;
materialParams.sheen = 1;
Map extension = materialDef["extensions"][name];
if (extension["sheenColorFactor"] != null) {
materialParams.sheenColor.fromArray(extension["sheenColorFactor"]);
}
if (extension["sheenRoughnessFactor"] != null) {
materialParams.sheenRoughness = extension["sheenRoughnessFactor"];
}
if (extension["sheenColorTexture"] != null) {
pending
.add(parser.assignTexture(materialParams, 'sheenColorMap', extension["sheenColorTexture"], sRGBEncoding));
}
if (extension["sheenRoughnessTexture"] != null) {
pending.add(parser.assignTexture(materialParams, 'sheenRoughnessMap', extension["sheenRoughnessTexture"]));
}
return Future.wait(pending);
};
}