getTextureParams method

dynamic getTextureParams(
  1. String value,
  2. dynamic matParams
)

Implementation

getTextureParams(String value, matParams) {
  Map<String, dynamic> texParams = {"scale": Vector2(1, 1), "offset": Vector2(0, 0)};

  var items = value.split(RegExp(r"\s+"));
  var pos;

  pos = items.indexOf('-bm');

  if (pos >= 0) {
    matParams.bumpScale = parseFloat(items[pos + 1]);
    splice(items, pos, 2);
  }

  pos = items.indexOf('-s');

  if (pos >= 0) {
    texParams["scale"]!.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));
    splice(items, pos, 4); // we expect 3 parameters here!

  }

  pos = items.indexOf('-o');

  if (pos >= 0) {
    texParams["offset"]!.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));
    splice(items, pos, 4); // we expect 3 parameters here!

  }

  texParams["url"] = items.join(' ').trim();
  return texParams;
}