Skip to content

Releases: phaserjs/phaser

Phaser 3.60 Beta 18

16 Jan 17:26
Compare
Choose a tag to compare
Phaser 3.60 Beta 18 Pre-release
Pre-release

Version 3.60.0 - Miku - in development

New Features - Nine Slice Game Object

Phaser 3.60 contains a new native Nine Slice Game Object. A Nine Slice Game Object allows you to display a texture-based object that can be stretched both horizontally and vertically, but that retains fixed-sized corners. The dimensions of the corners are set via the parameters to the class. When you resize a Nine Slice Game Object only the middle sections of the texture stretch. This is extremely useful for UI and button-like elements, where you need them to expand to accommodate the content without distorting the texture.

The texture you provide for this Game Object should be based on the following layout structure:

    A                          B
  +---+----------------------+---+
C | 1 |          2           | 3 |
  +---+----------------------+---+
  |   |                      |   |
  | 4 |          5           | 6 |
  |   |                      |   |
  +---+----------------------+---+
D | 7 |          8           | 9 |
  +---+----------------------+---+

When changing this objects width and / or height:

areas 1, 3, 7 and 9 (the corners) will remain unscaled
areas 2 and 8 will be stretched horizontally only
areas 4 and 6 will be stretched vertically only
area 5 will be stretched both horizontally and vertically

You can also create a 3 slice Game Object:

This works in a similar way, except you can only stretch it horizontally. Therefore, it requires less configuration:

    A                          B
  +---+----------------------+---+
  |   |                      |   |
C | 1 |          2           | 3 |
  |   |                      |   |
  +---+----------------------+---+

When changing this objects width (you cannot change its height)

areas 1 and 3 will remain unscaled
area 2 will be stretched horizontally

The above configuration concept is adapted from the Pixi NineSlicePlane.

To specify a 3 slice object instead of a 9 slice you should only provide the leftWidth and rightWidth parameters. To create a 9 slice
you must supply all parameters.

The minimum width this Game Object can be is the total of leftWidth + rightWidth. The minimum height this Game Object
can be is the total of topHeight + bottomHeight. If you need to display this object at a smaller size, you can scale it.

In terms of performance, using a 3 slice Game Object is the equivalent of having 3 Sprites in a row. Using a 9 slice Game Object is the equivalent
of having 9 Sprites in a row. The vertices of this object are all batched together and can co-exist with other Sprites and graphics on the display
list, without incurring any additional overhead.

As of Phaser 3.60 this Game Object is WebGL only. Please see the new examples and documentation for how to use it.

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - Updated Particle System

The Particle system has been mostly rewritten to give it a much needed overhaul. This makes the API cleaner, the Game Objects a lot more memory efficient and also introduces several great new features. In order to do this, we had to make some breaking changes. The largest being the way in which particles are now created.

Previously when you used the this.add.particles command it would create a ParticleEmitterManager instance. You would then use this to create an Emitter, which would actually emit the particles. While this worked and did allow a Manager to control multiple emitters we found that in discussion developers seldom used this feature and it was common for a Manager to own just one single Emitter.

In order to streamline memory and the display list we have removed the ParticleEmitterManager entirely. When you call this.add.particles you're now creating a ParticleEmitter instance, which is being added directly to the display list and can be manipulated just like any other Game Object, i.e. scaled, rotated, positioned, added to a Container, etc. It now extends the GameObject base class, meaning it's also an event emitter, which allowed us to create some handy new events for particles.

So, to create an emitter, you now give it an xy coordinate, a texture and an emitter configuration object (you can also set this later, but most commonly you'd do it on creation). I.e.:

const emitter = this.add.particles(100, 300, 'flares', {
    frame: 'red',
    angle: { min: -30, max: 30 },
    speed: 150
});

This will create a 'red flare' emitter at 100 x 300.

Prior to 3.60 it would have looked like:

const manager = this.add.particles('flares');

const emitter = manager.createEmitter({
    x: 100,
    y: 300,
    frame: 'r...
Read more

Phaser 3.60 Beta 17

09 Dec 18:23
Compare
Choose a tag to compare
Phaser 3.60 Beta 17 Pre-release
Pre-release

Version 3.60.0 - Miku - in development

New Features - Nine Slice Game Object

Phaser 3.60 contains a new native Nine Slice Game Object. A Nine Slice Game Object allows you to display a texture-based object that can be stretched both horizontally and vertically, but that retains fixed-sized corners. The dimensions of the corners are set via the parameters to the class. When you resize a Nine Slice Game Object only the middle sections of the texture stretch. This is extremely useful for UI and button-like elements, where you need them to expand to accomodate the content without distorting the texture.

The texture you provide for this Game Object should be based on the following layout structure:

    A                          B
  +---+----------------------+---+
C | 1 |          2           | 3 |
  +---+----------------------+---+
  |   |                      |   |
  | 4 |          5           | 6 |
  |   |                      |   |
  +---+----------------------+---+
D | 7 |          8           | 9 |
  +---+----------------------+---+

When changing this objects width and / or height:

areas 1, 3, 7 and 9 (the corners) will remain unscaled
areas 2 and 8 will be stretched horizontally only
areas 4 and 6 will be stretched vertically only
area 5 will be stretched both horizontally and vertically

You can also create a 3 slice Game Object:

This works in a similar way, except you can only stretch it horizontally. Therefore, it requires less configuration:

    A                          B
  +---+----------------------+---+
  |   |                      |   |
C | 1 |          2           | 3 |
  |   |                      |   |
  +---+----------------------+---+

When changing this objects width (you cannot change its height)

areas 1 and 3 will remain unscaled
area 2 will be stretched horizontally

The above configuration concept is adapted from the Pixi NineSlicePlane.

To specify a 3 slice object instead of a 9 slice you should only provide the leftWidth and rightWidth parameters. To create a 9 slice
you must supply all parameters.

The minimum width this Game Object can be is the total of leftWidth + rightWidth. The minimum height this Game Object
can be is the total of topHeight + bottomHeight. If you need to display this object at a smaller size, you can scale it.

In terms of performance, using a 3 slice Game Object is the equivalent of having 3 Sprites in a row. Using a 9 slice Game Object is the equivalent
of having 9 Sprites in a row. The vertices of this object are all batched together and can co-exist with other Sprites and graphics on the display
list, without incurring any additional overhead.

As of Phaser 3.60 this Game Object is WebGL only. Please see the new examples and documentation for how to use it.

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - Vastly Improved Mobile Performance and WebGL Pipeline Changes

WebGL Renderer Updates

Due to all of the changes with how WebGL texture batching works a lot of mostly internal methods and properties have been removed. This is the complete list:

  • The WebGLRenderer.currentActiveTexture property has been removed.
  • The WebGLRenderer.startActiveTexture property has been removed.
  • The WebGLRenderer.tempTextures property has been removed.
  • The WebGLRenderer.textureZero property has been removed.
  • The WebGLRenderer.normalTexture property has been removed.
  • The WebGLRenderer.textueFlush property has been removed.
  • The WebGLRenderer.isTextureClean property has been removed.
  • The WebGLRenderer.setBlankTexture method has been removed.
  • The WebGLRenderer.setTextureSource method has been removed.
  • The WebGLRenderer.isNewNormalMap method has been removed.
  • The WebGLRenderer.setTextureZero method has been removed.
  • The WebGLRenderer.clearTextureZero method has been removed.
  • The WebGLRenderer.setNormalMap method has been removed.
  • The WebGLRenderer.clearNormalMap method has been removed.
  • The WebGLRenderer.unbindTextures method has been removed.
  • The WebGLRenderer.resetTextures method has been removed.
  • The WebGLRenderer.setTexture2D method has been removed.
  • The WebGLRenderer.pushFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.setFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.popFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.deleteTexture method has had the reset argument removed.
  • The Textures.TextureSource.glIndex property has been removed.
  • The Textures.TextureSource.glIndexCounter property has be...
Read more

Phaser 3.60 Beta 16

30 Nov 22:03
Compare
Choose a tag to compare
Phaser 3.60 Beta 16 Pre-release
Pre-release

Version 3.60.0 - Miku - in development

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - Vastly Improved Mobile Performance and WebGL Pipeline Changes

WebGL Renderer Updates

Due to all of the changes with how WebGL texture batching works a lot of mostly internal methods and properties have been removed. This is the complete list:

  • The WebGLRenderer.currentActiveTexture property has been removed.
  • The WebGLRenderer.startActiveTexture property has been removed.
  • The WebGLRenderer.tempTextures property has been removed.
  • The WebGLRenderer.textureZero property has been removed.
  • The WebGLRenderer.normalTexture property has been removed.
  • The WebGLRenderer.textueFlush property has been removed.
  • The WebGLRenderer.isTextureClean property has been removed.
  • The WebGLRenderer.setBlankTexture method has been removed.
  • The WebGLRenderer.setTextureSource method has been removed.
  • The WebGLRenderer.isNewNormalMap method has been removed.
  • The WebGLRenderer.setTextureZero method has been removed.
  • The WebGLRenderer.clearTextureZero method has been removed.
  • The WebGLRenderer.setNormalMap method has been removed.
  • The WebGLRenderer.clearNormalMap method has been removed.
  • The WebGLRenderer.unbindTextures method has been removed.
  • The WebGLRenderer.resetTextures method has been removed.
  • The WebGLRenderer.setTexture2D method has been removed.
  • The WebGLRenderer.pushFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.setFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.popFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.deleteTexture method has had the reset argument removed.
  • The Textures.TextureSource.glIndex property has been removed.
  • The Textures.TextureSource.glIndexCounter property has been removed.

Previously, WebGLRenderer.whiteTexture and WebGLRenderer.blankTexture had a data-type of WebGLTexture but they were actually Phaser.Textures.Frame instances. This has now been corrected and the two properties are now actually WebGLTexture instances, not Frames. If your code relies on this mistake being present, please adapt it.

  • The RenderTarget class will now create a Framebuffer that includes a Depth Stencil Buffer attachment by default. Previously, it didn't. By attaching a stencil buffer it allows things like Geometry Masks to work in combination with Post FX and other Pipelines. Fix #5802 (thanks @mijinc0)
  • When calling PipelineManager.clear and rebind it will now check if the vao extension is available, and if so, it'll bind a null vertex array. This helps clean-up from 3rd party libs that don't do this directly, such as ThreeJS.

Mobile Pipeline

  • The Mobile Pipeline is a new pipeline that extends the Multi Tint pipeline, but uses customized shaders and a single-bound texture specifically for mobile GPUs. This should restore mobile performance back to the levels it was around v3.22, before Multi Tint improved it all for desktop at the expense of mobile.
  • shaders/Mobile.vert and shaders/Mobile.frag are the two shaders used for the Mobile Pipeline.
  • PipelineManager#MOBILE_PIPELINE is a new constant-style reference to the Mobile Pipeline instance.
  • autoMobilePipeline is a new Game Configuration boolean that toggles if the Mobile Pipeline should be automatically deployed, or not. By default it is enabled, but you can set it to false to force use of the Multi Tint pipeline (or if you need more advanced conditions to check when to enable it)
  • defaultPipeline is a new Game Configuration property that allows you to set the default Game Object Pipeline. This is set to Multi Tint as standard, but you can set it to your own pipeline from this value.
  • PipelineManager.default is a new propery that is used by most Game Objects to determine which pipeline they will init with.
  • PipelineManager.setDefaultPipeline is a new method that allows you to change the default Game Object pipeline. You could use this to allow for more fine-grained conditional control over when to use Multi or Mobile (or another pipeline)
  • The PipelineManager.boot method is now passed the default pipeline and auto mobile setting from the Game Config.

Multi Tint Pipeline

  • The batchLine method in the Multi Pipeline will now check to see if the dxdy len is zero, and if so, it will abort drawing the line. This fixes issues on older Android devices, such as the Samsung Galaxy S6 or Kindle 7, where it would draw erroneous lines leading up to the top-left of the canvas under WebGL when rendering a stroked rounded rectangle. Fix #5429 (thanks @fkoch-tg...
Read more

Phaser v3.60 Beta 15

30 Nov 15:11
Compare
Choose a tag to compare
Phaser v3.60 Beta 15 Pre-release
Pre-release

Version 3.60.0 - Miku - in development

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - Vastly Improved Mobile Performance and WebGL Pipeline Changes

WebGL Renderer Updates

Due to all of the changes with how WebGL texture batching works a lot of mostly internal methods and properties have been removed. This is the complete list:

  • The WebGLRenderer.currentActiveTexture property has been removed.
  • The WebGLRenderer.startActiveTexture property has been removed.
  • The WebGLRenderer.tempTextures property has been removed.
  • The WebGLRenderer.textureZero property has been removed.
  • The WebGLRenderer.normalTexture property has been removed.
  • The WebGLRenderer.textueFlush property has been removed.
  • The WebGLRenderer.isTextureClean property has been removed.
  • The WebGLRenderer.setBlankTexture method has been removed.
  • The WebGLRenderer.setTextureSource method has been removed.
  • The WebGLRenderer.isNewNormalMap method has been removed.
  • The WebGLRenderer.setTextureZero method has been removed.
  • The WebGLRenderer.clearTextureZero method has been removed.
  • The WebGLRenderer.setNormalMap method has been removed.
  • The WebGLRenderer.clearNormalMap method has been removed.
  • The WebGLRenderer.unbindTextures method has been removed.
  • The WebGLRenderer.resetTextures method has been removed.
  • The WebGLRenderer.setTexture2D method has been removed.
  • The WebGLRenderer.pushFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.setFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.popFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.deleteTexture method has had the reset argument removed.
  • The Textures.TextureSource.glIndex property has been removed.
  • The Textures.TextureSource.glIndexCounter property has been removed.

Previously, WebGLRenderer.whiteTexture and WebGLRenderer.blankTexture had a data-type of WebGLTexture but they were actually Phaser.Textures.Frame instances. This has now been corrected and the two properties are now actually WebGLTexture instances, not Frames. If your code relies on this mistake being present, please adapt it.

  • The RenderTarget class will now create a Framebuffer that includes a Depth Stencil Buffer attachment by default. Previously, it didn't. By attaching a stencil buffer it allows things like Geometry Masks to work in combination with Post FX and other Pipelines. Fix #5802 (thanks @mijinc0)
  • When calling PipelineManager.clear and rebind it will now check if the vao extension is available, and if so, it'll bind a null vertex array. This helps clean-up from 3rd party libs that don't do this directly, such as ThreeJS.

Mobile Pipeline

  • The Mobile Pipeline is a new pipeline that extends the Multi Tint pipeline, but uses customized shaders and a single-bound texture specifically for mobile GPUs. This should restore mobile performance back to the levels it was around v3.22, before Multi Tint improved it all for desktop at the expense of mobile.
  • shaders/Mobile.vert and shaders/Mobile.frag are the two shaders used for the Mobile Pipeline.
  • PipelineManager#MOBILE_PIPELINE is a new constant-style reference to the Mobile Pipeline instance.
  • autoMobilePipeline is a new Game Configuration boolean that toggles if the Mobile Pipeline should be automatically deployed, or not. By default it is enabled, but you can set it to false to force use of the Multi Tint pipeline (or if you need more advanced conditions to check when to enable it)
  • defaultPipeline is a new Game Configuration property that allows you to set the default Game Object Pipeline. This is set to Multi Tint as standard, but you can set it to your own pipeline from this value.
  • PipelineManager.default is a new propery that is used by most Game Objects to determine which pipeline they will init with.
  • PipelineManager.setDefaultPipeline is a new method that allows you to change the default Game Object pipeline. You could use this to allow for more fine-grained conditional control over when to use Multi or Mobile (or another pipeline)
  • The PipelineManager.boot method is now passed the default pipeline and auto mobile setting from the Game Config.

Multi Tint Pipeline

  • The batchLine method in the Multi Pipeline will now check to see if the dxdy len is zero, and if so, it will abort drawing the line. This fixes issues on older Android devices, such as the Samsung Galaxy S6 or Kindle 7, where it would draw erroneous lines leading up to the top-left of the canvas under WebGL when rendering a stroked rounded rectangle. Fix #5429 (thanks @fkoch-tg...
Read more

Phaser v3.60.0 Beta 14

10 Nov 16:22
Compare
Choose a tag to compare
Pre-release

Version 3.60.0 - Miku - in development

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - Vastly Improved Mobile Performance and WebGL Pipeline Changes

WebGL Renderer Updates

Due to all of the changes with how WebGL texture batching works a lot of mostly internal methods and properties have been removed. This is the complete list:

  • The WebGLRenderer.currentActiveTexture property has been removed.
  • The WebGLRenderer.startActiveTexture property has been removed.
  • The WebGLRenderer.tempTextures property has been removed.
  • The WebGLRenderer.textureZero property has been removed.
  • The WebGLRenderer.normalTexture property has been removed.
  • The WebGLRenderer.textueFlush property has been removed.
  • The WebGLRenderer.isTextureClean property has been removed.
  • The WebGLRenderer.setBlankTexture method has been removed.
  • The WebGLRenderer.setTextureSource method has been removed.
  • The WebGLRenderer.isNewNormalMap method has been removed.
  • The WebGLRenderer.setTextureZero method has been removed.
  • The WebGLRenderer.clearTextureZero method has been removed.
  • The WebGLRenderer.setNormalMap method has been removed.
  • The WebGLRenderer.clearNormalMap method has been removed.
  • The WebGLRenderer.unbindTextures method has been removed.
  • The WebGLRenderer.resetTextures method has been removed.
  • The WebGLRenderer.setTexture2D method has been removed.
  • The WebGLRenderer.pushFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.setFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.popFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.deleteTexture method has had the reset argument removed.
  • The Textures.TextureSource.glIndex property has been removed.
  • The Textures.TextureSource.glIndexCounter property has been removed.

Previously, WebGLRenderer.whiteTexture and WebGLRenderer.blankTexture had a data-type of WebGLTexture but they were actually Phaser.Textures.Frame instances. This has now been corrected and the two properties are now actually WebGLTexture instances, not Frames. If your code relies on this mistake being present, please adapt it.

Mobile Pipeline

  • The Mobile Pipeline is a new pipeline that extends the Multi Tint pipeline, but uses customized shaders and a single-bound texture specifically for mobile GPUs. This should restore mobile performance back to the levels it was around v3.22, before Multi Tint improved it all for desktop at the expense of mobile.
  • shaders/Mobile.vert and shaders/Mobile.frag are the two shaders used for the Mobile Pipeline.
  • PipelineManager#MOBILE_PIPELINE is a new constant-style reference to the Mobile Pipeline instance.
  • autoMobilePipeline is a new Game Configuration boolean that toggles if the Mobile Pipeline should be automatically deployed, or not. By default it is enabled, but you can set it to false to force use of the Multi Tint pipeline (or if you need more advanced conditions to check when to enable it)
  • defaultPipeline is a new Game Configuration property that allows you to set the default Game Object Pipeline. This is set to Multi Tint as standard, but you can set it to your own pipeline from this value.
  • PipelineManager.default is a new propery that is used by most Game Objects to determine which pipeline they will init with.
  • PipelineManager.setDefaultPipeline is a new method that allows you to change the default Game Object pipeline. You could use this to allow for more fine-grained conditional control over when to use Multi or Mobile (or another pipeline)
  • The PipelineManager.boot method is now passed the default pipeline and auto mobile setting from the Game Config.

Multi Tint Pipeline

  • The Multi.frag shader now uses a highp precision, or mediump if the device doesn't support it (thanks @arbassic)
  • The WebGL.Utils.checkShaderMax function will no longer use a massive if/else glsl shader check and will instead rely on the value given in gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS).
  • The internal WebGL Utils function GenerateSrc has been removed as it's no longer required internally.
  • Previously, the Multi Tint methods batchSprite, batchTexture, batchTextureFrame and batchFillRect would all make heavy use of the TransformMatrix.getXRound and getYRound methods, which in turn called getX and getY and applied optional rounding to them. This is all now handled by one single function (setQuad) with no branching, meaning rendering one single sprite has cut down 16 function calls and 48 getters to just 1 function.

Lights Pipeline

  • The Light Pipe...
Read more

Phaser v3.60.0 Beta 13

26 Oct 16:07
Compare
Choose a tag to compare
Pre-release

Version 3.60.0 - Miku - in development

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - Vastly Improved Mobile Performance and WebGL Pipeline Changes

WebGL Renderer Updates

Due to all of the changes with how WebGL texture batching works a lot of mostly internal methods and properties have been removed. This is the complete list:

  • The WebGLRenderer.currentActiveTexture property has been removed.
  • The WebGLRenderer.startActiveTexture property has been removed.
  • The WebGLRenderer.tempTextures property has been removed.
  • The WebGLRenderer.textureZero property has been removed.
  • The WebGLRenderer.normalTexture property has been removed.
  • The WebGLRenderer.textueFlush property has been removed.
  • The WebGLRenderer.isTextureClean property has been removed.
  • The WebGLRenderer.setBlankTexture method has been removed.
  • The WebGLRenderer.setTextureSource method has been removed.
  • The WebGLRenderer.isNewNormalMap method has been removed.
  • The WebGLRenderer.setTextureZero method has been removed.
  • The WebGLRenderer.clearTextureZero method has been removed.
  • The WebGLRenderer.setNormalMap method has been removed.
  • The WebGLRenderer.clearNormalMap method has been removed.
  • The WebGLRenderer.unbindTextures method has been removed.
  • The WebGLRenderer.resetTextures method has been removed.
  • The WebGLRenderer.setTexture2D method has been removed.
  • The WebGLRenderer.pushFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.setFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.popFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.deleteTexture method has had the reset argument removed.
  • The Textures.TextureSource.glIndex property has been removed.
  • The Textures.TextureSource.glIndexCounter property has been removed.

Previously, WebGLRenderer.whiteTexture and WebGLRenderer.blankTexture had a data-type of WebGLTexture but they were actually Phaser.Textures.Frame instances. This has now been corrected and the two properties are now actually WebGLTexture instances, not Frames. If your code relies on this mistake being present, please adapt it.

Mobile Pipeline

  • The Mobile Pipeline is a new pipeline that extends the Multi Tint pipeline, but uses customized shaders and a single-bound texture specifically for mobile GPUs. This should restore mobile performance back to the levels it was around v3.22, before Multi Tint improved it all for desktop at the expense of mobile.
  • shaders/Mobile.vert and shaders/Mobile.frag are the two shaders used for the Mobile Pipeline.
  • PipelineManager#MOBILE_PIPELINE is a new constant-style reference to the Mobile Pipeline instance.
  • autoMobilePipeline is a new Game Configuration boolean that toggles if the Mobile Pipeline should be automatically deployed, or not. By default it is enabled, but you can set it to false to force use of the Multi Tint pipeline (or if you need more advanced conditions to check when to enable it)
  • defaultPipeline is a new Game Configuration property that allows you to set the default Game Object Pipeline. This is set to Multi Tint as standard, but you can set it to your own pipeline from this value.
  • PipelineManager.default is a new propery that is used by most Game Objects to determine which pipeline they will init with.
  • PipelineManager.setDefaultPipeline is a new method that allows you to change the default Game Object pipeline. You could use this to allow for more fine-grained conditional control over when to use Multi or Mobile (or another pipeline)
  • The PipelineManager.boot method is now passed the default pipeline and auto mobile setting from the Game Config.

Multi Tint Pipeline

  • If you have a customised Multi Tint Pipeline fragment shader that uses the %forloop% declaration, you should update it to follow the new format defined in Multi.frag. This new shader uses a function called getSampler instead. Please see the shader code and update your own shaders accordingly. You can also see the documentation for the MultiPipeline for details.
  • The Multi.frag shader now uses a highp precision, or mediump if the device doesn't support it (thanks @arbassic)
  • The WebGL.Utils.checkShaderMax function will no longer use a massive if/else glsl shader check and will instead rely on the value given in gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS).
  • The WebGL.Utils.parseFragmentShaderMaxTextures function no longer supports the %forloop% declaration.
  • The internal WebGL Utils function GenerateSrc has been removed as it's no longer required internally.
  • Previously...
Read more

Phaser v3.60.0 Beta 12

10 Oct 16:58
Compare
Choose a tag to compare
Pre-release

Version 3.60.0 - Miku - in development

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - Vastly Improved Mobile Performance and WebGL Pipeline Changes

WebGL Renderer Updates

Due to all of the changes with how WebGL texture batching works a lot of mostly internal methods and properties have been removed. This is the complete list:

  • The WebGLRenderer.currentActiveTexture property has been removed.
  • The WebGLRenderer.startActiveTexture property has been removed.
  • The WebGLRenderer.tempTextures property has been removed.
  • The WebGLRenderer.textureZero property has been removed.
  • The WebGLRenderer.normalTexture property has been removed.
  • The WebGLRenderer.textueFlush property has been removed.
  • The WebGLRenderer.isTextureClean property has been removed.
  • The WebGLRenderer.setBlankTexture method has been removed.
  • The WebGLRenderer.setTextureSource method has been removed.
  • The WebGLRenderer.isNewNormalMap method has been removed.
  • The WebGLRenderer.setTextureZero method has been removed.
  • The WebGLRenderer.clearTextureZero method has been removed.
  • The WebGLRenderer.setNormalMap method has been removed.
  • The WebGLRenderer.clearNormalMap method has been removed.
  • The WebGLRenderer.unbindTextures method has been removed.
  • The WebGLRenderer.resetTextures method has been removed.
  • The WebGLRenderer.setTexture2D method has been removed.
  • The WebGLRenderer.pushFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.setFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.popFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.deleteTexture method has had the reset argument removed.
  • The Textures.TextureSource.glIndex property has been removed.
  • The Textures.TextureSource.glIndexCounter property has been removed.

Previously, WebGLRenderer.whiteTexture and WebGLRenderer.blankTexture had a data-type of WebGLTexture but they were actually Phaser.Textures.Frame instances. This has now been corrected and the two properties are now actually WebGLTexture instances, not Frames. If your code relies on this mistake being present, please adapt it.

Mobile Pipeline

  • The Mobile Pipeline is a new pipeline that extends the Multi Tint pipeline, but uses customized shaders and a single-bound texture specifically for mobile GPUs. This should restore mobile performance back to the levels it was around v3.22, before Multi Tint improved it all for desktop at the expense of mobile.
  • shaders/Mobile.vert and shaders/Mobile.frag are the two shaders used for the Mobile Pipeline.
  • PipelineManager#MOBILE_PIPELINE is a new constant-style reference to the Mobile Pipeline instance.
  • autoMobilePipeline is a new Game Configuration boolean that toggles if the Mobile Pipeline should be automatically deployed, or not. By default it is enabled, but you can set it to false to force use of the Multi Tint pipeline (or if you need more advanced conditions to check when to enable it)
  • defaultPipeline is a new Game Configuration property that allows you to set the default Game Object Pipeline. This is set to Multi Tint as standard, but you can set it to your own pipeline from this value.
  • PipelineManager.default is a new propery that is used by most Game Objects to determine which pipeline they will init with.
  • PipelineManager.setDefaultPipeline is a new method that allows you to change the default Game Object pipeline. You could use this to allow for more fine-grained conditional control over when to use Multi or Mobile (or another pipeline)
  • The PipelineManager.boot method is now passed the default pipeline and auto mobile setting from the Game Config.

Multi Tint Pipeline

  • If you have a customised Multi Tint Pipeline fragment shader that uses the %forloop% declaration, you should update it to follow the new format defined in Multi.frag. This new shader uses a function called getSampler instead. Please see the shader code and update your own shaders accordingly. You can also see the documentation for the MultiPipeline for details.
  • The Multi.frag shader now uses a highp precision, or mediump if the device doesn't support it (thanks @arbassic)
  • The WebGL.Utils.checkShaderMax function will no longer use a massive if/else glsl shader check and will instead rely on the value given in gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS).
  • The WebGL.Utils.parseFragmentShaderMaxTextures function no longer supports the %forloop% declaration.
  • The internal WebGL Utils function GenerateSrc has been removed as it's no longer required internally.
  • Previously...
Read more

Phaser v3.60 Beta 11

09 Oct 17:13
Compare
Choose a tag to compare
Phaser v3.60 Beta 11 Pre-release
Pre-release

Version 3.60.0 - Miku - in development

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - New and Updated WebGL Pipelines

WebGL Renderer Updates

Due to all of the changes with how WebGL texture batching works a lot of mostly internal methods and properties have been removed. This is the complete list:

  • The WebGLRenderer.currentActiveTexture property has been removed.
  • The WebGLRenderer.startActiveTexture property has been removed.
  • The WebGLRenderer.tempTextures property has been removed.
  • The WebGLRenderer.textureZero property has been removed.
  • The WebGLRenderer.normalTexture property has been removed.
  • The WebGLRenderer.textueFlush property has been removed.
  • The WebGLRenderer.isTextureClean property has been removed.
  • The WebGLRenderer.setBlankTexture method has been removed.
  • The WebGLRenderer.setTextureSource method has been removed.
  • The WebGLRenderer.isNewNormalMap method has been removed.
  • The WebGLRenderer.setTextureZero method has been removed.
  • The WebGLRenderer.clearTextureZero method has been removed.
  • The WebGLRenderer.setNormalMap method has been removed.
  • The WebGLRenderer.clearNormalMap method has been removed.
  • The WebGLRenderer.unbindTextures method has been removed.
  • The WebGLRenderer.resetTextures method has been removed.
  • The WebGLRenderer.setTexture2D method has been removed.
  • The WebGLRenderer.pushFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.setFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.popFramebuffer method has had the resetTextures argument removed.
  • The WebGLRenderer.deleteTexture method has had the reset argument removed.
  • The Textures.TextureSource.glIndex property has been removed.
  • The Textures.TextureSource.glIndexCounter property has been removed.

Previously, WebGLRenderer.whiteTexture and WebGLRenderer.blankTexture had a data-type of WebGLTexture but they were actually Phaser.Textures.Frame instances. This has now been corrected and the two properties are now actually WebGLTexture instances, not Frames. If your code relies on this mistake being present, please adapt it.

Mobile Pipeline

  • The Mobile Pipeline is a new pipeline that extends the Multi Tint pipeline, but uses customized shaders and a single-bound texture specifically for mobile GPUs. This should restore mobile performance back to the levels it was around v3.22, before Multi Tint improved it all for desktop at the expense of mobile.
  • shaders/Mobile.vert and shaders/Mobile.frag are the two shaders used for the Mobile Pipeline.
  • PipelineManager#MOBILE_PIPELINE is a new constant-style reference to the Mobile Pipeline instance.
  • autoMobilePipeline is a new Game Configuration boolean that toggles if the Mobile Pipeline should be automatically deployed, or not. By default it is enabled, but you can set it to false to force use of the Multi Tint pipeline (or if you need more advanced conditions to check when to enable it)
  • defaultPipeline is a new Game Configuration property that allows you to set the default Game Object Pipeline. This is set to Multi Tint as standard, but you can set it to your own pipeline from this value.
  • PipelineManager.default is a new propery that is used by most Game Objects to determine which pipeline they will init with.
  • PipelineManager.setDefaultPipeline is a new method that allows you to change the default Game Object pipeline. You could use this to allow for more fine-grained conditional control over when to use Multi or Mobile (or another pipeline)
  • The PipelineManager.boot method is now passed the default pipeline and auto mobile setting from the Game Config.

Multi Tint Pipeline

  • If you have a customised Multi Tint Pipeline fragment shader that uses the %forloop% declaration, you should update it to follow the new format defined in Multi.frag. This new shader uses a function called getSampler instead. Please see the shader code and update your own shaders accordingly. You can also see the documentation for the MultiPipeline for details.
  • The Multi.frag shader now uses a highp precision, or mediump if the device doesn't support it (thanks @arbassic)
  • The WebGL.Utils.checkShaderMax function will no longer use a massive if/else glsl shader check and will instead rely on the value given in gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS).
  • The WebGL.Utils.parseFragmentShaderMaxTextures function no longer supports the %forloop% declaration.
  • The internal WebGL Utils function GenerateSrc has been removed as it's no longer required internally.
  • Previously, the Multi Tint methods `batchSpr...
Read more

Phaser v3.60 Beta 10

20 Sep 21:34
Compare
Choose a tag to compare
Phaser v3.60 Beta 10 Pre-release
Pre-release

Version 3.60.0 - Miku - in development

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

Development of this feature was kindly sponsored by Club Penguin Rewritten (https://cprewritten.net).

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - Multi Tint Pipeline

  • If you have a customised Multi Tint Pipeline fragment shader that uses the %forloop% declaration, you should update it to follow the new format defined in Multi.frag. This new shader uses a function called getSampler instead. Please see the shader code and update your own shaders accordingly. You can also see the documentation for the MultiPipeline for details.
  • The Multi.frag shader now uses a highp precision instead of mediump.
  • The WebGL.Utils.checkShaderMax function will no longer use a massive if/else glsl shader check and will instead rely on the value given in gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS).
  • The WebGL.Utils.parseFragmentShaderMaxTextures function no longer supports the %forloop% declaration.
  • The internal WebGL Utils function GenerateSrc has been removed as it's no longer required internally.

Removed - Graphics Pipeline

The WebGL Graphics Pipeline has been removed. This pipeline wasn't used in v3.55, as all Graphics rendering is handled by the MultiTint pipeline, for better batching support. No Phaser Game Objects use the Graphics pipeline any longer, so to save space it has been removed and is no longer installed by the Pipeline Manager.

New Features - Matter Physics v0.18

We have updated the version of Matter Physics to the latest v0.18 release. This is a big jump and brings with it quite a few internal changes to Matter. The following are the differences we have identified in this release:

  • Up to ~40% performance improvement (on average measured over all examples, in Node on a Mac Air M1)
  • Replaces Matter.Grid with a faster and more efficient broadphase in Matter.Detector.
  • Reduced memory usage and garbage collection.
  • Resolves issues in Matter.SAT related to collision reuse.
  • Removes performance issues from Matter.Grid.
  • Improved collision accuracy.
  • MatterPhysics.collision is a new reference to the Collision module, which now handles all Matter collision events.
  • MatterPhysics.grid has been removed as this is now handled by the Collision module.
  • MatterPhysics.sat has been removed as this is now handled by the Collision module.
  • The Matter.Body.previousPositionImpulse property has been removed as it's no longer used.

New Features - New Tween Manager

TODO - TweenData to class
TODO - TweenData and Tween State methods
TODO - CONST removals

The Phaser 3.60 Tween system has been recoded to help with performance and resolving some of its lingering issues and unifying the Tween events and callbacks.

The following are breaking changes:

  • Tween Timelines have been removed entirely. Due to the way they were implemented they tended to cause a range of esoteric timing bugs which were non-trivial to resolve. To that end, we made the decision to remove Timelines entirely and introduced the ability to chain tweens together using the new chain method. This should give most developers the same level of sequencing they had using Timelines, without the timing issues.
  • When creating a Tween, you can no longer pass a function for the following properties: duration, hold, repeat and repeatDelay. These should be numbers only. You can, however, still provide a function for delay, to keep it compatible with the StaggerBuilder.
  • The TweenManager#getAllTweens method has been renamed to TweenManager#getTweens. Functionally, it is the same.
  • The property and feature Tween.useFrames has been removed and is no longer a valid Tween Config option. Tweens are now entirely ms/time based.
  • The TweenOnUpdateCallback now has the following parameters: tween, targets, key (the property being tweened), current (the current value of the property), previous (the previous value of the property) and finally any of the params that were passed in the onUpdateParams array when the Tween was created.
  • The TweenOnYoyoCallback now has the following parameters: tween, targets, key (the property being tweened), current (the current value of the property), previous (the previous value of the property) and finally any of the params that were passed in the onYoyoParams array when the Tween was created.
  • The TweenOnRepeatCallback now has the following parameters: tween, targets, key (the property being tweened), current (the current value of the property), previous (the previous value of the property) and finally any of the params that were passed in the onRepeatParams array when the Tween was created.
  • `Tween...
Read more

Phaser v3.60 Beta 9

07 Jun 16:44
Compare
Choose a tag to compare
Phaser v3.60 Beta 9 Pre-release
Pre-release

Version 3.60.0 - Miku - in development

New Features - Sprite FX

  • When defining the renderTargets in a WebGL Pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given).
  • WebGLPipeline.isSpriteFX is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default is false.
  • GameObjects.Components.FX is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.
  • fxPadding and its related method setFXPadding allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.
  • The WebGLPipeline.setShader method has a new optional parameter buffer that allows you to set the vertex buffer to be bound before the shader is activated.
  • The WebGLPipeline.setVertexBuffer method has a new optional parameter buffer that allows you to set the vertex buffer to be bound if you don't want to bind the default one.
  • The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two.
  • RenderTarget will now automatically set the wrapping mode to clamp.
  • WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter.
  • PipelineManager.renderTargets is a new property that holds an array of RenderTarget objects that all SpriteFX pipelines can share, to keep texture memory as low as possible.
  • PipelineManager.maxDimension is a new property that holds the largest possible target dimension.
  • PipelineManager.frameInc is a new property that holds the amount the RenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.
  • PipelineManager.targetIndex is a new property that holds the internal target array offset index. Treat it as read-only.
  • The Pipeline Manager will now create a bunch of RenderTarget objects during its boot method. These are sized incrementally from 32px and up (use the frameInc value to alter this). These targets are shared by all Sprite FX Pipelines.
  • PipelineManager.getRenderTarget is a new method that will return the a RenderTarget that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.
  • PipelineManager.getSwapRenderTarget is a new method that will return a 'swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
  • PipelineManager.getAltSwapRenderTarget is a new method that will return a 'alternative swap' RenderTarget that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.

New Features - Compressed Texture Support

Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.

Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.

Development of this feature was kindly sponsored by Club Penguin Rewritten (https://cprewritten.net).

  • TextureSoure.compressionAlgorithm is now populated with the compression format used by the texture.
  • Types.Textures.CompressedTextureData is the new compressed texture configuration object type.
  • TextureManager.addCompressedTexture is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return a Texture object than any Sprite can use.
  • Textures.Parsers.KTXParser is a new parser for the KTX compression container format.
  • Textures.Parsers.PVRParser is a new parser for the PVR compression container format.
  • The WebGLRenderer.compression property now holds a more in-depth object containing supported compression formats.
  • The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them.
  • WebGLRenderer.getCompressedTextures is a new method that will populate the WebGLRenderer.compression object and return its value. This is called automatically when the renderer boots.
  • WebGLRenderer.getCompressedTextureName is a new method that will return a compressed texture format GLenum based on the given format.

New Features - Multi Tint Pipeline

  • If you have a customised Multi Tint Pipeline fragment shader that uses the %forloop% declaration, you should update it to follow the new format defined in Multi.frag. This new shader uses a function called getSampler instead. Please see the shader code and update your own shaders accordingly. You can also see the documentation for the MultiPipeline for details.
  • The Multi.frag shader now uses a highp precision instead of mediump.
  • The WebGL.Utils.checkShaderMax function will no longer use a massive if/else glsl shader check and will instead rely on the value given in gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS).
  • The WebGL.Utils.parseFragmentShaderMaxTextures function no longer supports the %forloop% declaration.
  • The internal WebGL Utils function GenerateSrc has been removed as it's no longer required internally.

New Features - Matter Physics v0.18

We have updated the version of Matter Physics to the latest v0.18 release. This is a big jump and brings with it quite a few internal changes to Matter. The following are the differences we have identified in this release:

  • Up to ~40% performance improvement (on average measured over all examples, in Node on a Mac Air M1)
  • Replaces Matter.Grid with a faster and more efficient broadphase in Matter.Detector.
  • Reduced memory usage and garbage collection.
  • Resolves issues in Matter.SAT related to collision reuse.
  • Removes performance issues from Matter.Grid.
  • Improved collision accuracy.
  • MatterPhysics.collision is a new reference to the Collision module, which now handles all Matter collision events.
  • MatterPhysics.grid has been removed as this is now handled by the Collision module.
  • MatterPhysics.sat has been removed as this is now handled by the Collision module.
  • The Matter.Body.previousPositionImpulse property has been removed as it's no longer used.

New Features

  • ScaleManager.getViewPort is a new method that will return a Rectangle geometry object that matches the visible area of the screen (thanks @rexrainbow)
  • When starting a Scene and using an invalid key, Phaser will now raise a console warning informing you of this, instead of silently failing. Fix #5811 (thanks @ubershmekel)
  • GameObjects.Layer.addToDisplayList and removeFromDisplayList are new methods that allows for you to now add a Layer as a child of another Layer. Fix #5799 (thanks @samme)
  • GameObjects.Video.loadURL has a new optional 4th parameter crossOrigin. This allows you to specify a cross origin request type when loading the video cross-domain (thanks @rmartell)
  • You can now set loader.imageLoadType: "HTMLImageElement" in your Game Configuration and the Phaser Loader will use an Image Tag to load all images, rather than XHR and a Blob object which is the default. This is a global setting, so all file types that use images, such as Atlas or Spritesheet, will be changed via this flag (thanks @hanzooo)
  • You can now control the drawing offset of tiles in a Tileset using the new optional property Tileset.tileOffset (which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix #5633 (thanks @moJiXiang @kainage)
  • You can now set the alpha value of the Camera Flash effect before running it, where-as previously it was always 1 (thanks @kainage)
  • The Tilemap.createFromObjects method has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand)
  • TweenManager.reset is a new method that will take a tween, remove it from all internal arrays, then seek it back to its start and set it as being active.
  • The Video config will now detect for x-m4v playback support for video formats and store it in the Video.m4v property. This is used automatically by the VideoFile file loader. Fix #5719 (thanks @patrickkeenan)
  • The KeyboardPlugin.removeKey method has a new optional parameter removeCapture. This will remove any keyboard capture events for the given Key. Fix #5693 (thanks @cyantree)
  • The KeyboardPlugin.removeAllKeys method has a new optional parameter removeCapture. This will remove any keyboard capture events for all of the Keys owned by the plugin.
  • WebGLShader.fragSrc is a new property that hold...
Read more