extendParams method
dynamic
extendParams(
- dynamic materialParams,
- dynamic materialDef,
- dynamic parser
Implementation
extendParams(materialParams, materialDef, parser) async {
var pbrSpecularGlossiness = materialDef.extensions[this.name];
materialParams.color = new Color(1.0, 1.0, 1.0);
materialParams.opacity = 1.0;
List<Future> pending = [];
if (pbrSpecularGlossiness.diffuseFactor is List) {
var array = pbrSpecularGlossiness.diffuseFactor;
materialParams.color.fromArray(array);
materialParams.opacity = array[3];
}
if (pbrSpecularGlossiness.diffuseTexture != null) {
pending.add(parser.assignTexture(
materialParams, 'map', pbrSpecularGlossiness.diffuseTexture, sRGBEncoding));
}
materialParams.emissive = new Color(0.0, 0.0, 0.0);
materialParams.glossiness = pbrSpecularGlossiness.glossinessFactor != null
? pbrSpecularGlossiness.glossinessFactor
: 1.0;
materialParams.specular = new Color(1.0, 1.0, 1.0);
if (pbrSpecularGlossiness.specularFactor is List) {
materialParams.specular.fromArray(pbrSpecularGlossiness.specularFactor);
}
if (pbrSpecularGlossiness.specularGlossinessTexture != null) {
var specGlossMapDef = pbrSpecularGlossiness.specularGlossinessTexture;
pending.add(parser.assignTexture(
materialParams, 'glossinessMap', specGlossMapDef));
pending.add(
parser.assignTexture(materialParams, 'specularMap', specGlossMapDef, sRGBEncoding));
}
return Future.wait(pending);
}