Skip to content

Commit ecae9d0

Browse files
committed
The setTintFill method would ignore the alpha value of the Game Object in the shader. The alpha value is now blended with the tint fill, allowing you to properly alpha out tint-filled Game Objects. Fix phaserjs#3992
1 parent 1f85920 commit ecae9d0

5 files changed

Lines changed: 8 additions & 47 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ You can find the source for Camera 3D in the new `plugins/camera3d` folder, alon
201201
* Arcade Physics World has gained two new private properties `_tempMatrix` and `_tempMatrix2`. These are used by all bodies in the simulation that need a temporal matrix for calculations, rather than having their own instances.
202202
* The Input Manager has gained a new private property `_tempMatrix2`. This is used internally in the hitTest checks to avoid constant matrix creation.
203203
* The Transform Matrix has a new method `applyInverse` which will take an x/y position and inverse translate it through the current matrix.
204+
* Using `keyboard.addKeys("W, A, S, D")` would fail because of the spacing between the characters. `addKeys` will now trim the input allowing you to space characters out if you prefer (thanks @dhruvyad)
204205

205206
### Game Config Resolution Specific Bug Fixes
206207

@@ -246,6 +247,7 @@ Setting the `resolution` property in the Game Config to a value other than 1 wou
246247
* The `InputManager.inputCandidate` method, which determines if a Game Object can be interacted with by a given Pointer and Camera combination, now takes the full camera status into consideration. This means if a Camera is set to ignore a Game Object you can now longer interact with it, or if the Camera is ignoring a Container with an interactive Game Object inside it, you cannot interact with the Container children any more. Previously they would interact regardless of the Camera state. Fix #3984 (thanks @NemoStein @samid737)
247248
* `Transform.getWorldTransformMatrix` has been recoded to iterate the transform parents correctly, applying the matrix multiplications as it goes. This (along with some changes in the Input Manager) fix the issue with Game Objects inside of Containers failing hit tests between certain angles. Fix #3920 (thanks @chaping @hackhat)
248249
* Calling Arcade Physics `collide` during an `update` method wouldn't inject the results back into the Body parent, causing the bodies to carry on moving. Using Colliders worked, but manually checking did not. Now, both methods work. Fix #3777 (thanks @samme)
250+
* The `setTintFill` method would ignore the `alpha` value of the Game Object in the shader. The alpha value is now blended with the tint fill, allowing you to properly alpha out tint-filled Game Objects. Fix #3992 (thanks @trl-bsd)
249251

250252
### Examples, Documentation and TypeScript
251253

src/renderer/webgl/shaders/GBuffer-frag.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/renderer/webgl/shaders/TextureTint-frag.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ module.exports = [
1717
'',
1818
' if (outTintEffect == 0.0)',
1919
' {',
20-
' // Multiply tint',
20+
' // Multiply texture tint',
2121
' color = texture * texel;',
2222
' }',
2323
' else if (outTintEffect == 1.0)',
2424
' {',
25-
' // Solid texture-based tint',
26-
' color.rgb = mix(texture.rgb, outTint.rgb, texture.a);',
25+
' // Solid color + texture alpha',
26+
' color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);',
27+
' color.a = texture.a * texel.a;',
2728
' }',
2829
' else if (outTintEffect == 2.0)',
2930
' {',

src/renderer/webgl/shaders/src/GBuffer.frag

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/renderer/webgl/shaders/src/TextureTint.frag

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ void main()
2222
else if (outTintEffect == 1.0)
2323
{
2424
// Solid color + texture alpha
25-
color.rgb = mix(texture.rgb, outTint.rgb, texture.a);
25+
color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);
26+
color.a = texture.a * texel.a;
2627
}
2728
else if (outTintEffect == 2.0)
2829
{

0 commit comments

Comments
 (0)