Capítulo 468 de 859

Chapter 468: RTTNode

Core Idea

RTTNode takes another node and uses it with a QuadMesh to render into a texture (RTT). This module is especially relevant in context of post processing where certain nodes require texture input for their effects. With the helper function convertToTexture() which is based on this module, the node system can automatically ensure texture input if required.

Key Concepts

  • autoResize : boolean (readonly): Whether the internal render target should automatically be resized or not.
  • autoUpdate : boolean: Whether the texture should automatically be updated or not.
  • height : number: The height of the internal render target.
  • isRTTNode : boolean (readonly): This flag can be used for type testing.
  • node : Node: The node to render a texture with.
  • renderTarget : RenderTarget: The render target
  • textureNeedsUpdate : boolean: Whether the texture requires an update or not.
  • updateBeforeType : string: The updateBeforeType is set to NodeUpdateType.RENDER since the node updates the texture once per render in its [RTTNode#updateBefore](R…
  • width : number: The width of the internal render target. If not width is applied, the render target is automatically resized.

Reference Tables

Constructor

Signature
new RTTNode( node : Node, width : number, height : number, options : Object )

Properties

PropertyDescription
.autoResize : boolean (readonly)Whether the internal render target should automatically be resized or not.
.autoUpdate : booleanWhether the texture should automatically be updated or not.
.height : numberThe height of the internal render target.
.isRTTNode : boolean (readonly)This flag can be used for type testing.
.node : NodeThe node to render a texture with.
.renderTarget : RenderTargetThe render target
.textureNeedsUpdate : booleanWhether the texture requires an update or not.
.updateBeforeType : stringThe updateBeforeType is set to NodeUpdateType.RENDER since the node updates the texture once per render in its RTTNode#updateBefore method.
.width : numberThe width of the internal render target. If not width is applied, the render target is automatically resized.

Methods

MethodDescription
.getResolutionScale() : numberGets the resolution scale.
.setResolutionScale( resolutionScale : number ) : RTTNodeSets the resolution scale. The resolution scale is a factor that is multiplied with the renderer's width and height.
.setSize( width : number, height : number )Sets the size of the internal render target

Key Takeaways

  1. RTTNode extends: EventDispatcher → Node → InputNode → UniformNode → TextureNode
  2. Most relevant properties: autoResize, autoUpdate, height, isRTTNode.
  3. Key methods: getResolutionScale, setResolutionScale, setSize.

Connects To

  • EventDispatcher: parent class
  • Node: parent class
  • InputNode: parent class
  • UniformNode: parent class
  • TextureNode: parent class
  • Source: src/nodes/utils/RTTNode.js