parseTexture method

dynamic parseTexture(
  1. dynamic textureNode,
  2. dynamic images
)

Implementation

parseTexture(textureNode, images) async {
  var texture = await this.loadTexture(textureNode, images);

  texture.id = textureNode["id"];

  texture.name = textureNode["attrName"];

  var wrapModeU = textureNode["WrapModeU"];
  var wrapModeV = textureNode["WrapModeV"];

  var valueU = wrapModeU != null ? wrapModeU.value : 0;
  var valueV = wrapModeV != null ? wrapModeV.value : 0;

  // http://download.autodesk.com/us/fbx/SDKdocs/FBX_SDK_Help/files/fbxsdkref/class_k_fbx_texture.html#889640e63e2e681259ea81061b85143a
  // 0: repeat(default), 1: clamp

  texture.wrapS = valueU == 0 ? RepeatWrapping : ClampToEdgeWrapping;
  texture.wrapT = valueV == 0 ? RepeatWrapping : ClampToEdgeWrapping;

  if (textureNode["Scaling"] != null) {
    var values = textureNode["Scaling"].value;

    texture.repeat.x = values[0];
    texture.repeat.y = values[1];
  }

  return texture;
}