|
|
@@ -259,6 +259,13 @@ class NodeBuilder {
|
|
|
*/
|
|
|
this.structs = { vertex: [], fragment: [], compute: [], index: 0 };
|
|
|
|
|
|
+ /**
|
|
|
+ * This dictionary holds the types of the builder.
|
|
|
+ *
|
|
|
+ * @type {Object}
|
|
|
+ */
|
|
|
+ this.types = { vertex: [], fragment: [], compute: [], index: 0 };
|
|
|
+
|
|
|
/**
|
|
|
* This dictionary holds the bindings for each shader stage.
|
|
|
*
|
|
|
@@ -1680,6 +1687,20 @@ class NodeBuilder {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Returns an instance of {@link StructType} for the given struct name and shader stage
|
|
|
+ * or null if not found.
|
|
|
+ *
|
|
|
+ * @param {string} name - The name of the struct.
|
|
|
+ * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage.
|
|
|
+ * @return {?StructType} The struct type or null if not found.
|
|
|
+ */
|
|
|
+ getStructTypeNode( name, shaderStage = this.shaderStage ) {
|
|
|
+
|
|
|
+ return this.types[ shaderStage ][ name ] || null;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Returns an instance of {@link StructType} for the given output struct node.
|
|
|
*
|
|
|
@@ -1704,6 +1725,7 @@ class NodeBuilder {
|
|
|
structType = new StructType( name, membersLayout );
|
|
|
|
|
|
this.structs[ shaderStage ].push( structType );
|
|
|
+ this.types[ shaderStage ][ name ] = node;
|
|
|
|
|
|
nodeData.structType = structType;
|
|
|
|