Просмотр исходного кода

TSL: Fixing invalid GLSL using nested structures (#32724)

sunag 4 дней назад
Родитель
Сommit
ac6cc5483b
1 измененных файлов с 15 добавлено и 0 удалено
  1. 15 0
      src/nodes/core/StructNode.js

+ 15 - 0
src/nodes/core/StructNode.js

@@ -52,6 +52,21 @@ class StructNode extends Node {
 
 
 	}
 	}
 
 
+	_getChildren() {
+
+		// Ensure struct type is the last child for correct code generation order
+
+		const children = super._getChildren();
+
+		const structTypeProperty = children.find( child => child.childNode === this.structTypeNode );
+
+		children.splice( children.indexOf( structTypeProperty ), 1 );
+		children.push( structTypeProperty );
+
+		return children;
+
+	}
+
 	generate( builder ) {
 	generate( builder ) {
 
 
 		const nodeVar = builder.getVarFromNode( this );
 		const nodeVar = builder.getVarFromNode( this );

粤ICP备19079148号