getCodeFromNode method

dynamic getCodeFromNode(
  1. dynamic node,
  2. dynamic type, [
  3. dynamic shaderStage
])

Implementation

getCodeFromNode(node, type, [shaderStage]) {
  shaderStage = shaderStage ?? this.shaderStage;

  var nodeData = this.getDataFromNode(node);

  var nodeCode = nodeData.code;

  if (nodeCode == undefined) {
    var codes = this.codes[shaderStage];
    var index = codes.length;

    nodeCode = new NodeCode('nodeCode' + index, type);

    codes.add(nodeCode);

    nodeData.code = nodeCode;
  }

  return nodeCode;
}