Skip to main content
Version: Phaser v4.0.0-rc.6

RenderNodeManager

RenderNodeManager

Constructor

new RenderNodeManager(renderer)

Parameters

nametypeoptionaldescription
rendererPhaser.Renderer.WebGL.WebGLRendererNoThe renderer that owns this manager.

Scope: static

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L78
Since: 4.0.0

Public Members

currentBatchDrawingContext

currentBatchDrawingContext: Phaser.Renderer.WebGL.DrawingContext

Description:

The drawing context of the current batch.

This is stored here because the batch node is stateless.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L217
Since: 4.0.0


currentBatchNode

currentBatchNode: Phaser.Renderer.WebGL.RenderNodes.RenderNode

Description:

The RenderNode which is currently being filled.

This is stored so that it can be completed when another type of

render is run.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L205
Since: 4.0.0


currentDebugNode

currentDebugNode: DebugGraphNode

Description:

The current node in the debug graph.

This is used when debug is enabled.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L248


debug

debug: boolean

Description:

Whether nodes should record their run method for debugging.

This should be set via setDebug.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L228
Since: 4.0.0


debugGraph

debugGraph: DebugGraphNode

Description:

The debug graph of nodes that have been run.

This is used when debug is enabled.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L239


maxParallelTextureUnits

maxParallelTextureUnits: number

Description:

The maximum number of texture units to use as choices in a batch.

Batches can bind several textures and select one of them per instance,

allowing for larger batches.

However, some mobile devices degrade performance when using multiple

texture units. So if the game config option autoMobileTextures is

enabled and the device is not a desktop, this will be set to 1.

Otherwise, it will be set to the renderer's maxTextures.

Some shaders may require more than one texture unit,

so the actual limit on texture units per batch is maxTextures.

This value can be changed at runtime via setMaxParallelTextureUnits.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L96
Since: 4.0.0


renderer

renderer: Phaser.Renderer.WebGL.WebGLRenderer

Description:

The renderer that owns this manager.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L85
Since: 4.0.0


Public Methods

addNode

<instance> addNode(name, node)

Description:

Add a node to the manager.

Parameters:

nametypeoptionaldescription
namestringNoThe name of the node.
nodePhaser.Renderer.WebGL.RenderNodes.RenderNodeNoThe node to add.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L259
Since: 4.0.0


addNodeConstructor

<instance> addNodeConstructor(name, constructor)

Description:

Add a constructor for a node to the manager.

This will allow the node to be constructed when getNode is called.

Parameters:

nametypeoptionaldescription
namestringNoThe name of the node.
constructorfunctionNoThe constructor for the node.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L284
Since: 4.0.0


debugToString

<instance> debugToString()

Description:

Format the current debug graph as an indented string.

Returns: string - The formatted debug graph.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L512
Since: 4.0.0


finishBatch

<instance> finishBatch()

Description:

Finish rendering the current batch.

This should be called when starting a new rendering task.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L393
Since: 4.0.0


getNode

<instance> getNode(name)

Description:

Get a node from the manager.

If the node does not exist, and a constructor is available,

it will be constructed and added to the manager,

then returned.

Parameters:

nametypeoptionaldescription
namestringNoThe name of the node.

Returns: Phaser.Renderer.WebGL.RenderNodes.RenderNode - The node, or null if it does not exist.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L303
Since: 4.0.0


hasNode

<instance> hasNode(name, [constructed])

Description:

Check if a node exists in the manager.

If a node is not constructed, but a constructor is available,

it will be considered to exist. Set constructed to true to

require that the node has already been constructed.

Parameters:

nametypeoptionaldefaultdescription
namestringNoThe name of the node.
constructedbooleanYesfalseWhether the node must be constructed to be considered to exist.

Returns: boolean - Whether the node exists.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L330
Since: 4.0.0


popDebug

<instance> popDebug()

Description:

Pop the last recorded RenderNode from the debug graph.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L489
Since: 4.0.0


pushDebug

<instance> pushDebug(name)

Description:

Record a newly run RenderNode in the debug graph.

Parameters:

nametypeoptionaldescription
namestringNoThe name of the node.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L457
Since: 4.0.0


setCurrentBatchNode

<instance> setCurrentBatchNode(node, [drawingContext])

Description:

Set the current batch node. If a batch node is already in progress,

it will be completed before the new node is set.

Parameters:

nametypeoptionaldescription
nodePhaser.Renderer.WebGL.RenderNodes.BatchHandlerNoThe node to set, or null to clear the current node.
drawingContextPhaser.Renderer.WebGL.DrawingContextYesThe drawing context. Only used if node is defined.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L348
Since: 4.0.0


setDebug

<instance> setDebug(value)

Description:

Set whether nodes should record their run method for debugging.

This will set the debug property on all nodes, reset the debug graph,

and record a single frame of the graph before disabling debug.

Parameters:

nametypeoptionaldescription
valuebooleanNoWhether nodes should record their run method for debugging.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L420
Since: 4.0.0


setMaxParallelTextureUnits

<instance> setMaxParallelTextureUnits([value])

Description:

Set maxParallelTextureUnits to a new value.

This will be clamped to the range [1, renderer.maxTextures].

This can be useful for providing the user with a way to adjust the

performance of the game at runtime.

Parameters:

nametypeoptionaldescription
valuenumberYesThe new value for maxParallelTextureUnits. If not provided, it will be set to the renderer's maxTextures.

Fires: Phaser.Renderer.Events#event:SET_PARALLEL_TEXTURE_UNITS

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L374
Since: 4.0.0


startStandAloneRender

<instance> startStandAloneRender()

Description:

Start a standalone render (SAR), which is not part of a batch.

This will trigger batch completion if a batch is in progress.

Source: src/renderer/webgl/renderNodes/RenderNodeManager.js#L408
Since: 4.0.0