Capítulo 508 de 859

Chapter 508: VaryingNode

Core Idea

Class for representing shader varyings as nodes. Varyings are create from existing nodes like the following:

Key Concepts

  • global : boolean: This flag is used for global cache.
  • interpolationSampling : string: The interpolation sampling type of varying data.
  • interpolationType : string: The interpolation type of the varying data.
  • isVaryingNode : boolean (readonly): This flag can be used for type testing.
  • name : string: The name of the varying in the shader. If no name is defined, the node system auto-generates one.
  • node : Node: The node for which a varying should be created.

Code Examples

const positionLocal = positionGeometry.toVarying( 'vPositionLocal' );
  • What it demonstrates: Typical usage of VaryingNode.

Reference Tables

Constructor

Signature
new VaryingNode( node : Node, name : string )

Properties

PropertyDescription
.global : booleanThis flag is used for global cache.
.interpolationSampling : stringThe interpolation sampling type of varying data.
.interpolationType : stringThe interpolation type of the varying data.
.isVaryingNode : boolean (readonly)This flag can be used for type testing.
.name : stringThe name of the varying in the shader. If no name is defined, the node system auto-generates one.
.node : NodeThe node for which a varying should be created.

Methods

MethodDescription
.setInterpolation( type : string, sampling : string ) : VaryingNodeDefines the interpolation type of the varying.
.setupVarying( builder : NodeBuilder ) : NodeVaryingThis method performs the setup of a varying node with the current node builder.

Key Takeaways

  1. VaryingNode extends: EventDispatcher → Node
  2. Most relevant properties: global, interpolationSampling, interpolationType, isVaryingNode.
  3. Key methods: setInterpolation, setupVarying.

Connects To