Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Utils
Phaser.Renderer.WebGL.Utils

Methods

<static> getTintFromFloats(r, g, b, a)
Focus
Focus

Description:

Packs four floats on a range from 0.0 to 1.0 into a single Uint32

Parameters:

name type description
r number

Red component in a range from 0.0 to 1.0

g number

Green component in a range from 0.0 to 1.0

b number

Blue component in a range from 0.0 to 1.0

a number

Alpha component in a range from 0.0 to 1.0

Returns:
Description:

The packed RGBA values as a Uint32.

Type:
  • number
Examples:
Since: 3.0.0
Focus
Focus
<static> getTintAppendFloatAlpha(rgb, a)
Focus
Focus

Description:

Packs a Uint24, representing RGB components, with a Float32, representing the alpha component, with a range between 0.0 and 1.0 and return a Uint32

Parameters:

name type description
rgb number

Uint24 representing RGB components

a number

Float32 representing Alpha component

Returns:
Description:

Packed RGBA as Uint32

Type:
  • number
Examples:
Since: 3.0.0
Focus
Focus
<static> getTintAppendFloatAlphaAndSwap(rgb, a)
Focus
Focus

Description:

Packs a Uint24, representing RGB components, with a Float32, representing the alpha component, with a range between 0.0 and 1.0 and return a swizzled Uint32

Parameters:

name type description
rgb number

Uint24 representing RGB components

a number

Float32 representing Alpha component

Returns:
Description:

Packed RGBA as Uint32

Type:
  • number
Examples:
Since: 3.0.0
Focus
Focus
<static> getFloatsFromUintRGB(rgb)
Focus
Focus

Description:

Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0

Parameters:

name type description
rgb number

RGB packed as a Uint24

Returns:
Description:

Array of floats representing each component as a float

Type:
  • array
Examples:
Since: 3.0.0
Focus
Focus
<static> checkShaderMax(gl, maxTextures)
Focus
Focus

Description:

Check to see how many texture units the GPU supports, based on the given config value. Then tests this against the maximum number of iterations GLSL can support.

Parameters:

name type description
gl WebGLRenderingContext

The WebGLContext used to create the shaders.

maxTextures number

The Game Config maxTextures value.

Returns:
Description:

The number of texture units that is supported by this browser and GPU.

Type:
  • number
Examples:
Since: 3.50.0
Focus
Focus
<static> parseFragmentShaderMaxTextures(fragmentShaderSource, maxTextures)
Focus
Focus

Description:

Checks the given Fragment Shader Source for %count% and %forloop% declarations and replaces those with GLSL code for setting texture = texture2D(uMainSampler[i], outTexCoord).

Parameters:

name type description
fragmentShaderSource string

The Fragment Shader source code to operate on.

maxTextures number

The number of maxTextures value.

Returns:
Description:

The modified Fragment Shader source.

Type:
  • string
Examples:
Since: 3.50.0
Focus
Focus