- Since: 3.0.0
- Source: src/renderer/webgl/Utils.js (Line 36)
Methods
-
<static> checkShaderMax(gl, maxTextures)
-
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.
- Since: 3.50.0
- Source: src/renderer/webgl/Utils.js (Line 126)
Returns:
The number of texture units that is supported by this browser and GPU.
- Type
- number
-
<static> getFloatsFromUintRGB(rgb)
-
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
- Since: 3.0.0
- Source: src/renderer/webgl/Utils.js (Line 107)
Returns:
Array of floats representing each component as a float
- Type
- array
-
<static> getTintAppendFloatAlpha(rgb, a)
-
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
- Since: 3.0.0
- Source: src/renderer/webgl/Utils.js (Line 65)
Returns:
Packed RGBA as Uint32
- Type
- number
-
<static> getTintAppendFloatAlphaAndSwap(rgb, a)
-
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
- Since: 3.0.0
- Source: src/renderer/webgl/Utils.js (Line 84)
Returns:
Packed RGBA as Uint32
- Type
- number
-
<static> getTintFromFloats(r, g, b, a)
-
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
- Since: 3.0.0
- Source: src/renderer/webgl/Utils.js (Line 42)
Returns:
The packed RGBA values as a Uint32.
- Type
- number
-
<static> parseFragmentShaderMaxTextures(fragmentShaderSource, maxTextures)
-
Checks the given Fragment Shader Source for
%count%
and%forloop%
declarations and replaces those with GLSL code for settingtexture = 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.
- Since: 3.50.0
- Source: src/renderer/webgl/Utils.js (Line 178)
Returns:
The modified Fragment Shader source.
- Type
- string