The currently active WebGLBuffer.
The currently active WebGLTextures, used as part of the batch process.
Reset to empty as part of the bind method.
Treat this array as read-only.
The temporary Pipeline batch. This array contains the batch entries for the current frame, which is a package of textures and vertex offsets used for drawing. This package is built dynamically as the frame is built and cleared during the flush method.
Treat this array and all of its contents as read-only.
Uint8 view to the vertexData
ArrayBuffer. Used for uploading vertex buffer resources to the GPU.
A Color Matrix instance belonging to this pipeline.
Used during calls to the drawFrame
method.
The configuration object that was used to create this pipeline.
Treat this object as 'read only', because changing it post-creation will not impact this pipeline in any way. However, it is used internally for cloning and post-boot set-up.
If this Post Pipeline belongs to an FX Controller, this is a reference to it.
The most recently created Pipeline batch entry.
Reset to null as part of the flush method.
Treat this value as read-only.
A reference to the currently bound Render Target instance from the WebGLPipeline.renderTargets
array.
A reference to the currently bound WebGLShader instance from the WebGLPipeline.shaders
array.
For lots of pipelines, this is the only shader, so it is a quick way to reference it without an array look-up.
The most recently bound texture, used as part of the batch process.
Reset to null as part of the flush method.
Treat this value as read-only.
Holds the most recently assigned texture unit.
Treat this value as read-only.
Some pipelines require the forced use of texture zero (like the light pipeline).
This property should be set when that is the case.
A reference to the Full Frame 1 Render Target that belongs to the
Utility Pipeline. This property is set during the boot
method.
This Render Target is the full size of the renderer.
You can use this directly in Post FX Pipelines for multi-target effects. However, be aware that these targets are shared between all post fx pipelines.
A reference to the Full Frame 2 Render Target that belongs to the
Utility Pipeline. This property is set during the boot
method.
This Render Target is the full size of the renderer.
You can use this directly in Post FX Pipelines for multi-target effects. However, be aware that these targets are shared between all post fx pipelines.
The Phaser Game instance to which this pipeline is bound.
If this Post Pipeline belongs to a Game Object or Camera, this property contains a reference to it.
The WebGL context this WebGL Pipeline uses.
Has the GL Context been reset to the Phaser defaults since the last time this pipeline was bound? This is set automatically when the Pipeline Manager resets itself, usually after handing off to a 3rd party renderer like Spine.
You should treat this property as read-only.
A reference to the Half Frame 1 Render Target that belongs to the
Utility Pipeline. This property is set during the boot
method.
This Render Target is half the size of the renderer.
You can use this directly in Post FX Pipelines for multi-target effects. However, be aware that these targets are shared between all post fx pipelines.
A reference to the Half Frame 2 Render Target that belongs to the
Utility Pipeline. This property is set during the boot
method.
This Render Target is half the size of the renderer.
You can use this directly in Post FX Pipelines for multi-target effects. However, be aware that these targets are shared between all post fx pipelines.
Readonly
hasIndicates if this pipeline has booted or not.
A pipeline boots only when the Game instance itself, and all associated systems, is fully ready.
Height of the current viewport.
Readonly
isIndicates if this is a Post FX Pipeline, or not.
Readonly
isIndicates if this is a Pre FX Pipeline, or not.
A reference to the WebGL Pipeline Manager.
This is initially undefined and only set when this pipeline is added to the manager.
Name of the pipeline. Used for identification and setting from Game Objects.
The cached height of the Projection matrix.
The Projection matrix, used by shaders as 'uProjectionMatrix' uniform.
The cached width of the Projection matrix.
An array of RenderTarget instances that belong to this pipeline.
The WebGL Renderer instance to which this pipeline is bound.
If the WebGL Renderer changes size, this uniform will be set with the new width and height values
as part of the pipeline resize method. Various built-in pipelines, such as the MultiPipeline, set
this property automatically to uResolution
.
An array of all the WebGLShader instances that belong to this pipeline.
Shaders manage their own attributes and uniforms, but share the same vertex data buffer, which belongs to this pipeline.
Shaders are set in a call to the setShadersFromConfig
method, which happens automatically,
but can also be called at any point in your game. See the method documentation for details.
The primitive topology which the pipeline will use to submit draw calls.
Defaults to GL_TRIANGLES if not otherwise set in the config.
Readonly
vertexThe WebGLBuffer that holds the vertex data.
Created from the vertexData
ArrayBuffer. If vertices
are set in the config, a STATIC_DRAW
buffer
is created. If not, a DYNAMIC_DRAW
buffer is created.
The total number of vertices that this pipeline batch can hold before it will flush.
This defaults to renderer batchSize * 6
, where batchSize
is defined in the Renderer Game Config.
The current number of vertices that have been added to the pipeline batch.
Readonly
vertexRaw byte buffer of vertices.
Either set via the config object vertices
property, or generates a new Array Buffer of
size vertexCapacity * vertexSize
.
Float32 view of the array buffer containing the pipeline's vertices.
Uint32 view of the array buffer containing the pipeline's vertices.
The canvas which this WebGL Pipeline renders to.
Width of the current viewport.
Adds the vertices data into the batch and flushes if full.
Assumes 6 vertices in the following arrangement:
0----3
|\ B|
| \ |
| \ |
| A \|
| \
1----2
Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3
The Game Object, if any, drawing this quad.
The top-left x position.
The top-left y position.
The bottom-left x position.
The bottom-left y position.
The bottom-right x position.
The bottom-right y position.
The top-right x position.
The top-right y position.
UV u0 value.
UV v0 value.
UV u1 value.
UV v1 value.
The top-left tint color value.
The top-right tint color value.
The bottom-left tint color value.
The bottom-right tint color value.
The tint effect for the shader to use.
Optional
texture: WebGLTextureWrapperTexture that will be assigned to the current batch if a flush occurs.
Optional
unit: numberTexture unit to which the texture needs to be bound. Default 0.
Adds the vertices data into the batch and flushes if full.
Assumes 3 vertices in the following arrangement:
0
|\
| \
| \
| \
| \
1-----2
The Game Object, if any, drawing this quad.
The bottom-left x position.
The bottom-left y position.
The bottom-right x position.
The bottom-right y position.
The top-right x position.
The top-right y position.
UV u0 value.
UV v0 value.
UV u1 value.
UV v1 value.
The top-left tint color value.
The top-right tint color value.
The bottom-left tint color value.
The tint effect for the shader to use.
Optional
texture: WebGLTextureWrapperTexture that will be assigned to the current batch if a flush occurs.
Optional
unit: numberTexture unit to which the texture needs to be bound. Default 0.
Adds a single vertex to the current vertex buffer and increments the
vertexCount
property by 1.
This method is called directly by batchTri
and batchQuad
.
It does not perform any batch limit checking itself, so if you need to call
this method directly, do so in the same way that batchQuad
does, for example.
The vertex x position.
The vertex y position.
UV u value.
UV v value.
Texture unit to which the texture needs to be bound.
The tint effect for the shader to use.
The tint color value.
This method is called every time the Pipeline Manager makes this pipeline the currently active one.
It binds the resources and shader needed for this pipeline, including setting the vertex buffer and attribute pointers.
Optional
currentShader: WebGLShaderThe shader to set as being current.
Binds this pipeline and draws the source
Render Target to the target
Render Target.
If no target
is specified, it will pop the framebuffer from the Renderers FBO stack
and use that instead, which should be done when you need to draw the final results of
this pipeline to the game canvas.
You can optionally set the shader to be used for the draw here, if this is a multi-shader
pipeline. By default currentShader
will be used. If you need to set a shader but not
a target, just pass null
as the target
parameter.
The Render Target to draw from.
Optional
target: RenderTargetThe Render Target to draw to. If not set, it will pop the fbo from the stack.
Optional
clear: booleanClear the target before copying? Only used if target
parameter is set. Default true.
Optional
clearAlpha: booleanClear the alpha channel when running gl.clear
on the target? Default true.
Optional
currentShader: WebGLShaderThe shader to use during the draw.
Activates the given Render Target texture and binds it to the requested WebGL texture slot.
Optional
target: RenderTargetThe Render Target to activate and bind.
Optional
unit: numberThe WebGL texture ID to activate. Defaults to gl.TEXTURE0
. Default 0.
Draws the source1
and source2
Render Targets to the target
Render Target
using a linear blend effect, which is controlled by the strength
parameter.
The first source Render Target.
The second source Render Target.
Optional
target: RenderTargetThe target Render Target.
Optional
strength: numberThe strength of the blend. Default 1.
Optional
clearAlpha: booleanClear the alpha channel when running gl.clear
on the target? Default true.
Draws the source1
and source2
Render Targets to the target
Render Target
using an additive blend effect, which is controlled by the strength
parameter.
The first source Render Target.
The second source Render Target.
Optional
target: RenderTargetThe target Render Target.
Optional
strength: numberThe strength of the blend. Default 1.
Optional
clearAlpha: booleanClear the alpha channel when running gl.clear
on the target? Default true.
Copy the source
Render Target to the target
Render Target.
The difference with this copy is that no resizing takes place. If the source
Render Target is larger than the target
then only a portion the same size as
the target
dimensions is copied across.
You can optionally set the brightness factor of the copy.
The source Render Target.
The target Render Target.
Optional
brightness: numberThe brightness value applied to the frame copy. Default 1.
Optional
clear: booleanClear the target before copying? Default true.
Optional
clearAlpha: booleanClear the alpha channel when running gl.clear
on the target? Default true.
Optional
eraseMode: booleanErase source from target using ERASE Blend Mode? Default false.
This method is called once, when this Post FX Pipeline needs to be used.
Normally, pipelines will boot automatically, ready for instant-use, but Post FX Pipelines create quite a lot of internal resources, such as Render Targets, so they don't boot until they are told to do so by the Pipeline Manager, when an actual Game Object needs to use them.
Copy the source
Render Target to the target
Render Target.
You can optionally set the brightness factor of the copy.
The difference between this method and drawFrame
is that this method
uses a faster copy shader, where only the brightness can be modified.
If you need color level manipulation, see drawFrame
instead.
The source Render Target.
Optional
target: RenderTargetThe target Render Target.
Optional
brightness: numberThe brightness value applied to the frame copy. Default 1.
Optional
clear: booleanClear the target before copying? Default true.
Optional
clearAlpha: booleanClear the alpha channel when running gl.clear
on the target? Default true.
Binds the source
Render Target and then copies a section of it to the target
Render Target.
This method is extremely fast because it uses gl.copyTexSubImage2D
and doesn't
require the use of any shaders. Remember the coordinates are given in standard WebGL format,
where x and y specify the lower-left corner of the section, not the top-left. Also, the
copy entirely replaces the contents of the target texture, no 'merging' or 'blending' takes
place.
The source Render Target.
The target Render Target.
The x coordinate of the lower left corner where to start copying.
The y coordinate of the lower left corner where to start copying.
The width of the texture.
The height of the texture.
Optional
clear: booleanClear the target before copying? Default true.
Optional
clearAlpha: booleanClear the alpha channel when running gl.clear
on the target? Default true.
Copy the source
Render Target to the target
Render Target.
This method does not bind a shader. It uses whatever shader is currently bound in this pipeline. It also does not clear the frame buffers after use. You should take care of both of these things if you call this method directly.
The source Render Target.
The target Render Target.
Pops the framebuffer from the renderers FBO stack and sets that as the active target,
then draws the source
Render Target to it. It then resets the renderer textures.
This should be done when you need to draw the final results of a pipeline to the game
canvas, or the next framebuffer in line on the FBO stack. You should only call this once
in the onDraw
handler and it should be the final thing called. Be careful not to call
this if you need to actually use the pipeline shader, instead of the copy shader. In
those cases, use the bindAndDraw
method.
The Render Target to draw from.
Pushes a filled rectangle into the vertex batch.
The dimensions are run through Math.floor
before the quad is generated.
Rectangle has no transform values and isn't transformed into the local space.
Used for directly batching untransformed rectangles, such as Camera background colors.
Horizontal top left coordinate of the rectangle.
Vertical top left coordinate of the rectangle.
Width of the rectangle.
Height of the rectangle.
Color of the rectangle to draw.
Alpha value of the rectangle to draw.
Optional
texture: WebGLTextureWrappertexture that will be assigned to the current batch if a flush occurs.
Optional
flipUV: booleanFlip the vertical UV coordinates of the texture before rendering? Default true.
Copy the source
Render Target to the target
Render Target, using this pipelines
Color Matrix.
The difference between this method and copyFrame
is that this method
uses a color matrix shader, where you have full control over the luminance
values used during the copy. If you don't need this, you can use the faster
copyFrame
method instead.
The source Render Target.
Optional
target: RenderTargetThe target Render Target.
Optional
clearAlpha: booleanClear the alpha channel when running gl.clear
on the target? Default true.
Remove the listeners of a given event.
The event name.
Optional
fn: FunctionOnly remove the listeners that match this function.
Optional
context: anyOnly remove the listeners that have this context.
Optional
once: booleanOnly remove one-time listeners.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called every time the Pipeline Manager makes this the active pipeline. It is called
at the end of the WebGLPipeline.bind
method, after the current shader has been set. The current
shader is passed to this hook.
For example, if a display list has 3 Sprites in it that all use the same pipeline, this hook will only be called for the first one, as the 2nd and 3rd Sprites do not cause the pipeline to be changed.
If you need to listen for that event instead, use the onBind
hook.
The shader that was set as current.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called immediately after this pipeline has finished flushing its batch.
It is called after the gl.drawArrays
call.
You can perform additional post-render effects, but be careful not to call flush
on this pipeline from within this method, or you'll cause an infinite loop.
To apply changes pre-render, see onBeforeFlush
.
Optional
isPostFlush: booleanWas this flush invoked as part of a post-process, or not? Default false.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called every time the batchQuad
or batchTri
methods are called. If this was
as a result of a Game Object, then the Game Object reference is passed to this hook too.
This hook is called after the quad (or tri) has been added to the batch, so you can safely call 'flush' from within this.
Note that Game Objects may call batchQuad
or batchTri
multiple times for a single draw,
for example the Graphics Game Object.
Optional
gameObject: GameObjectThe Game Object that invoked this pipeline, if any.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called every time this pipeline is asked to flush its batch.
It is called immediately before the gl.bufferData
and gl.drawArrays
calls are made, so you can
perform any final pre-render modifications. To apply changes post-render, see onAfterFlush
.
Optional
isPostFlush: booleanWas this flush invoked as part of a post-process, or not? Default false.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called every time a Game Object asks the Pipeline Manager to use this pipeline, even if the pipeline is already active.
Unlike the onActive
method, which is only called when the Pipeline Manager makes this pipeline
active, this hook is called for every Game Object that requests use of this pipeline, allowing you to
perform per-object set-up, such as loading shader uniform data.
Optional
gameObject: GameObjectThe Game Object that invoked this pipeline, if any.
This method is only used by Sprite FX and Post FX Pipelines and those that extend from them.
This method is called every time the postBatch
method is called and is passed a
reference to the current render target.
At the very least a Post FX Pipeline should call this.bindAndDraw(renderTarget)
,
however, you can do as much additional processing as you like in this method if
you override it from within your own pipelines.
The Render Target.
Optional
swapTarget: RenderTargetA Swap Render Target, useful for double-buffer effects. Only set by SpriteFX Pipelines.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called immediately after a Game Object has been added to the batch.
Optional
gameObject: GameObjectThe Game Object that invoked this pipeline, if any.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called once per frame, after all rendering has happened and snapshots have been taken.
It is called at the very end of the rendering process, once all Cameras, for all Scenes, have been rendered.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called immediately before a Game Object is about to add itself to the batch.
Optional
gameObject: GameObjectThe Game Object that invoked this pipeline, if any.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called once per frame, right before anything has been rendered, but after the canvas has been cleared. If this pipeline has a render target, it will also have been cleared by this point.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called when the Pipeline Manager needs to rebind this pipeline. This happens after a pipeline has been cleared, usually when passing control over to a 3rd party WebGL library, like Spine, and then returing to Phaser again.
By default this is an empty method hook that you can override and use in your own custom pipelines.
This method is called once per frame, by every Camera in a Scene that wants to render.
It is called at the start of the rendering process, before anything has been drawn to the Camera.
The Scene being rendered.
The Scene Camera being rendered with.
This method is called once when this pipeline has finished being set-up at the end of the boot process. By the time this method is called, all of the shaders are ready and configured. It's also called if the renderer changes size.
The new width of this WebGL Pipeline.
The new height of this WebGL Pipeline.
This method is called as a result of the WebGLPipeline.batchQuad
method, right after a quad
belonging to a Game Object has been added to the batch. When this is called, the
renderer has just performed a flush.
It calls the onDraw
hook followed by the onPostBatch
hook, which can be used to perform
additional Post FX Pipeline processing.
It is also called as part of the PipelineManager.postBatch
method when processing Post FX Pipelines.
Optional
gameObject: GameObject | CameraThe Game Object or Camera that invoked this pipeline, if any.
This method is called as a result of the WebGLPipeline.batchQuad
method, right before a quad
belonging to a Game Object is about to be added to the batch. When this is called, the
renderer has just performed a flush. It will bind the current render target, if any are set
and finally call the onPreBatch
hook.
It is also called as part of the PipelineManager.preBatch
method when processing Post FX Pipelines.
Optional
gameObject: GameObject | CameraThe Game Object or Camera that invoked this pipeline, if any.
Takes the given WebGLTextureWrapper and determines what to do with it.
If there is no current batch (i.e. after a flush) it will create a new batch from it.
If the texture is already bound, it will return the current texture unit.
If the texture already exists in the current batch, the unit gets reset to match it.
If the texture cannot be found in the current batch, and it supports multiple textures, it's added into the batch and the unit indexes are advanced.
The texture assigned to this batch entry.
Remove the listeners of a given event.
The event name.
Optional
fn: FunctionOnly remove the listeners that match this function.
Optional
context: anyOnly remove the listeners that have this context.
Optional
once: booleanOnly remove one-time listeners.
Sets a 1f uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value of the float
uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 1fv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value to be used for the uniform variable.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 1i uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value of the int
uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 1iv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value to be used for the uniform variable.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 2f uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new X component of the vec2
uniform.
The new Y component of the vec2
uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 2fv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value to be used for the uniform variable.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 2i uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new X component of the ivec2
uniform.
The new Y component of the ivec2
uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 2iv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value to be used for the uniform variable.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 3f uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new X component of the vec3
uniform.
The new Y component of the vec3
uniform.
The new Z component of the vec3
uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 3fv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value to be used for the uniform variable.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 3i uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new X component of the ivec3
uniform.
The new Y component of the ivec3
uniform.
The new Z component of the ivec3
uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 3iv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value to be used for the uniform variable.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 4f uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
X component of the uniform
Y component of the uniform
Z component of the uniform
W component of the uniform
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 4fv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value to be used for the uniform variable.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 4i uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
X component of the uniform.
Y component of the uniform.
Z component of the uniform.
W component of the uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a 4iv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value to be used for the uniform variable.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a boolean uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
The new value of the boolean
uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Custom pipelines can use this method in order to perform any required pre-batch tasks for the given Game Object. It must return the texture unit the Game Object was assigned.
The Game Object being rendered or added to the batch.
Optional
frame: FrameOptional frame to use. Can override that of the Game Object.
Sets a matrix 2fv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
Whether to transpose the matrix. Should be false
.
The new values for the mat2
uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a matrix 3fv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
Whether to transpose the matrix. Should be false
.
The new values for the mat3
uniform.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Sets a matrix 4fv uniform value based on the given name on the currently set shader.
The current shader is bound, before the uniform is set, making it active within the
WebGLRenderer. This means you can safely call this method from a location such as
a Scene create
or update
method. However, when working within a Shader file
directly, use the WebGLShader
method equivalent instead, to avoid the program
being set.
The name of the uniform to set.
Whether to transpose the matrix. Should be false
.
The matrix data. If using a Matrix4 this should be the Matrix4.val
property.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Adjusts this pipelines ortho Projection Matrix to use the given dimensions
and resets the uProjectionMatrix
uniform on all bound shaders.
This method is called automatically by the renderer during its resize handler.
The new width of this WebGL Pipeline.
The new height of this WebGL Pipeline.
Sets the currently active shader within this pipeline.
The shader to set as being current.
Optional
setAttributes: booleanShould the vertex attribute pointers be set? Default false.
Optional
vertexBuffer: WebGLBufferWrapperThe vertex buffer to be set before the shader is bound. Defaults to the one owned by this pipeline.
Destroys all shaders currently set in the WebGLPipeline.shaders
array and then parses the given
config
object, extracting the shaders from it, creating WebGLShader
instances and finally
setting them into the shaders
array of this pipeline.
This is a destructive process. Be very careful when you call it, should you need to.
The configuration object for this WebGL Pipeline.
Sets the current duration into a 1f uniform value based on the given name.
This can be used for mapping time uniform values, such as iTime
.
The name of the uniform to set.
Optional
shader: WebGLShaderThe shader to set the value on. If not given, the currentShader
is used.
Binds the vertex buffer to be the active ARRAY_BUFFER on the WebGL context.
It first checks to see if it's already set as the active buffer and only binds itself if not.
Optional
buffer: WebGLBufferWrapperThe Vertex Buffer to be bound. Defaults to the one owned by this pipeline.
Check if the current batch of vertices is full.
You can optionally provide an amount
parameter. If given, it will check if the batch
needs to flush if the amount
is added to it. This allows you to test if you should
flush before populating the batch.
Optional
amount: numberWill the batch need to flush if this many vertices are added to it? Default 0.
Indicates if the current pipeline is active, or not.
Toggle this property to enable or disable a pipeline from rendering anything.