|
@@ -1,7 +1,7 @@
|
|
import Node, { addNodeClass } from '../core/Node.js';
|
|
import Node, { addNodeClass } from '../core/Node.js';
|
|
import { expression } from '../code/ExpressionNode.js';
|
|
import { expression } from '../code/ExpressionNode.js';
|
|
import { bypass } from '../core/BypassNode.js';
|
|
import { bypass } from '../core/BypassNode.js';
|
|
-import { context as contextNode } from '../core/ContextNode.js';
|
|
|
|
|
|
+import { context } from '../core/ContextNode.js';
|
|
import { addNodeElement, nodeObject, nodeArray } from '../shadernode/ShaderNode.js';
|
|
import { addNodeElement, nodeObject, nodeArray } from '../shadernode/ShaderNode.js';
|
|
|
|
|
|
class LoopNode extends Node {
|
|
class LoopNode extends Node {
|
|
@@ -65,13 +65,11 @@ class LoopNode extends Node {
|
|
|
|
|
|
const properties = this.getProperties( builder );
|
|
const properties = this.getProperties( builder );
|
|
|
|
|
|
- const context = { tempWrite: false };
|
|
|
|
|
|
+ const contextData = { tempWrite: false };
|
|
|
|
|
|
const params = this.params;
|
|
const params = this.params;
|
|
const stackNode = properties.stackNode;
|
|
const stackNode = properties.stackNode;
|
|
|
|
|
|
- const returnsSnippet = properties.returnsNode ? properties.returnsNode.build( builder ) : '';
|
|
|
|
-
|
|
|
|
for ( let i = 0, l = params.length - 1; i < l; i ++ ) {
|
|
for ( let i = 0, l = params.length - 1; i < l; i ++ ) {
|
|
|
|
|
|
const param = params[ i ];
|
|
const param = params[ i ];
|
|
@@ -82,7 +80,7 @@ class LoopNode extends Node {
|
|
if ( param.isNode ) {
|
|
if ( param.isNode ) {
|
|
|
|
|
|
start = '0';
|
|
start = '0';
|
|
- end = param.generate( builder, 'int' );
|
|
|
|
|
|
+ end = param.build( builder, 'int' );
|
|
direction = 'forward';
|
|
direction = 'forward';
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -92,10 +90,10 @@ class LoopNode extends Node {
|
|
direction = param.direction;
|
|
direction = param.direction;
|
|
|
|
|
|
if ( typeof start === 'number' ) start = start.toString();
|
|
if ( typeof start === 'number' ) start = start.toString();
|
|
- else if ( start && start.isNode ) start = start.generate( builder, 'int' );
|
|
|
|
|
|
+ else if ( start && start.isNode ) start = start.build( builder, 'int' );
|
|
|
|
|
|
if ( typeof end === 'number' ) end = end.toString();
|
|
if ( typeof end === 'number' ) end = end.toString();
|
|
- else if ( end && end.isNode ) end = end.generate( builder, 'int' );
|
|
|
|
|
|
+ else if ( end && end.isNode ) end = end.build( builder, 'int' );
|
|
|
|
|
|
if ( start !== undefined && end === undefined ) {
|
|
if ( start !== undefined && end === undefined ) {
|
|
|
|
|
|
@@ -159,7 +157,9 @@ class LoopNode extends Node {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- const stackSnippet = contextNode( stackNode, context ).build( builder, 'void' );
|
|
|
|
|
|
+ const stackSnippet = context( stackNode, contextData ).build( builder, 'void' );
|
|
|
|
+
|
|
|
|
+ const returnsSnippet = properties.returnsNode ? properties.returnsNode.build( builder ) : '';
|
|
|
|
|
|
builder.removeFlowTab().addFlowCode( '\n' + builder.tab + stackSnippet );
|
|
builder.removeFlowTab().addFlowCode( '\n' + builder.tab + stackSnippet );
|
|
|
|
|