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

TSL: Fix `positionView` sub-build (#32691)

sunag 1 месяц назад
Родитель
Сommit
19c76f8c74
3 измененных файлов с 5 добавлено и 5 удалено
  1. 2 2
      src/materials/nodes/NodeMaterial.js
  2. 2 2
      src/nodes/accessors/Position.js
  3. 1 1
      src/nodes/core/VaryingNode.js

+ 2 - 2
src/materials/nodes/NodeMaterial.js

@@ -535,9 +535,9 @@ class NodeMaterial extends Material {
 
 
 		builder.addStack();
 		builder.addStack();
 
 
-		const mvp = subBuild( this.setupVertex( builder ), 'VERTEX' );
+		const mvp = this.setupVertex( builder );
 
 
-		const vertexNode = this.vertexNode || mvp;
+		const vertexNode = subBuild( this.vertexNode || mvp, 'VERTEX' );
 
 
 		builder.context.clipSpace = vertexNode;
 		builder.context.clipSpace = vertexNode;
 
 

+ 2 - 2
src/nodes/accessors/Position.js

@@ -67,7 +67,7 @@ export const positionWorld = /*@__PURE__*/ ( Fn( ( builder ) => {
 
 
 	return modelWorldMatrix.mul( positionLocal ).xyz.toVarying( builder.getSubBuildProperty( 'v_positionWorld' ) );
 	return modelWorldMatrix.mul( positionLocal ).xyz.toVarying( builder.getSubBuildProperty( 'v_positionWorld' ) );
 
 
-}, 'vec3' ).once( [ 'POSITION' ] ) )();
+}, 'vec3' ).once( [ 'POSITION', 'VERTEX' ] ) )();
 
 
 /**
 /**
  * TSL object that represents the position world direction of the current rendered object.
  * TSL object that represents the position world direction of the current rendered object.
@@ -103,7 +103,7 @@ export const positionView = /*@__PURE__*/ ( Fn( ( builder ) => {
 
 
 	return builder.context.setupPositionView().toVarying( 'v_positionView' );
 	return builder.context.setupPositionView().toVarying( 'v_positionView' );
 
 
-}, 'vec3' ).once( [ 'POSITION' ] ) )();
+}, 'vec3' ).once( [ 'POSITION', 'VERTEX' ] ) )();
 
 
 /**
 /**
  * TSL object that represents the position view direction of the current rendered object.
  * TSL object that represents the position view direction of the current rendered object.

+ 1 - 1
src/nodes/core/VaryingNode.js

@@ -36,7 +36,7 @@ class VaryingNode extends Node {
 		 *
 		 *
 		 * @type {Node}
 		 * @type {Node}
 		 */
 		 */
-		this.node = node;
+		this.node = subBuild( node, 'VERTEX' );
 
 
 		/**
 		/**
 		 * The name of the varying in the shader. If no name is defined,
 		 * The name of the varying in the shader. If no name is defined,

粤ICP备19079148号