Capítulo 433 de 859

Chapter 433: MathNode

Core Idea

This node represents a variety of mathematical methods available in shaders. They are divided into three categories:

  • Methods with one input like sin, cos or normalize.
  • Methods with two inputs like dot, cross or pow.
  • Methods with three inputs like mix, clamp or smoothstep.

Key Concepts

  • aNode : Node: The first input.
  • bNode : Node: The second input.
  • cNode : Node: The third input.
  • isMathNode : boolean (readonly): This flag can be used for type testing.
  • method : string: The method name.

Reference Tables

Constructor

Signature
new MathNode( method : string, aNode : Node, bNode : Node, cNode : Node )

Properties

PropertyDescription
.aNode : NodeThe first input.
.bNode : NodeThe second input.
.cNode : NodeThe third input.
.isMathNode : boolean (readonly)This flag can be used for type testing.
.method : stringThe method name.

Methods

MethodDescription
.generateNodeType( builder : NodeBuilder ) : stringThe selected method as well as the input type determine the node type of this node.
.getInputType( builder : NodeBuilder ) : stringThe input type is inferred from the node types of the input nodes.

Key Takeaways

  1. MathNode extends: EventDispatcher → Node → TempNode
  2. Most relevant properties: aNode, bNode, cNode, isMathNode.
  3. Key methods: generateNodeType, getInputType.

Connects To