ShaderNodeObject function

dynamic ShaderNodeObject(
  1. dynamic obj
)

Implementation

ShaderNodeObject(obj) {
  if (obj is num) {
    return ShaderNodeObject(new FloatNode(obj).setConst(true));

  } else if (obj is Node) {

    var nodeObject = nodeObjects.get(obj);

    if (nodeObject == undefined) {
      nodeObject = Proxy( obj, NodeHandler );
      nodeObjects.set(obj, nodeObject);
    }

    return nodeObject;

  }

  return obj;
}