Releases: phaserjs/phaser
Phaser v3.55.2
Phaser v3.55.1
New Features
- The
GameObject.destroy
method has a newfromScene
parameter, set automatically by Phaser. Fix #5716 (thanks @rexrainbow) - The Game Object
DESTROY
event is now set the newfromScene
boolean as the 2nd parameter, allowing you to determine what invoked the event (either user code or a Scene change). Fix #5716 (thanks @rexrainbow)
Bug Fixes
- Fixed an issue with the TypeScript defs not recognising the Game Object Config properly. Fix #5713 (thanks @vforsh)
- Fixed an issue in the
FillPathWebGL
function which caused the filled versions of the Arc, Circle, Ellipse, Polygon and Star Shapes to not render. Fix #5712 (thanks @rexrainbow) - Fixed rendering parameters in
IsoBox
andIsoTriangle
Game Objects that stopped them from rendering correctly. - Added the missing
WebGLPipelineUniformsConfig
type def. Fix #5718 (thanks @PhaserEditor2D)
Phaser v3.55.0
New Features
GameObjects.DOMElement.pointerEvents
is a new property that allows you to set thepointerEvents
attribute on the DOM Element CSS. This isauto
by default and should not be changed unless you know what you're doing.Core.Config.domPointerEvents
is a new config property set viadom: { pointerEvents }
within the Game Config that allows you to set thepointerEvents
css attribute on the DOM Element container.- The
RenderTexture.endDraw
method has a new optional booleanerase
which allows you to draw all objects in the batch using a blend mode of ERASE. This has the effect of erasing any filled pixels in the objects being drawn. - All of the methods from the
GraphicsPipeline
have now been merged with theMultiPipeline
, these includebatchFillRect
,batchFillTriangle
,batchStrokeTriangle
,batchFillPath
,batchStrokePath
andbatchLine
. The Graphics Game Object and all of the Shape Game Objects have been updated to use the new Multi Pipeline. This means that drawing Sprites and Graphics / Shapes will all batch together again. Fix #5553 #5500 (thanks @venarius @roberthook823)
Updates
- The types have been improved for WebGL Compressed Textures (thanks @vforsh)
Container.moveAbove
is a new method that will move a Game Object above another in the same Container (thanks @rexrainbow)Container.moveBelow
is a new method that will move a Game Object below another in the same Container (thanks @rexrainbow)List.moveAbove
is a new method that will move a Game Object above another in the same List (thanks @rexrainbow)List.moveBelow
is a new method that will move a Game Object below another in the same List (thanks @rexrainbow)- The
MeasureText
function, as used by Text Game Objects, has had its performance enhanced by removing a duplicate image data check and also now checks for metrics properties correctly (thanks @valadaptive) WebGLShader.setUniform1
has a new optional boolean parameterskipCheck
which will force the function to set the values without checking against the previously held ones.WebGLShader.setUniform2
has a new optional boolean parameterskipCheck
which will force the function to set the values without checking against the previously held ones.WebGLShader.setUniform3
has a new optional boolean parameterskipCheck
which will force the function to set the values without checking against the previously held ones.WebGLShader.setUniform4
has a new optional boolean parameterskipCheck
which will force the function to set the values without checking against the previously held ones.- The
WebGLShader.set1fv
,set2fv
,set3fv
,set4fv
,set1iv
,set2iv
,set3iv
,set4iv
,setMatrix2fv
,setMatrix3fv
andsetMatrix4fv
methods no longer try to do array comparisons when setting the uniforms, but sets them directly. Fix #5670 (thanks @telinc1)
Bug Fixes
- Have reverted all of the DOM Element CSS changes back to how they were in 3.52, causing both DOM Input and Phaser Input to work together properly again. Fix #5628 (thanks @sacharobarts)
- The
Mesh
Game Object would incorrectly cull faces if the Scene Camera scrolled. It now calculates the cull correctly, regardless of camera world position, zoom or rotation. Fix #5570 (thanks @hendrikras) Math.ToXY
will now return an empty Vector 2 if the index is out of range, where before it would return the input Vector2 (thanks @Trissolo)- The
UpdateList.shutdown
method will now remove thePRE_UPDATE
handler from the ProcessQueue correctly (thanks @samme) - When loading a Video with a config object, it would not get the correct
key
value from it (thanks @mattjennings) - The
GameObjectFactory.existing
method will now acceptLayer
as a TypeScript type. Fix #5642 (thanks @michal-bures) - The
Input.Pointer.event
property can now be aWheelEvent
as well. - Fixed an issue when loading audio files from a Phaser project wrapped in Capacitor native app shell on iOS (thanks @consolenaut)
- Video would not resume playing after regaining focus swapping from another browser tab. Fix #5377 (thanks @spayton)
- Container will now invoke
addToRenderList
before leaving the render method, fixing an issue with Container Input. Fix #5506 (thanks @vforsh @rexrainbow) - The
Game.postBoot
callback was never being invoked due to an incorrect internal property setter. Fix #5689 (thanks @sebastianFast) - The
Light
Game Object didn't set the shader uniforms correctly, causing it to appear to ignore image rotation with normal maps. Fix #5660 (thanks @sroboubi @telinc1)
Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@x-wk @samme @trynx @Palats @supertorpe @Pixelguy @fractal @halgorithm @golden @H0rn0chse @EmilSV @Patapits @karbassi
Phaser v3.54.0
Version 3.54.0 - Futaro - 26th March 2021
New Features
Phaser.Math.Median
is a new function that will calculate the median of the given values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned (thanks @vforsh)ScenePlugin.pluginKey
is a new string-based property, set by thePluginManager
that contains the key of the plugin with the Scene Systems.
Updates
- When the Scene-owned Input Plugin is shutdown (i.e. via a call to
Scene.stop
) it will now remove anyKey
objects that the plugin created, not just reset them. This is a quality-of-life breaking change from how it worked previously (thanks @veleek) - Thanks to a TS Parser update by @krotovic the JSDocs can now define
@this
tags. Fix #4669. - The
Scenes.Systems.install
method has been removed. It's no longer required and would throw an error if called. Fix #5580 (thanks @Trissolo) - The
WebAudioSoundManager.onFocus
method will now test to see if the state of theAudioContext
isinterrupted
, as happens on iOS when leaving the page, and then resumes the context. Fix #5390 #5156 #4790 (thanks @SBCGames @micsun-al @AdamXA)
Bug Fixes
- Adding a Game Object to a Container that already existed in another Container would leave a copy of it on the Display List. Fix #5618 (thanks Kromah @mariogarranz)
- Fixed missing
backgroundColor
property in GameConfig. Fix #5597 (thanks @eli-s-r) - BitmapText wouldn't render correctly with the Canvas Renderer when the texture came from a Texture Atlas. Fix #5545 (thanks @vforsh)
- #5504 had broken DOM Elements being able to be clicked due to an oversight of the DOM Container. DOM Elements now correctly pick-up the default pointer events handler. Fix #5594 (thanks @pizkaz)
- The
RGBToString
function will no longer return CSS strings with decimal places if the input contained them (thanks @neil-h) - Objects added to a
SpineContainer
were also added to the base Display List, causing them to appear twice. Fix #5599 (thanks @spayton) - When an Animation has
skipMissedFrames
set it will now bail out of the skip catch-up loop if any of the frames cause the animation to complete. Fix #5620 (thanks @fenrir1990 @Aveyder) - The
Spine Plugin
factory functions now use the local Scene Spine Plugin reference in order to create the objects, rather than the Scene belonging to the first instance of the plugin. This prevents errors when you have globally installed the Spine plugin, but then remove or destroy the first Scene using it (thanks stever1388 @samme)
Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
Phaser v3.53.1
Version 3.53.1 - Anastasia - 8th March 2021
- Fixed an issue where Container children were not removed from the display list properly.
Version 3.53.0 - Anastasia - 8th March 2021
New Features
- You can now run Phaser from within a Web Worker. You must use the
type: 'classic'
method and then useimportScripts('phaser.js')
within your workers, but it will no longer throw window errors and allows you access to lots of the core Phaser functions from Workers. Scenes.Events.PRE_RENDER
is a new event fired after the display list is sorted and before the Scene is rendered (thanks @samme)- You can now set the boolean
preserveDrawingBuffer
in the Game Config (either directly, or in the Render Config). This is passed to the WebGL context during creation and controls if the buffers are automatically cleared each frame or not. The default is to clear them. Set totrue
to retain them. GameObjects.Shape.setDisplaySize
is a new method that helps setting the display width and height of a Shape object in a chainable way. Fix #5526 (thanks @samme)Tilemaps.Parsers.Tiled.ParseTilesets
has been updated so it now retains thetype
field information that can be optionally specified within Tiled. This is useful when creating objects from tiles and tile variants (thanks @lackhand)Tilemaps.Parsers.Tiled.ParseWangsets
is a new function that will parse the Wangset information from Tiled map data, if present, and retain it so you can access the data (thanks @lackhand)WebGLPipeline.glReset
is a new boolean property that keeps track of when the GL Context was last reset by the Pipeline Manager. It then redirects calls tobind
torebind
instead to restore the pipeline state.
Display List Updates
GameObject.addToDisplayList
is a new method that allows you to add a Game Object to the given Display List. If no Display List is given, it will default to the Scene Display List. A Game Object can only exist on one Display List at any given time, but may move freely between them.GameObject.addToUpdateList
is a new method that adds the Game Object to the Update List belonging to the Scene. When a Game Object is added to the Update List it will have itspreUpdate
method called every game frame.GameObject.removeFromDisplayList
is a new method that removes the Game Object from the Display List it is currently on.GameObject.removeFromUpdateList
is a new method that removes the Game Object from the Scenes Update List.GameObject.destroy
will now call the newremoveFromDisplayList
andremoveFromUpdateList
methods.DisplayList.addChildCallback
will now use the newaddToDisplayList
andremoveFromDisplayList
Game Object methods.Container.addHandler
will now use the newaddToDisplayList
andremoveFromDisplayList
Game Object methods.Layer.addChildCallback
andremoveChildCallback
will now use the newaddToDisplayList
andremoveFromDisplayList
Game Object methods.Group
now listens for theADDED_TO_SCENE
andREMOVED_FROM_SCENE
methods and adds and removes itself from the Update List accordingly.Group.add
andcreate
now uses the newaddToDisplayList
andaddToUpdateList
Game Object methods.Group.remove
now uses the newremoveFromDisplayList
andremoveFromUpdateList
Game Object methods.Group.destroy
has a new optional boolean parameterremoveFromScene
, which will remove all Group children from the Scene if specified.
Updates
- Phaser no longer includes the IE9 polyfills. All polyfills have been removed from the core builds and moved to their own specific version called
phaser-ie9
, which can be found in thedist
folder. - All of the Device functions will now check to see if Phaser is running inside of a Web Worker, or not. If it is, they will return early, avoiding trying to make calls to
window
or other elements not present within Workers. - The Webpack loaders have been moved to dev dependencies to avoid peer issues during use of Phaser as a package (thanks @andrewstart)
- The
WebAudioSoundManager.createAudioContext
method is no longer private. - The
WebAudioSoundManager.context
property is no longer private. - The
WebAudioSoundManager.masterMuteNode
property is no longer private. - The
WebAudioSoundManager.masterVolumeNode
property is no longer private. - The
WebAudioSoundManager.destination
property is no longer private. - The
WebAudioSound.audioBuffer
property is no longer private. - The
WebAudioSound.source
property is no longer private. - The
WebAudioSound.loopSource
property is no longer private. - The
WebAudioSound.muteNode
property is no longer private. - The
WebAudioSound.volumeNode
property is no longer private. - The
WebAudioSound.pannerNode
property is no longer private. - The
WebAudioSound.hasEnded
property is no longer private, but is read only. - The
WebAudioSound.hasLooped
property is no longer private, but is read only. - The
WebAudioSoundManager.createAudioContext
method will now usewebkitAudioContext
if defined inwindow
(rather than using the polyfill) to handle audio on Safari. - If a loaded JSON File fails to parse it will now issue a console warning along with the file key (thanks @samme)
- The Canvas Renderer will no longer run a
fillRect
ifclearBeforeRender
isfalse
in the Game Config. - The
LightsManager.addPointlight
method now has full JSDocs and theattenuation
parameter. LightPipeline.lightsActive
is a new boolean property that keeps track if the Lights Manager in a Scene is active, or not.- The
LightPipeline
now only callsbatchSprite
,batchTexture
andbatchTextureFrame
if the Scene Lights Manager is active. Fix #5522 (thanks @inmylo) - The Tiled Parser has been updated so it now supports object properties defined in an array with name / type values (thanks @veleek)
LineCurve.getTangent
can now take an output vector to receive the tangent value (thanks @samme)DOMElementCSSRenderer
no longer sets thepointerEvents
style attribute toauto
. This is the default value anyway and it now means you can override it from your code by setting thepointer-events
attribute directly. Fix #5470 (thanks @hayatae @endel)SceneManager.loadComplete
will no longer try to unlock the Sound Manager, preventingAudioContext was not allowed to start
console warnings after each Scene finishes loading.WebGLRenderer.deleteTexture
will now runresetTextures(true)
first, incase the requested texture to be deleted is currently bound. Previously, it would delete the texture and then reset them.- If
TextureSource.destroy
has a WebGL Texture it will tell the WebGL Renderer to reset the textures first, before deleting its texture. Cameras.Controls.FixedKeyControl.minZoom
is a new configurable property that sets the minimum camera zoom. Default to 0.001 (thanks @samme)Cameras.Controls.FixedKeyControl.maxZoom
is a new configurable property that sets the maximum camera zoom. Default to 1000 (thanks @samme)Cameras.Controls.SmoothedKeyControl.minZoom
is a new configurable property that sets the minimum camera zoom. Default to 0.001 (thanks @samme)Cameras.Controls.SmoothedKeyControl.maxZoom
is a new configurable property that sets the maximum camera zoom. Default to 1000 (thanks @samme)- The
WebGLPipeline.rebind
method now accepts an optional parametercurrentShader
. If provided it will set the current shader to be this after the pipeline reset is complete. - The
PipelineManager.rebind
method will now flag all pipelines asglReset = true
, so they know to fully rebind the next time they are invoked.
Bug Fixes
BlitterWebGLRenderer
was calling an out-dated functionsetRenderDepth
instead ofaddToRenderList
(thanks Harm)- When a loaded JSON file fails to parse, it's marked
FILE_ERRORED
and the Loader continues. Before this change the Loader would stall (thanks @samme) Math.FromPercent
silently assumed themin
parameter to be 0. It can now be any value, allowing you to generate percentages betweenmin
andmax
correctly (thanks @somechris)- The Container and Zone Game Objects were not handling being added to the render list, causing them to fail input detection tests. Fix #5506 #5508 (thanks @rexrainbow @vforsh @Nightspeller)
IsometricWorldToTileXY
was returning a tile incorrectly offset from the given coordinates. It now returns from the expected location (thanks @veleek)DOMElementCSSRenderer
will now return early ifsrc.node
doesn't exist or is null, rather than trying to extract thestyle
property from it. Fix #5566 (thanks @rattias)- The BitmapMask will now check to see if
renderer
exists before trying to hook to its event emitter (thanks @mattjennings) - TileSprite will now check to see if
renderer
exists before trying to restore itself during a context loss (thanks @mattjennings) - A Texture will now check to see if
renderer
exists before resetting the WebGL textures (thanks @mattjennings) - Destroying a Text Game Object when using the HEADLESS renderer would cause an
Uncaught TypeError
. Fix #5558 (thanks @mattjennings) - The
Actions.PlayAnimation
arguments have been updated to match the new animation system introduced in Phaser 3.50. It will now take either a string-key, or a play animation configuration object, and thestartFrame
parameter has been replaced withignoreIfPlaying
. The function will also only callplay
if the Game Object has an animation component, meaning you can now supply this action with a mixed-content array without errors. Fix #5555 (thanks @xuxucode) RenderTarget.resize
will nowMath.floor
the scaled width and height as well as ensure they're not <= 0 which causesFramebuffer status: Incomplete Attachment
errors. Fix #5563 #5478 (thanks @orjandh @venarius)Matter.Components.Sleep.setToSleep
andsetAwake
were documented as...
Phaser v3.53.0
Version 3.53.0 - Anastasia - 8th March 2021
New Features
- You can now run Phaser from within a Web Worker. You must use the
type: 'classic'
method and then useimportScripts('phaser.js')
within your workers, but it will no longer throw window errors and allows you access to lots of the core Phaser functions from Workers. Scenes.Events.PRE_RENDER
is a new event fired after the display list is sorted and before the Scene is rendered (thanks @samme)- You can now set the boolean
preserveDrawingBuffer
in the Game Config (either directly, or in the Render Config). This is passed to the WebGL context during creation and controls if the buffers are automatically cleared each frame or not. The default is to clear them. Set totrue
to retain them. GameObjects.Shape.setDisplaySize
is a new method that helps setting the display width and height of a Shape object in a chainable way. Fix #5526 (thanks @samme)Tilemaps.Parsers.Tiled.ParseTilesets
has been updated so it now retains thetype
field information that can be optionally specified within Tiled. This is useful when creating objects from tiles and tile variants (thanks @lackhand)Tilemaps.Parsers.Tiled.ParseWangsets
is a new function that will parse the Wangset information from Tiled map data, if present, and retain it so you can access the data (thanks @lackhand)WebGLPipeline.glReset
is a new boolean property that keeps track of when the GL Context was last reset by the Pipeline Manager. It then redirects calls tobind
torebind
instead to restore the pipeline state.
Display List Updates
GameObject.addToDisplayList
is a new method that allows you to add a Game Object to the given Display List. If no Display List is given, it will default to the Scene Display List. A Game Object can only exist on one Display List at any given time, but may move freely between them.GameObject.addToUpdateList
is a new method that adds the Game Object to the Update List belonging to the Scene. When a Game Object is added to the Update List it will have itspreUpdate
method called every game frame.GameObject.removeFromDisplayList
is a new method that removes the Game Object from the Display List it is currently on.GameObject.removeFromUpdateList
is a new method that removes the Game Object from the Scenes Update List.GameObject.destroy
will now call the newremoveFromDisplayList
andremoveFromUpdateList
methods.DisplayList.addChildCallback
will now use the newaddToDisplayList
andremoveFromDisplayList
Game Object methods.Container.addHandler
will now use the newaddToDisplayList
andremoveFromDisplayList
Game Object methods.Layer.addChildCallback
andremoveChildCallback
will now use the newaddToDisplayList
andremoveFromDisplayList
Game Object methods.Group
now listens for theADDED_TO_SCENE
andREMOVED_FROM_SCENE
methods and adds and removes itself from the Update List accordingly.Group.add
andcreate
now uses the newaddToDisplayList
andaddToUpdateList
Game Object methods.Group.remove
now uses the newremoveFromDisplayList
andremoveFromUpdateList
Game Object methods.Group.destroy
has a new optional boolean parameterremoveFromScene
, which will remove all Group children from the Scene if specified.
Updates
- Phaser no longer includes the IE9 polyfills. All polyfills have been removed from the core builds and moved to their own specific version called
phaser-ie9
, which can be found in thedist
folder. - All of the Device functions will now check to see if Phaser is running inside of a Web Worker, or not. If it is, they will return early, avoiding trying to make calls to
window
or other elements not present within Workers. - The Webpack loaders have been moved to dev dependencies to avoid peer issues during use of Phaser as a package (thanks @andrewstart)
- The
WebAudioSoundManager.createAudioContext
method is no longer private. - The
WebAudioSoundManager.context
property is no longer private. - The
WebAudioSoundManager.masterMuteNode
property is no longer private. - The
WebAudioSoundManager.masterVolumeNode
property is no longer private. - The
WebAudioSoundManager.destination
property is no longer private. - The
WebAudioSound.audioBuffer
property is no longer private. - The
WebAudioSound.source
property is no longer private. - The
WebAudioSound.loopSource
property is no longer private. - The
WebAudioSound.muteNode
property is no longer private. - The
WebAudioSound.volumeNode
property is no longer private. - The
WebAudioSound.pannerNode
property is no longer private. - The
WebAudioSound.hasEnded
property is no longer private, but is read only. - The
WebAudioSound.hasLooped
property is no longer private, but is read only. - The
WebAudioSoundManager.createAudioContext
method will now usewebkitAudioContext
if defined inwindow
(rather than using the polyfill) to handle audio on Safari. - If a loaded JSON File fails to parse it will now issue a console warning along with the file key (thanks @samme)
- The Canvas Renderer will no longer run a
fillRect
ifclearBeforeRender
isfalse
in the Game Config. - The
LightsManager.addPointlight
method now has full JSDocs and theattenuation
parameter. LightPipeline.lightsActive
is a new boolean property that keeps track if the Lights Manager in a Scene is active, or not.- The
LightPipeline
now only callsbatchSprite
,batchTexture
andbatchTextureFrame
if the Scene Lights Manager is active. Fix #5522 (thanks @inmylo) - The Tiled Parser has been updated so it now supports object properties defined in an array with name / type values (thanks @veleek)
LineCurve.getTangent
can now take an output vector to receive the tangent value (thanks @samme)DOMElementCSSRenderer
no longer sets thepointerEvents
style attribute toauto
. This is the default value anyway and it now means you can override it from your code by setting thepointer-events
attribute directly. Fix #5470 (thanks @hayatae @endel)SceneManager.loadComplete
will no longer try to unlock the Sound Manager, preventingAudioContext was not allowed to start
console warnings after each Scene finishes loading.WebGLRenderer.deleteTexture
will now runresetTextures(true)
first, incase the requested texture to be deleted is currently bound. Previously, it would delete the texture and then reset them.- If
TextureSource.destroy
has a WebGL Texture it will tell the WebGL Renderer to reset the textures first, before deleting its texture. Cameras.Controls.FixedKeyControl.minZoom
is a new configurable property that sets the minimum camera zoom. Default to 0.001 (thanks @samme)Cameras.Controls.FixedKeyControl.maxZoom
is a new configurable property that sets the maximum camera zoom. Default to 1000 (thanks @samme)Cameras.Controls.SmoothedKeyControl.minZoom
is a new configurable property that sets the minimum camera zoom. Default to 0.001 (thanks @samme)Cameras.Controls.SmoothedKeyControl.maxZoom
is a new configurable property that sets the maximum camera zoom. Default to 1000 (thanks @samme)- The
WebGLPipeline.rebind
method now accepts an optional parametercurrentShader
. If provided it will set the current shader to be this after the pipeline reset is complete. - The
PipelineManager.rebind
method will now flag all pipelines asglReset = true
, so they know to fully rebind the next time they are invoked.
Bug Fixes
BlitterWebGLRenderer
was calling an out-dated functionsetRenderDepth
instead ofaddToRenderList
(thanks Harm)- When a loaded JSON file fails to parse, it's marked
FILE_ERRORED
and the Loader continues. Before this change the Loader would stall (thanks @samme) Math.FromPercent
silently assumed themin
parameter to be 0. It can now be any value, allowing you to generate percentages betweenmin
andmax
correctly (thanks @somechris)- The Container and Zone Game Objects were not handling being added to the render list, causing them to fail input detection tests. Fix #5506 #5508 (thanks @rexrainbow @vforsh @Nightspeller)
IsometricWorldToTileXY
was returning a tile incorrectly offset from the given coordinates. It now returns from the expected location (thanks @veleek)DOMElementCSSRenderer
will now return early ifsrc.node
doesn't exist or is null, rather than trying to extract thestyle
property from it. Fix #5566 (thanks @rattias)- The BitmapMask will now check to see if
renderer
exists before trying to hook to its event emitter (thanks @mattjennings) - TileSprite will now check to see if
renderer
exists before trying to restore itself during a context loss (thanks @mattjennings) - A Texture will now check to see if
renderer
exists before resetting the WebGL textures (thanks @mattjennings) - Destroying a Text Game Object when using the HEADLESS renderer would cause an
Uncaught TypeError
. Fix #5558 (thanks @mattjennings) - The
Actions.PlayAnimation
arguments have been updated to match the new animation system introduced in Phaser 3.50. It will now take either a string-key, or a play animation configuration object, and thestartFrame
parameter has been replaced withignoreIfPlaying
. The function will also only callplay
if the Game Object has an animation component, meaning you can now supply this action with a mixed-content array without errors. Fix #5555 (thanks @xuxucode) RenderTarget.resize
will nowMath.floor
the scaled width and height as well as ensure they're not <= 0 which causesFramebuffer status: Incomplete Attachment
errors. Fix #5563 #5478 (thanks @orjandh @venarius)Matter.Components.Sleep.setToSleep
andsetAwake
were documented as returningthis
, however they didn't return anything. Both nowreturn this
correctly. Fix #5567 (thanks @micsun-al)- The Particle position...
Phaser v3.52.0
Version 3.52.0 - Crusch - 14th January 2021
New Features
- The
getPostPipeline
method available on most Game Objects will now return an array of piplines if an instance is given and the Game Object has more than one of those pipelines set on it. If only one pipeline is set, it will be returned directly.
Updates
BaseCamera.renderList
is a new array that is populated with all Game Objects that the camera has rendered in the current frame. It is automatically cleared duringCamera.preUpdate
and is an accurate representation of the Game Objects the Camera rendered. It's used internally by the Input Plugin, but exposed should you wish to read the contents or use it for profiling.BaseCamera.addToRenderList
is a new method that will add the given Game Object to the Cameras current render list.- The
InputPlugin.sortGameObjects
method now uses the new Camera render list to work out the display index depths. - The
InputPlugin.sortDropZones
method is a new method, based on the oldsortGameObjects
method that is used for sorting input enabled drop zones. - The background color behind the game url in the banner is now transparent, so it looks correct with dark dev tools themes (thanks @kainage)
Bug Fixes
WebAudioSound.destroy
now checks to see ifpannerNode
exists before disabling it, preventing an error in Safari (thanks @jdcook)- Fixed the cause of
Uncaught TypeError: Cannot read property 'getIndex' of null
by checking the display list property securely. Fix #5489 (thanks @actionmoon) - Fixed an issue where adding input-enabled Game Objects to a Layer would have the input system ignore their depth settings. Fix #5483 (thanks @pr4xx)
- The method
TilemapLayer.weightedRandomize
has changed so that the parameterweightedIndexes
is now first in the method and is non-optional. Previously, it was the 5th parameter and incorrectly flagged as optional. This change was made to the docs but not the parameters, but now works according to the docs (thanks Fantasix) - The Mesh
GenerateVerts
function was returning an object with the propertyverts
instead ofvertices
as expected by theMesh.addVertices
method. It now returns the correct name (thanks @lackhand) AtlasJSONFile
will now callFile.pendingDestroy
, clearing up the resources it used during load and emitting a missingFILE_COMPLETE
event. Fix #5495 (thanks @mikuso)AtlasJSONFile
,AtlasXMLFile
,BitmapFontFile
andUnityAtlasFile
will now callFile.pendingDestroy
, clearing up the resources it used during load and emiting a missingFILE_COMPLETE
event. Fix #5495 (thanks @mikuso)- Some Bitmap Text fonts were not rendering under Canvas due to the way in which the texture offset was calculated. It now uses the
__BASE
frame to get the texture offset, rather than the first frame in the set. Fix #5462 #5501 (thanks @monteiz @DPMakerQB)
Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
Phaser v3.51.0
Version 3.51.0 - Emilia - 5th January 2021
New Features
WebGLRenderer.isTextureClean
is a new boolean property that tracks of all of the multi-textures are in a clean 'default' state, to avoid lots of gl texture binds and activations during a Scene restart or destruction process.GameObject.removePostPipeline
would previously only remove a single pipeline instance. Calling the method with a class will now clear all instances of the pipeline class from the Game Object (thanks @rexrainbow)
Updates
Layer.destroy
will now calldestroy
on all of its children as well.- The
Layer
Game Object has been given all of the missing properties and methods from Game Object to make the class shapes identical. This includes the propertiesparentContainer
,tabIndex
,input
andbody
. You cannot set any of these properties, they are ignored by the Layer itself. It also includes the methods:setInteractive
,disableInteractive
andremoveInteractive
. A Layer cannot be enabled for input or have a physics body. Fix #5459 (thanks @PhaserEditor2D) Layer.getIndexList
is a new method, taken from the Game Object, that will return the index of the Layer in the display list, factoring in any parents.
Bug Fixes
- On some keyboards it was possible for the
keyup
event to not fire because it was filtered out by the Keyboard Plugin repeat key check. Fix #5472 (thanks @cjw6k) - Fixed issue causing
Cannot read property 'pipelines' of null
to be thrown if using 3.50 with the HEADLESS renderer. Fix #5468 (thanks @Grenagar) - Canvas Tilemap Rendering is now working again. Fix #5480 (thanks @marshmn)
Layer.destroy
will now emit theDESTROY
event at the start of the method. Fix #5466 (thanks @samme)- The error
RENDER WARNING: there is no texture bound to the unit ...
would be thrown when trying to restart a Scene. When a Scene is shutdown is will now reset the WebGL Texture cache. Fix #5464 (thanks @ffx0s) - The error
RENDER WARNING: there is no texture bound to the unit ...
would be thrown when destroying a Text Game Object, or any Game Object that uses its own custom texture. Destroying such an object will now reset the WebGL Texture cache. Fix #5464 (thanks @mark-rushakoff) - When using an asset pack with a prefix, and loading a Spine file, the prefix was being appended twice causing the texture to fail loading. It's now appended correctly (thanks @jdcook)
Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@pol0nium @ErinLMoore @umi-tyaahan @nk9
Version 3.50.1 - Subaru - 21st December 2020
- The new Web Audio Panning feature breaks WebAudio on Safari (OSX and iOS). The stero panner node is now only created if supported. Fix #5460 (thanks @d4rkforce)
Version 3.50.0 - Subaru - 16th December 2020
Due to the massive amount of changes in 3.50 this Change Log is, by its nature, very long. It's important to scan through it, especially if you're porting a game from an earlier version of Phaser to 3.50. However, if you're after more top-level descriptions of what's new, with example code, then please see the posts we will be making to the Phaser site and Phaser Patreon in the coming months after release. We have also updated the Phaser 3 Examples site, so that every single example up there has been rewritten for 3.50, so you don't have to struggle working through old or deprecated syntax. Virtually all new features are covered in new examples, as well.
With that said, we've tried to organize the Change Log into commonly themed sections to make it more digestible, but we appreciate there is a lot here. Please don't feel overwhelmed! If you need clarification about something, join us on the Phaser Discord and feel free to ask.
WebGL Pipelines and Post Processing
WebGL Pipelines are responsible for the rendering of all Game Objects in Phaser and they have had a complete rewrite in 3.50. This was to allow for the introduction of post processing pipelines, now readily available to be created from the new Post FX Pipeline class. The changes in this area have been extensive, so if you use custom WebGL Pipelines in your game already, you must update your code to use Phaser 3.50.
Pipeline Manager
The WebGL.PipelineManager
is a new class that is responsible for managing all of the WebGL Pipelines in Phaser. An instance of the Pipeline Manager is created by the WebGL Renderer and is available under the pipelines
property. This means that the WebGL Renderer no longer handles pipelines directly, causing the following API changes:
WebGLRenderer.pipelines
is no longer a plain object containing pipeline instances. It's now an instance of thePipelineManager
class. This instance is created during the init and boot phase of the renderer.- The
WebGLRenderer.currentPipeline
property no longer exists, instead usePipelineManager.current
. - The
WebGLRenderer.previousPipeline
property no longer exists, instead usePipelineManager.previous
. - The
WebGLRenderer.hasPipeline
method no longer exists, instead usePipelineManager.has
. - The
WebGLRenderer.getPipeline
method no longer exists, instead usePipelineManager.get
. - The
WebGLRenderer.removePipeline
method no longer exists, instead usePipelineManager.remove
. - The
WebGLRenderer.addPipeline
method no longer exists, instead usePipelineManager.add
. - The
WebGLRenderer.setPipeline
method no longer exists, instead usePipelineManager.set
. - The
WebGLRenderer.rebindPipeline
method no longer exists, instead usePipelineManager.rebind
. - The
WebGLRenderer.clearPipeline
method no longer exists, instead usePipelineManager.clear
.
The Pipeline Manager also offers the following new features:
- The
PipelineManager.resize
method automatically handles resize events across all pipelines. - The
PipelineManager.preRender
method calls the pre-render method of all pipelines. - The
PipelineManager.render
method calls the render method of all pipelines. - The
PipelineManager.postRender
method calls the post-render method of all pipelines. - The
PipelineManager.setMulti
method automatically binds the Multi Texture Pipeline, Phasers default. - The
PipelineManager.clear
method will clear the pipeline, store it inprevious
and free the renderer. - The
PipelineManager.rebind
method will reset the rendering context and restore theprevious
pipeline, if set. - The
PipelineManager.copyFrame
method will copy asource
Render Target to thetarget
Render Target, optionally setting the brightness of the copy. - The
PipelineManager.blitFrame
method will copy asource
Render Target to thetarget
Render Target. UnlikecopyFrame
no resizing takes place and you can optionally set the brightness and erase mode of the copy. - The
PipelineManager.copyFrameRect
method binds thesource
Render Target and then copies a section of it to thetarget
usinggl.copyTexSubImage2D
rather than a shader, making it much faster if you don't need blending or preserving alpha details. - The
PipelineManager.copyToGame
method pops the framebuffer from the renderers FBO stack and sets that as the active target, then draws thesource
Render Target to it. Use when you need to render the final result to the game canvas. - The
PipelineManager.drawFrame
method will copy asource
Render Target, optionally to atarget
Render Target, using the given ColorMatrix, allowing for full control over the luminance values used during the copy. - The
PipelineManager.blendFrames
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using a linear blend effect, which is controlled by thestrength
parameter. - The
PipelineManager.blendFramesAdditive
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using an additive blend effect, which is controlled by thestrength
parameter. - The
PipelineManager.clearFrame
method clears the given Render Target.
New constants have been created to help you reference a pipeline without needing to use strings:
Phaser.Renderer.WebGL.Pipelines.BITMAPMASK_PIPELINE
for the Bitmap Mask Pipeline.Phaser.Renderer.WebGL.Pipelines.LIGHT_PIPELINE
for the Light 2D Pipeline.Phaser.Renderer.WebGL.Pipelines.SINGLE_PIPELINE
for the Single Pipeline.Phaser.Renderer.WebGL.Pipelines.MULTI_PIPELINE
for the Multi Pipeline.Phaser.Renderer.WebGL.Pipelines.ROPE_PIPELINE
for the Rope Pipeline.Phaser.Renderer.WebGL.Pipelines.POINTLIGHT_PIPELINE
for the Point Light Pipeline.Phaser.Renderer.WebGL.Pipelines.POSTFX_PIPELINE
for the Post FX Pipeline.Phaser.Renderer.WebGL.Pipelines.UTILITY_PIPELINE
for the Utility Pipeline.
All Game Objects have been updated to use the new constants and Pipeline Manager.
Post FX Pipeline
The Post FX Pipeline is a brand new and special kind of pipeline specifically for handling post processing effects in Phaser 3.50.
Where-as a standard Pipeline allows you to control the process of rendering Game Objects by configuring the shaders and attributes used to draw them, a Post FX Pipeline is designed to allow you to apply processing after the Game Object/s have been rendered.
Typical examples of post processing effects are bloom filters, blurs, light effects and color manipulation.
The pipeline works by creating a tiny vertex buffer with just one single hard-coded quad in it. Game Objects can have a Post Pipeline set on them, which becomes their own unique pipeline instance. Those objects are then rendered using their standard pipeline, but are redirected to the Render Targets owned by the post pipeline, which can then apply their own shaders and effects, before passing them back to the main renderer.
...
Phaser v3.50.1
Version 3.50.1 - Subaru - 21st December 2020
- The new Web Audio Panning feature breaks WebAudio on Safari (OSX and iOS). The stero panner node is now only created if supported. Fix #5460 (thanks @d4rkforce)
Version 3.50.0 - Subaru - 16th December 2020
Due to the massive amount of changes in 3.50 this Change Log is, by its nature, very long. It's important to scan through it, especially if you're porting a game from an earlier version of Phaser to 3.50. However, if you're after more top-level descriptions of what's new, with example code, then please see the posts we will be making to the Phaser site and Phaser Patreon in the coming months after release. We have also updated the Phaser 3 Examples site, so that every single example up there has been rewritten for 3.50, so you don't have to struggle working through old or deprecated syntax. Virtually all new features are covered in new examples, as well.
With that said, we've tried to organize the Change Log into commonly themed sections to make it more digestible, but we appreciate there is a lot here. Please don't feel overwhelmed! If you need clarification about something, join us on the Phaser Discord and feel free to ask.
WebGL Pipelines and Post Processing
WebGL Pipelines are responsible for the rendering of all Game Objects in Phaser and they have had a complete rewrite in 3.50. This was to allow for the introduction of post processing pipelines, now readily available to be created from the new Post FX Pipeline class. The changes in this area have been extensive, so if you use custom WebGL Pipelines in your game already, you must update your code to use Phaser 3.50.
Pipeline Manager
The WebGL.PipelineManager
is a new class that is responsible for managing all of the WebGL Pipelines in Phaser. An instance of the Pipeline Manager is created by the WebGL Renderer and is available under the pipelines
property. This means that the WebGL Renderer no longer handles pipelines directly, causing the following API changes:
WebGLRenderer.pipelines
is no longer a plain object containing pipeline instances. It's now an instance of thePipelineManager
class. This instance is created during the init and boot phase of the renderer.- The
WebGLRenderer.currentPipeline
property no longer exists, instead usePipelineManager.current
. - The
WebGLRenderer.previousPipeline
property no longer exists, instead usePipelineManager.previous
. - The
WebGLRenderer.hasPipeline
method no longer exists, instead usePipelineManager.has
. - The
WebGLRenderer.getPipeline
method no longer exists, instead usePipelineManager.get
. - The
WebGLRenderer.removePipeline
method no longer exists, instead usePipelineManager.remove
. - The
WebGLRenderer.addPipeline
method no longer exists, instead usePipelineManager.add
. - The
WebGLRenderer.setPipeline
method no longer exists, instead usePipelineManager.set
. - The
WebGLRenderer.rebindPipeline
method no longer exists, instead usePipelineManager.rebind
. - The
WebGLRenderer.clearPipeline
method no longer exists, instead usePipelineManager.clear
.
The Pipeline Manager also offers the following new features:
- The
PipelineManager.resize
method automatically handles resize events across all pipelines. - The
PipelineManager.preRender
method calls the pre-render method of all pipelines. - The
PipelineManager.render
method calls the render method of all pipelines. - The
PipelineManager.postRender
method calls the post-render method of all pipelines. - The
PipelineManager.setMulti
method automatically binds the Multi Texture Pipeline, Phasers default. - The
PipelineManager.clear
method will clear the pipeline, store it inprevious
and free the renderer. - The
PipelineManager.rebind
method will reset the rendering context and restore theprevious
pipeline, if set. - The
PipelineManager.copyFrame
method will copy asource
Render Target to thetarget
Render Target, optionally setting the brightness of the copy. - The
PipelineManager.blitFrame
method will copy asource
Render Target to thetarget
Render Target. UnlikecopyFrame
no resizing takes place and you can optionally set the brightness and erase mode of the copy. - The
PipelineManager.copyFrameRect
method binds thesource
Render Target and then copies a section of it to thetarget
usinggl.copyTexSubImage2D
rather than a shader, making it much faster if you don't need blending or preserving alpha details. - The
PipelineManager.copyToGame
method pops the framebuffer from the renderers FBO stack and sets that as the active target, then draws thesource
Render Target to it. Use when you need to render the final result to the game canvas. - The
PipelineManager.drawFrame
method will copy asource
Render Target, optionally to atarget
Render Target, using the given ColorMatrix, allowing for full control over the luminance values used during the copy. - The
PipelineManager.blendFrames
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using a linear blend effect, which is controlled by thestrength
parameter. - The
PipelineManager.blendFramesAdditive
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using an additive blend effect, which is controlled by thestrength
parameter. - The
PipelineManager.clearFrame
method clears the given Render Target.
New constants have been created to help you reference a pipeline without needing to use strings:
Phaser.Renderer.WebGL.Pipelines.BITMAPMASK_PIPELINE
for the Bitmap Mask Pipeline.Phaser.Renderer.WebGL.Pipelines.LIGHT_PIPELINE
for the Light 2D Pipeline.Phaser.Renderer.WebGL.Pipelines.SINGLE_PIPELINE
for the Single Pipeline.Phaser.Renderer.WebGL.Pipelines.MULTI_PIPELINE
for the Multi Pipeline.Phaser.Renderer.WebGL.Pipelines.ROPE_PIPELINE
for the Rope Pipeline.Phaser.Renderer.WebGL.Pipelines.POINTLIGHT_PIPELINE
for the Point Light Pipeline.Phaser.Renderer.WebGL.Pipelines.POSTFX_PIPELINE
for the Post FX Pipeline.Phaser.Renderer.WebGL.Pipelines.UTILITY_PIPELINE
for the Utility Pipeline.
All Game Objects have been updated to use the new constants and Pipeline Manager.
Post FX Pipeline
The Post FX Pipeline is a brand new and special kind of pipeline specifically for handling post processing effects in Phaser 3.50.
Where-as a standard Pipeline allows you to control the process of rendering Game Objects by configuring the shaders and attributes used to draw them, a Post FX Pipeline is designed to allow you to apply processing after the Game Object/s have been rendered.
Typical examples of post processing effects are bloom filters, blurs, light effects and color manipulation.
The pipeline works by creating a tiny vertex buffer with just one single hard-coded quad in it. Game Objects can have a Post Pipeline set on them, which becomes their own unique pipeline instance. Those objects are then rendered using their standard pipeline, but are redirected to the Render Targets owned by the post pipeline, which can then apply their own shaders and effects, before passing them back to the main renderer.
The following properties and methods are available in the new PostFXPipeline
class:
- The
PostFXPipeline.gameObject
property is a reference to the Game Object that owns the Post Pipeline, if any. - The
PostFXPipeline.colorMatrix
property is a Color Matrix instance used by the draw shader. - The
PostFXPipeline.fullFrame1
property is a reference to thefullFrame1
Render Target that belongs to the Utility Pipeline, as it's commonly used in post processing. - The
PostFXPipeline.fullFrame2
property is a reference to thefullFrame2
Render Target that belongs to the Utility Pipeline, as it's commonly used in post processing. - The
PostFXPipeline.halfFrame1
property is a reference to thehalfFrame1
Render Target that belongs to the Utility Pipeline, as it's commonly used in post processing. - The
PostFXPipeline.halfFrame2
property is a reference to thehalfFrame2
Render Target that belongs to the Utility Pipeline, as it's commonly used in post processing. - The
PostFXPipeline.copyFrame
method will copy asource
Render Target to thetarget
Render Target, optionally setting the brightness of the copy. - The
PostFXPipeline.blitFrame
method will copy asource
Render Target to thetarget
Render Target. UnlikecopyFrame
no resizing takes place and you can optionally set the brightness and erase mode of the copy. - The
PostFXPipeline.copyFrameRect
method binds thesource
Render Target and then copies a section of it to thetarget
usinggl.copyTexSubImage2D
rather than a shader, making it much faster if you don't need blending or preserving alpha details. - The
PostFXPipeline.copyToGame
method pops the framebuffer from the renderers FBO stack and sets that as the active target, then draws thesource
Render Target to it. Use when you need to render the final result to the game canvas. - The
PostFXPipeline.drawFrame
method will copy asource
Render Target, optionally to atarget
Render Target, using the given ColorMatrix, allowing for full control over the luminance values used during the copy. - The
PostFXPipeline.blendFrames
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using a linear blend effect, which is controlled by thestrength
parameter. - The
PostFXPipeline.blendFramesAdditive
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using an additive blend effect, which is controlled by thestrength
parameter. - The
PostFXPipeline.clearFrame
method clears the given Render Target. - The
PostFXPipeline.bindAndDraw
method binds this pipeline and draws thesource
Render Target to thetarget
Render Target. This is typical...
Phaser v3.50.0
Version 3.50.0 - Subaru - 16th December 2020
Due to the massive amount of changes in 3.50 this Change Log is, by its nature, very long. It's important to scan through it, especially if you're porting a game from an earlier version of Phaser to 3.50. However, if you're after more top-level descriptions of what's new, with example code, then please see the posts we will be making to the Phaser site and Phaser Patreon in the coming months after release. We have also updated the Phaser 3 Examples site, so that every single example up there has been rewritten for 3.50, so you don't have to struggle working through old or deprecated syntax. Virtually all new features are covered in new examples, as well.
With that said, we've tried to organize the Change Log into commonly themed sections to make it more digestible, but we appreciate there is a lot here. Please don't feel overwhelmed! If you need clarification about something, join us on the Phaser Discord and feel free to ask.
WebGL Pipelines and Post Processing
WebGL Pipelines are responsible for the rendering of all Game Objects in Phaser and they have had a complete rewrite in 3.50. This was to allow for the introduction of post processing pipelines, now readily available to be created from the new Post FX Pipeline class. The changes in this area have been extensive, so if you use custom WebGL Pipelines in your game already, you must update your code to use Phaser 3.50.
Pipeline Manager
The WebGL.PipelineManager
is a new class that is responsible for managing all of the WebGL Pipelines in Phaser. An instance of the Pipeline Manager is created by the WebGL Renderer and is available under the pipelines
property. This means that the WebGL Renderer no longer handles pipelines directly, causing the following API changes:
WebGLRenderer.pipelines
is no longer a plain object containing pipeline instances. It's now an instance of thePipelineManager
class. This instance is created during the init and boot phase of the renderer.- The
WebGLRenderer.currentPipeline
property no longer exists, instead usePipelineManager.current
. - The
WebGLRenderer.previousPipeline
property no longer exists, instead usePipelineManager.previous
. - The
WebGLRenderer.hasPipeline
method no longer exists, instead usePipelineManager.has
. - The
WebGLRenderer.getPipeline
method no longer exists, instead usePipelineManager.get
. - The
WebGLRenderer.removePipeline
method no longer exists, instead usePipelineManager.remove
. - The
WebGLRenderer.addPipeline
method no longer exists, instead usePipelineManager.add
. - The
WebGLRenderer.setPipeline
method no longer exists, instead usePipelineManager.set
. - The
WebGLRenderer.rebindPipeline
method no longer exists, instead usePipelineManager.rebind
. - The
WebGLRenderer.clearPipeline
method no longer exists, instead usePipelineManager.clear
.
The Pipeline Manager also offers the following new features:
- The
PipelineManager.resize
method automatically handles resize events across all pipelines. - The
PipelineManager.preRender
method calls the pre-render method of all pipelines. - The
PipelineManager.render
method calls the render method of all pipelines. - The
PipelineManager.postRender
method calls the post-render method of all pipelines. - The
PipelineManager.setMulti
method automatically binds the Multi Texture Pipeline, Phasers default. - The
PipelineManager.clear
method will clear the pipeline, store it inprevious
and free the renderer. - The
PipelineManager.rebind
method will reset the rendering context and restore theprevious
pipeline, if set. - The
PipelineManager.copyFrame
method will copy asource
Render Target to thetarget
Render Target, optionally setting the brightness of the copy. - The
PipelineManager.blitFrame
method will copy asource
Render Target to thetarget
Render Target. UnlikecopyFrame
no resizing takes place and you can optionally set the brightness and erase mode of the copy. - The
PipelineManager.copyFrameRect
method binds thesource
Render Target and then copies a section of it to thetarget
usinggl.copyTexSubImage2D
rather than a shader, making it much faster if you don't need blending or preserving alpha details. - The
PipelineManager.copyToGame
method pops the framebuffer from the renderers FBO stack and sets that as the active target, then draws thesource
Render Target to it. Use when you need to render the final result to the game canvas. - The
PipelineManager.drawFrame
method will copy asource
Render Target, optionally to atarget
Render Target, using the given ColorMatrix, allowing for full control over the luminance values used during the copy. - The
PipelineManager.blendFrames
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using a linear blend effect, which is controlled by thestrength
parameter. - The
PipelineManager.blendFramesAdditive
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using an additive blend effect, which is controlled by thestrength
parameter. - The
PipelineManager.clearFrame
method clears the given Render Target.
New constants have been created to help you reference a pipeline without needing to use strings:
Phaser.Renderer.WebGL.Pipelines.BITMAPMASK_PIPELINE
for the Bitmap Mask Pipeline.Phaser.Renderer.WebGL.Pipelines.LIGHT_PIPELINE
for the Light 2D Pipeline.Phaser.Renderer.WebGL.Pipelines.SINGLE_PIPELINE
for the Single Pipeline.Phaser.Renderer.WebGL.Pipelines.MULTI_PIPELINE
for the Multi Pipeline.Phaser.Renderer.WebGL.Pipelines.ROPE_PIPELINE
for the Rope Pipeline.Phaser.Renderer.WebGL.Pipelines.POINTLIGHT_PIPELINE
for the Point Light Pipeline.Phaser.Renderer.WebGL.Pipelines.POSTFX_PIPELINE
for the Post FX Pipeline.Phaser.Renderer.WebGL.Pipelines.UTILITY_PIPELINE
for the Utility Pipeline.
All Game Objects have been updated to use the new constants and Pipeline Manager.
Post FX Pipeline
The Post FX Pipeline is a brand new and special kind of pipeline specifically for handling post processing effects in Phaser 3.50.
Where-as a standard Pipeline allows you to control the process of rendering Game Objects by configuring the shaders and attributes used to draw them, a Post FX Pipeline is designed to allow you to apply processing after the Game Object/s have been rendered.
Typical examples of post processing effects are bloom filters, blurs, light effects and color manipulation.
The pipeline works by creating a tiny vertex buffer with just one single hard-coded quad in it. Game Objects can have a Post Pipeline set on them, which becomes their own unique pipeline instance. Those objects are then rendered using their standard pipeline, but are redirected to the Render Targets owned by the post pipeline, which can then apply their own shaders and effects, before passing them back to the main renderer.
The following properties and methods are available in the new PostFXPipeline
class:
- The
PostFXPipeline.gameObject
property is a reference to the Game Object that owns the Post Pipeline, if any. - The
PostFXPipeline.colorMatrix
property is a Color Matrix instance used by the draw shader. - The
PostFXPipeline.fullFrame1
property is a reference to thefullFrame1
Render Target that belongs to the Utility Pipeline, as it's commonly used in post processing. - The
PostFXPipeline.fullFrame2
property is a reference to thefullFrame2
Render Target that belongs to the Utility Pipeline, as it's commonly used in post processing. - The
PostFXPipeline.halfFrame1
property is a reference to thehalfFrame1
Render Target that belongs to the Utility Pipeline, as it's commonly used in post processing. - The
PostFXPipeline.halfFrame2
property is a reference to thehalfFrame2
Render Target that belongs to the Utility Pipeline, as it's commonly used in post processing. - The
PostFXPipeline.copyFrame
method will copy asource
Render Target to thetarget
Render Target, optionally setting the brightness of the copy. - The
PostFXPipeline.blitFrame
method will copy asource
Render Target to thetarget
Render Target. UnlikecopyFrame
no resizing takes place and you can optionally set the brightness and erase mode of the copy. - The
PostFXPipeline.copyFrameRect
method binds thesource
Render Target and then copies a section of it to thetarget
usinggl.copyTexSubImage2D
rather than a shader, making it much faster if you don't need blending or preserving alpha details. - The
PostFXPipeline.copyToGame
method pops the framebuffer from the renderers FBO stack and sets that as the active target, then draws thesource
Render Target to it. Use when you need to render the final result to the game canvas. - The
PostFXPipeline.drawFrame
method will copy asource
Render Target, optionally to atarget
Render Target, using the given ColorMatrix, allowing for full control over the luminance values used during the copy. - The
PostFXPipeline.blendFrames
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using a linear blend effect, which is controlled by thestrength
parameter. - The
PostFXPipeline.blendFramesAdditive
method draws thesource1
andsource2
Render Targets to thetarget
Render Target using an additive blend effect, which is controlled by thestrength
parameter. - The
PostFXPipeline.clearFrame
method clears the given Render Target. - The
PostFXPipeline.bindAndDraw
method binds this pipeline and draws thesource
Render Target to thetarget
Render Target. This is typically the final step taken in when post processing.
Renamed WebGL Pipelines
Due to the huge amount of work that has taken place in this area, all of the pipelines have been renamed. If you extend any of these ...