extendTexture method

Texture extendTexture(
  1. Texture texture,
  2. Map<String, dynamic> transform
)

Implementation

Texture extendTexture(Texture texture, Map<String,dynamic> transform) {
  texture = texture.clone();

  if (transform.containsKey("offset")) {
    final offset = (transform["offset"] as List?)?.map((item) => item as double).toList();
    if (offset != null) {
      texture.offset.copyFromArray(offset);
    }
  }

  if (transform.containsKey("rotation")) {
    texture.rotation = transform["rotation"];
  }

  if (transform.containsKey("scale")) {
    final scale = (transform["scale"] as List?)?.map((item) => item as double).toList();
    if (scale != null) {
      texture.repeat.copyFromArray(scale);
    }
  }

  if (transform.containsKey("texCoord")) {
    console.warning('GLTFLoader: Custom UV sets in $name extension not yet supported.');
  }

  texture.needsUpdate = true;

  return texture;
}