extendParams method

dynamic extendParams(
  1. Map<String, dynamic> materialParams,
  2. Map<String, dynamic> materialDef,
  3. dynamic parser
)

Implementation

extendParams(Map<String, dynamic> materialParams, Map<String, dynamic> materialDef, parser) async {
  List<Future> pending = [];

  materialParams["color"] = Color(1.0, 1.0, 1.0);
  materialParams["opacity"] = 1.0;

  Map<String, dynamic> metallicRoughness = materialDef["pbrMetallicRoughness"];

  if (metallicRoughness["baseColorFactor"] is List) {
    List<double> array = List<double>.from(metallicRoughness["baseColorFactor"].map((e) => e.toDouble()).toList());

    materialParams["color"].fromArray(array);
    materialParams["opacity"] = array[3];
  }

  if (metallicRoughness["baseColorTexture"] != null) {
    pending.add(parser.assignTexture(materialParams, 'map', metallicRoughness["baseColorTexture"]));
  }

  return Future.wait(pending);
}