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

TSL: Add `vertexStage()` function (#30173)

* add vertexStage

* remove TODO

* Update TSLBase.js
sunag 1 год назад
Родитель
Сommit
3d26186925
2 измененных файлов с 11 добавлено и 1 удалено
  1. 10 0
      src/nodes/core/VaryingNode.js
  2. 1 1
      src/nodes/tsl/TSLBase.js

+ 10 - 0
src/nodes/core/VaryingNode.js

@@ -176,4 +176,14 @@ export default VaryingNode;
  */
 export const varying = /*@__PURE__*/ nodeProxy( VaryingNode );
 
+/**
+ * Computes a node in the vertex stage.
+ *
+ * @function
+ * @param {Node} node - The node which should be executed in the vertex stage.
+ * @returns {VaryingNode}
+ */
+export const vertexStage = ( node ) => varying( node );
+
 addMethodChaining( 'varying', varying );
+addMethodChaining( 'vertexStage', vertexStage );

+ 1 - 1
src/nodes/tsl/TSLBase.js

@@ -11,7 +11,7 @@ export * from '../math/MathNode.js'; // abs(), floor(), ...
 export * from '../math/ConditionalNode.js'; // select(), ...
 export * from '../core/ContextNode.js'; // .context()
 export * from '../core/VarNode.js'; // .var() -> TODO: Maybe rename .toVar() -> .var()
-export * from '../core/VaryingNode.js'; // varying() -> TODO: Add vertexStage()
+export * from '../core/VaryingNode.js'; // varying(), vertexStage()
 export * from '../display/ColorSpaceNode.js'; // .toColorSpace()
 export * from '../display/ToneMappingNode.js'; // .toToneMapping()
 export * from '../accessors/BufferAttributeNode.js'; // .toAttribute()

粤ICP备19079148号