- 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 glWebGLRenderingContext The WebGLContext used to create the shaders.
maxTexturesnumber 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 rgbnumber 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 rgbnumber Uint24 representing RGB components
anumber 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 rgbnumber Uint24 representing RGB components
anumber 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 rnumber Red component in a range from 0.0 to 1.0
gnumber Green component in a range from 0.0 to 1.0
bnumber Blue component in a range from 0.0 to 1.0
anumber 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 fragmentShaderSourcestring The Fragment Shader source code to operate on.
maxTexturesnumber 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
