setNodeType method

dynamic setNodeType(
  1. dynamic inputType
)

Implementation

setNodeType(inputType) {
  var node = null;
  var nodeType = inputType;

  if (nodeType == 'float') {
    node = new FloatNode();
  } else if (nodeType == 'vec2') {
    node = new Vector2Node(null);
  } else if (nodeType == 'vec3') {
    node = new Vector3Node(null);
  } else if (nodeType == 'vec4') {
    node = new Vector4Node(null);
  } else if (nodeType == 'color') {
    node = new ColorNode(null);
    nodeType = 'vec3';
  } else if (nodeType == 'texture') {
    node = new TextureNode();
    nodeType = 'vec4';
  }

  this.node = node;
  this.nodeType = nodeType;
  this.inputType = inputType;
}