GLTFMaterialsTransmissionExtension constructor
GLTFMaterialsTransmissionExtension(
- dynamic parser
Implementation
GLTFMaterialsTransmissionExtension(parser) {
this.parser = parser;
this.getMaterialType = (materialIndex) {
var parser = this.parser;
Map<String, dynamic> materialDef =
parser.json["materials"][materialIndex];
if (materialDef["extensions"] == null ||
materialDef["extensions"][this.name] == null) return null;
return MeshPhysicalMaterial;
};
this.extendMaterialParams = (materialIndex, materialParams) async {
var parser = this.parser;
Map<String, dynamic> materialDef =
parser.json["materials"][materialIndex];
if (materialDef["extensions"] == null ||
materialDef["extensions"][this.name] == null) {
return null;
}
List<Future> pending = [];
Map<String, dynamic> exten = materialDef["extensions"][this.name];
if (exten["transmissionFactor"] != null) {
materialParams.transmission = exten["transmissionFactor"];
}
if (exten["transmissionTexture"] != null) {
pending.add(parser.assignTexture(
materialParams, 'transmissionMap', exten["transmissionTexture"]));
}
return Future.wait(pending);
};
}