This commit is contained in:
Richard Davey 2018-09-01 01:48:30 +01:00
commit d586483dc3
22 changed files with 205 additions and 149 deletions

View file

@ -197,6 +197,12 @@ You can find the source for Camera 3D in the new `plugins/camera3d` folder, alon
* In Matter.js if you scaled a Body it would only scale correctly once, due to the way Matter handles scaling internally. We now automatically reset the Matter scale before applying the new value, which allows you to keep the Phaser and Matter object scales in sync. Fix #3785 #3951 (thanks @bergben)
* The default Container Blend Mode is now `SKIP_TEST`. This allows you to either set a blend mode for a Container, in which case all children use that blend mode. Or, you can set a blend mode on the children and the children will render using their own blend modes, as the Container doesn't have one set. The WebGL and Canvas Renderer functions have also been updated to support this change. Fix #3684 (thanks @TadejZupancic)
* Previously the Input Manager would create a Touch handler unless the Game Config had `input.touch` set to `false` (the default was true). If no such property is set, it no longer defaults to `true` and instead is set to whatever `Device.input.touch` returns. On non-touchscreen desktops this means it will now only create one single Pointer, rather than two.
* The Arcade Physics Body `_tempMatrix` property has been removed. It was only used if the Body's Game Object had a parent. The matrix has been moved to the World instance instead, shared by all bodies.
* 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.
* The Input Manager has gained a new private property `_tempMatrix2`. This is used internally in the hitTest checks to avoid constant matrix creation.
* The Transform Matrix has a new method `applyInverse` which will take an x/y position and inverse translate it through the current matrix.
* 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)
* Calling `setTimeScale` on the Sprite's Animation component will now set the time scale value and keep it set until you change it again. Previously it would be reset to 1 when a new animation was loaded into the component, but this no longer happens - once the time scale is set it remains in effect, regardless of which animations are played on the Sprite.
### Game Config Resolution Specific Bug Fixes
@ -239,12 +245,16 @@ Setting the `resolution` property in the Game Config to a value other than 1 wou
* A Game Object couldn't have a blend mode of `SKIP_TEST` set by using the getter or the `setBlendMode` method.
* In Arcade Physics the `World.disable` call was passing the wrong argument, so never disabling the actual body (thanks @samme)
* There was a visual bug with Rounded Rectangles in Canvas mode, due to the addition of the `overshoot` argument in the Graphics arc call. This has been fixed, so arcs will now render correctly and consistently in WebGL and Canvas and Rounded Rectangles are back to normal again too. Fix #3912 (thanks @valse)
* 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)
* `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)
* 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)
* 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)
### Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs:
@SBCGames @rgk @rook2pawn @robbintt @bguyl @halilcakarr @PhaserEditor2D @Edwin222 @tfelix @Yudikubota @hexus @guzmonne @ampled @thanh-taro @dcbriccetti @Dreaded-Gnu @padme-amidala @rootasjey @ampled @thejonanshow @polarstoat @jdjoshuadavison @alexeymolchan @samme @PBird @kid-wumeng
@SBCGames @rgk @rook2pawn @robbintt @bguyl @halilcakarr @PhaserEditor2D @Edwin222 @tfelix @Yudikubota @hexus @guzmonne @ampled @thanh-taro @dcbriccetti @Dreaded-Gnu @padme-amidala @rootasjey @ampled @thejonanshow @polarstoat @jdjoshuadavison @alexeymolchan @samme @PBird @spontoreau @hypertrifle @kid-wumeng
Thanks to @khaleb85 for fixing the super-annoying lag on the API Docs pages when it hung the browser while indexing the search field.

View file

@ -529,7 +529,6 @@ var Animation = new Class({
component.msPerFrame = this.msPerFrame;
component.skipMissedFrames = this.skipMissedFrames;
component._timeScale = 1;
component._delay = this.delay;
component._repeat = this.repeat;
component._repeatDelay = this.repeatDelay;

View file

@ -86,7 +86,7 @@ var ValueToColor = require('../display/color/ValueToColor');
*
* @property {boolean} [antialias=true] - [description]
* @property {boolean} [pixelArt=false] - [description]
* @property {boolean} [autoResize=false] - [description]
* @property {boolean} [autoResize=true] - Automatically resize the Game Canvas if you resize the renderer.
* @property {boolean} [roundPixels=false] - [description]
* @property {boolean} [transparent=false] - [description]
* @property {boolean} [clearBeforeRender=true] - [description]
@ -451,9 +451,9 @@ var Config = new Class({
var renderConfig = GetValue(config, 'render', config);
/**
* @const {boolean} Phaser.Boot.Config#autoResize - [description]
* @const {boolean} Phaser.Boot.Config#autoResize - Automatically resize the Game Canvas if you resize the renderer.
*/
this.autoResize = GetValue(renderConfig, 'autoResize', false);
this.autoResize = GetValue(renderConfig, 'autoResize', true);
/**
* @const {boolean} Phaser.Boot.Config#antialias - [description]

View file

@ -261,6 +261,8 @@ var Camera = new Class({
/**
* Sets the Camera to render to a texture instead of to the main display.
*
* Make sure that you resize the camera first if you're going to use this feature.
*
* This is an experimental feature and should be expected to change in the future.
*
* @method Phaser.Cameras.Scene2D.Camera#setRenderToTexture

View file

@ -509,6 +509,7 @@ var Animation = new Class({
this.forward = true;
this._reverse = false;
return this._startAnimation(key, startFrame);
},
@ -537,6 +538,7 @@ var Animation = new Class({
this.forward = false;
this._reverse = true;
return this._startAnimation(key, startFrame);
},

View file

@ -427,12 +427,14 @@ var Transform = {
* @since 3.4.0
*
* @param {Phaser.GameObjects.Components.TransformMatrix} [tempMatrix] - The matrix to populate with the values from this Game Object.
* @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A temporary matrix to hold parent values during the calculations.
*
* @return {Phaser.GameObjects.Components.TransformMatrix} The populated Transform Matrix.
*/
getWorldTransformMatrix: function (tempMatrix)
getWorldTransformMatrix: function (tempMatrix, parentMatrix)
{
if (tempMatrix === undefined) { tempMatrix = new TransformMatrix(); }
if (parentMatrix === undefined) { parentMatrix = new TransformMatrix(); }
var parent = this.parentContainer;
@ -441,31 +443,17 @@ var Transform = {
return this.getLocalTransformMatrix(tempMatrix);
}
var parents = [];
tempMatrix.applyITRS(this.x, this.y, this._rotation, this._scaleX, this._scaleY);
while (parent)
{
parents.unshift(parent);
parentMatrix.applyITRS(parent.x, parent.y, parent._rotation, parent._scaleX, parent._scaleY);
parentMatrix.multiply(tempMatrix, tempMatrix);
parent = parent.parentContainer;
}
tempMatrix.loadIdentity();
var length = parents.length;
for (var i = 0; i < length; ++i)
{
parent = parents[i];
tempMatrix.translate(parent.x, parent.y);
tempMatrix.rotate(parent.rotation);
tempMatrix.scale(parent.scaleX, parent.scaleY);
}
tempMatrix.translate(this.x, this.y);
tempMatrix.rotate(this._rotation);
tempMatrix.scale(this._scaleX, this._scaleY);
return tempMatrix;
}

View file

@ -5,6 +5,7 @@
*/
var Class = require('../../utils/Class');
var Vector2 = require('../../math/Vector2');
/**
* @classdesc
@ -419,12 +420,12 @@ var TransformMatrix = new Class({
var destinationMatrix = (out === undefined) ? this : out;
destinationMatrix.a = sourceA * localA + sourceB * localC;
destinationMatrix.b = sourceA * localB + sourceB * localD;
destinationMatrix.c = sourceC * localA + sourceD * localC;
destinationMatrix.d = sourceC * localB + sourceD * localD;
destinationMatrix.e = sourceE * localA + sourceF * localC + localE;
destinationMatrix.f = sourceE * localB + sourceF * localD + localF;
destinationMatrix.a = (sourceA * localA) + (sourceB * localC);
destinationMatrix.b = (sourceA * localB) + (sourceB * localD);
destinationMatrix.c = (sourceC * localA) + (sourceD * localC);
destinationMatrix.d = (sourceC * localB) + (sourceD * localD);
destinationMatrix.e = (sourceE * localA) + (sourceF * localC) + localE;
destinationMatrix.f = (sourceE * localB) + (sourceF * localD) + localF;
return destinationMatrix;
},
@ -802,6 +803,42 @@ var TransformMatrix = new Class({
return this;
},
/**
* Takes the `x` and `y` values and returns a new position in the `output` vector that is the inverse of
* the current matrix with its transformation applied.
*
* Can be used to translate points from world to local space.
*
* @method Phaser.GameObjects.Components.TransformMatrix#applyInverse
* @since 3.12.0
*
* @param {number} x - The x position to translate.
* @param {number} y - The y position to translate.
* @param {Phaser.Math.Vector2} [output] - A Vector2, or point-like object, to store the results in.
*
* @return {Phaser.Math.Vector2} The coordinates, inverse-transformed through this matrix.
*/
applyInverse: function (x, y, output)
{
if (output === undefined) { output = new Vector2(); }
var matrix = this.matrix;
var a = matrix[0];
var b = matrix[1];
var c = matrix[2];
var d = matrix[3];
var tx = matrix[4];
var ty = matrix[5];
var id = 1 / ((a * d) + (c * -b));
output.x = (d * id * x) + (-c * id * y) + (((ty * c) - (tx * d)) * id);
output.y = (a * id * y) + (-b * id * x) + (((-ty * a) + (tx * b)) * id);
return output;
},
/**
* Returns the X component of this matrix multiplied by the given values.
* This is the same as `x * a + y * c + e`.

View file

@ -438,6 +438,7 @@ var Container = new Class({
/**
* Returns the world transform matrix as used for Bounds checks.
*
* The returned matrix is temporal and shouldn't be stored.
*
* @method Phaser.GameObjects.Container#getBoundsTransformMatrix
@ -447,7 +448,7 @@ var Container = new Class({
*/
getBoundsTransformMatrix: function ()
{
return this.getWorldTransformMatrix(this.tempTransformMatrix);
return this.getWorldTransformMatrix(this.tempTransformMatrix, this.localTransform);
},
/**

View file

@ -15,7 +15,7 @@ var GameObjectFactory = require('../GameObjectFactory');
* @method Phaser.GameObjects.GameObjectFactory#group
* @since 3.0.0
*
* @param {(Phaser.GameObjects.GameObject[]|GroupConfig||GroupConfig[])} [children] - Game Objects to add to this Group; or the `config` argument.
* @param {(Phaser.GameObjects.GameObject[]|GroupConfig|GroupConfig[])} [children] - Game Objects to add to this Group; or the `config` argument.
* @param {GroupConfig} [config] - A Group Configuration object.
*
* @return {Phaser.GameObjects.Group} The Game Object that was created.

View file

@ -336,6 +336,16 @@ var InputManager = new Class({
*/
this._tempMatrix = new TransformMatrix();
/**
* A re-cycled matrix used in hit test calculations.
*
* @name Phaser.Input.InputManager#_tempMatrix2
* @type {Phaser.GameObjects.Components.TransformMatrix}
* @private
* @since 3.12.0
*/
this._tempMatrix2 = new TransformMatrix();
game.events.once('boot', this.boot, this);
},
@ -1050,14 +1060,15 @@ var InputManager = new Class({
* @since 3.10.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to test.
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera which is being tested against.
*
* @return {boolean} `true` if the Game Object should be considered for input, otherwise `false`.
*/
inputCandidate: function (gameObject)
inputCandidate: function (gameObject, camera)
{
var input = gameObject.input;
if (!input || !input.enabled || !gameObject.willRender())
if (!input || !input.enabled || !gameObject.willRender(camera))
{
return false;
}
@ -1069,7 +1080,7 @@ var InputManager = new Class({
{
do
{
if (!parent.visible)
if (!parent.willRender(camera))
{
visible = false;
break;
@ -1135,12 +1146,15 @@ var InputManager = new Class({
var point = { x: 0, y: 0 };
var matrix = this._tempMatrix;
var parentMatrix = this._tempMatrix2;
for (var i = 0; i < gameObjects.length; i++)
{
var gameObject = gameObjects[i];
if (!this.inputCandidate(gameObject))
// Checks if the Game Object can receive input (isn't being ignored by the camera, invisible, etc)
// and also checks all of its parents, if any
if (!this.inputCandidate(gameObject, camera))
{
continue;
}
@ -1150,9 +1164,9 @@ var InputManager = new Class({
if (gameObject.parentContainer)
{
gameObject.getWorldTransformMatrix(matrix);
gameObject.getWorldTransformMatrix(matrix, parentMatrix);
TransformXY(px, py, matrix.tx, matrix.ty, matrix.rotation, matrix.scaleX, matrix.scaleY, point);
matrix.applyInverse(px, py, point);
}
else
{

View file

@ -276,7 +276,8 @@ var KeyboardPlugin = new Class({
/**
* @typedef {object} CursorKeys
*
* @memberOf Phaser.Input.Keyboard
*
* @property {Phaser.Input.Keyboard.Key} [up] - A Key object mapping to the UP arrow key.
* @property {Phaser.Input.Keyboard.Key} [down] - A Key object mapping to the DOWN arrow key.
* @property {Phaser.Input.Keyboard.Key} [left] - A Key object mapping to the LEFT arrow key.
@ -343,7 +344,11 @@ var KeyboardPlugin = new Class({
for (var i = 0; i < keys.length; i++)
{
output[keys[i]] = this.addKey(keys[i]);
var currentKey = keys[i].trim();
if (currentKey)
{
output[currentKey] = this.addKey(currentKey);
}
}
}
else

View file

@ -28,31 +28,20 @@ var TransformXY = function (x, y, positionX, positionY, rotation, scaleX, scaleY
{
if (output === undefined) { output = new Vector2(); }
// ITRS
var radianSin = Math.sin(rotation);
var radianCos = Math.cos(rotation);
var sr = Math.sin(-rotation);
var cr = Math.cos(-rotation);
var a = cr * scaleX;
var b = -sr * scaleX;
var c = sr * scaleY;
var d = cr * scaleY;
// Rotate and Scale
var a = radianCos * scaleX;
var b = radianSin * scaleX;
var c = -radianSin * scaleY;
var d = radianCos * scaleY;
// Invert
var id = 1 / ((a * d) + (c * -b));
var n = a * d - b * c;
var m0 = d / n;
var m1 = -b / n;
var m2 = -c / n;
var m3 = a / n;
var m4 = (c * positionY - d * positionX) / n;
var m5 = -(a * positionY - b * positionX) / n;
// Transform
output.x = x * m0 + y * m2 + m4;
output.y = x * m1 + y * m3 + m5;
output.x = (d * id * x) + (-c * id * y) + (((positionY * c) - (positionX * d)) * id);
output.y = (a * id * y) + (-b * id * x) + (((-positionY * a) + (positionX * b)) * id);
return output;
};

View file

@ -10,7 +10,6 @@ var CONST = require('./const');
var RadToDeg = require('../../math/RadToDeg');
var Rectangle = require('../../geom/rectangle/Rectangle');
var RectangleContains = require('../../geom/rectangle/Contains');
var TransformMatrix = require('../../gameobjects/components/TransformMatrix');
var Vector2 = require('../../math/Vector2');
/**
@ -761,8 +760,6 @@ var Body = new Class({
* @since 3.0.0
*/
this._bounds = new Rectangle();
this._tempMatrix = new TransformMatrix();
},
/**
@ -781,7 +778,7 @@ var Body = new Class({
if (sprite.parentContainer)
{
var matrix = sprite.getWorldTransformMatrix(this._tempMatrix);
var matrix = sprite.getWorldTransformMatrix(this.world._tempMatrix, this.world._tempMatrix2);
transform.x = matrix.tx;
transform.y = matrix.ty;

View file

@ -666,6 +666,16 @@ var StaticBody = new Class({
return (this.isCircle) ? CircleContains(this, x, y) : RectangleContains(this, x, y);
},
/**
* NOOP
*
* @method Phaser.Physics.Arcade.StaticBody#postUpdate
* @since 3.12.0
*/
postUpdate: function ()
{
},
/**
* [description]
*

View file

@ -27,6 +27,7 @@ var SeparateY = require('./SeparateY');
var Set = require('../../structs/Set');
var StaticBody = require('./StaticBody');
var TileIntersectsBody = require('./tilemap/TileIntersectsBody');
var TransformMatrix = require('../../gameobjects/components/TransformMatrix');
var Vector2 = require('../../math/Vector2');
var Wrap = require('../../math/Wrap');
@ -478,6 +479,26 @@ var World = new Class({
*/
this.treeMinMax = { minX: 0, minY: 0, maxX: 0, maxY: 0 };
/**
* A temporary Transform Matrix used by bodies for calculations without them needing their own local copy.
*
* @name Phaser.Physics.Arcade.World#_tempMatrix
* @type {Phaser.GameObjects.Components.TransformMatrix}
* @private
* @since 3.12.0
*/
this._tempMatrix = new TransformMatrix();
/**
* A temporary Transform Matrix used by bodies for calculations without them needing their own local copy.
*
* @name Phaser.Physics.Arcade.World#_tempMatrix2
* @type {Phaser.GameObjects.Components.TransformMatrix}
* @private
* @since 3.12.0
*/
this._tempMatrix2 = new TransformMatrix();
if (this.drawDebug)
{
this.createDebugGraphic();
@ -1436,9 +1457,15 @@ var World = new Class({
{
this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2);
}
else if (body1.onCollide || body2.onCollide)
else
{
this.emit('collide', body1.gameObject, body2.gameObject, body1, body2);
body1.postUpdate();
body2.postUpdate();
if (body1.onCollide || body2.onCollide)
{
this.emit('collide', body1.gameObject, body2.gameObject, body1, body2);
}
}
}

View file

@ -849,7 +849,11 @@ var WebGLRenderer = new Class({
this.flush();
// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/scissor
gl.scissor(x, (this.drawingBufferHeight - y - h), w, h);
if (w > 0 && h > 0)
{
gl.scissor(x, (this.drawingBufferHeight - y - h), w, h);
}
}
},
@ -1086,6 +1090,10 @@ var WebGLRenderer = new Class({
width = framebuffer.renderTexture.width;
height = framebuffer.renderTexture.height;
}
else
{
this.flush();
}
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
@ -1526,14 +1534,16 @@ var WebGLRenderer = new Class({
var cw = camera._cw;
var ch = camera._ch;
this.pushScissor(cx, cy, cw, ch);
var TextureTintPipeline = this.pipelines.TextureTintPipeline;
var color = camera.backgroundColor;
if (camera.renderToTexture)
{
this.flush();
this.pushScissor(cx, cy, cw, -ch);
this.setFramebuffer(camera.framebuffer);
var gl = this.gl;
@ -1542,12 +1552,12 @@ var WebGLRenderer = new Class({
gl.clear(gl.COLOR_BUFFER_BIT);
TextureTintPipeline.projOrtho(0, camera.width, 0, camera.height, -1000, 1000);
TextureTintPipeline.projOrtho(cx, cw + cx, cy, ch + cy, -1000, 1000);
if (color.alphaGL > 0)
{
TextureTintPipeline.drawFillRect(
cx, cy, cw, ch,
0, 0, cw + cx, ch + cy,
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
color.alphaGL
);
@ -1555,12 +1565,18 @@ var WebGLRenderer = new Class({
}
else if (color.alphaGL > 0)
{
this.pushScissor(cx, cy, cw, ch);
TextureTintPipeline.drawFillRect(
cx, cy, cw, ch,
0, 0, cw + cx, ch + cy,
Utils.getTintFromFloats(color.redGL, color.greenGL, color.blueGL, 1),
color.alphaGL
);
}
else
{
this.pushScissor(cx, cy, cw, ch);
}
},
/**
@ -1585,6 +1601,7 @@ var WebGLRenderer = new Class({
if (camera.renderToTexture)
{
// this.flush();
TextureTintPipeline.flush();
this.setFramebuffer(null);
@ -1593,9 +1610,9 @@ var WebGLRenderer = new Class({
var getTint = Utils.getTintAppendFloatAlpha;
var p = (camera.pipeline) ? camera.pipeline : TextureTintPipeline;
p.batchTexture(
var pipeline = (camera.pipeline) ? camera.pipeline : TextureTintPipeline;
pipeline.batchTexture(
camera,
camera.glTexture,
camera.width, camera.height,
@ -1617,6 +1634,8 @@ var WebGLRenderer = new Class({
null
);
// this.setPipeline(TextureTintPipeline);
// Force clear the current texture so that items next in the batch (like Graphics) don't try and use it
this.setBlankTexture(true);
}
@ -1704,16 +1723,19 @@ var WebGLRenderer = new Class({
this.setBlendMode(child.blendMode);
}
if (child.mask)
var mask = child.mask;
if (mask)
{
child.mask.preRenderWebGL(this, child, camera);
mask.preRenderWebGL(this, child, camera);
child.renderWebGL(this, child, interpolationPercentage, camera);
mask.postRenderWebGL(this, child);
}
child.renderWebGL(this, child, interpolationPercentage, camera);
if (child.mask)
else
{
child.mask.postRenderWebGL(this, child);
child.renderWebGL(this, child, interpolationPercentage, camera);
}
}

View file

@ -157,26 +157,28 @@ var BitmapMaskPipeline = new Class({
*/
beginMask: function (mask, maskedObject, camera)
{
var bitmapMask = mask.bitmapMask;
var renderer = this.renderer;
var gl = this.gl;
var visible = bitmapMask.visible;
// The renderable Game Object that is being used for the bitmap mask
var bitmapMask = mask.bitmapMask;
if (bitmapMask && gl)
{
renderer.flush();
// First we clear the mask framebuffer
renderer.setFramebuffer(mask.maskFramebuffer);
gl.clearColor(0, 0, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT);
// We render our mask source
bitmapMask.visible = true;
bitmapMask.renderWebGL(renderer, bitmapMask, 0.0, camera);
bitmapMask.visible = visible;
bitmapMask.renderWebGL(renderer, bitmapMask, 0, camera);
renderer.flush();
// Bind and clear our main source (masked object)
renderer.setFramebuffer(mask.mainFramebuffer);
gl.clearColor(0, 0, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT);
}
@ -195,11 +197,13 @@ var BitmapMaskPipeline = new Class({
*/
endMask: function (mask)
{
var bitmapMask = mask.bitmapMask;
var renderer = this.renderer;
var gl = this.gl;
if (bitmapMask)
// The renderable Game Object that is being used for the bitmap mask
var bitmapMask = mask.bitmapMask;
if (bitmapMask && gl)
{
// Return to default framebuffer
renderer.setFramebuffer(null);

View file

@ -733,9 +733,6 @@ var TextureTintPipeline = new Class({
var width = srcWidth;
var height = srcHeight;
// var x = -displayOriginX + frameX;
// var y = -displayOriginY + frameY;
var x = -displayOriginX;
var y = -displayOriginY;
@ -789,13 +786,6 @@ var TextureTintPipeline = new Class({
y += srcHeight;
}
// Do we need this? (doubt it)
// if (camera.roundPixels)
// {
// x |= 0;
// y |= 0;
// }
var xw = x + width;
var yh = y + height;

View file

@ -1,23 +0,0 @@
module.exports = [
'#extension GL_EXT_draw_buffers : require',
'',
'#define SHADER_NAME PHASER_GBUFFER_FS',
'',
'precision mediump float;',
'',
'uniform sampler2D uMainSampler;',
'uniform sampler2D uNormSampler;',
'',
'varying vec2 outTexCoord;',
'varying vec4 outTint;',
'',
'void main()',
'{',
' vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);',
' vec3 normal = texture2D(uNormSampler, outTexCoord).rgb;',
'',
' gl_FragData[0] = color;',
' gl_FragData[1] = vec4(normal, color.a);',
'}',
''
].join('\n');

View file

@ -17,13 +17,14 @@ module.exports = [
'',
' if (outTintEffect == 0.0)',
' {',
' // Multiply tint',
' // Multiply texture tint',
' color = texture * texel;',
' }',
' else if (outTintEffect == 1.0)',
' {',
' // Solid texture-based tint',
' color.rgb = mix(texture.rgb, outTint.rgb, texture.a);',
' // Solid color + texture alpha',
' color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);',
' color.a = texture.a * texel.a;',
' }',
' else if (outTintEffect == 2.0)',
' {',

View file

@ -1,20 +0,0 @@
#extension GL_EXT_draw_buffers : require
#define SHADER_NAME PHASER_GBUFFER_FS
precision mediump float;
uniform sampler2D uMainSampler;
uniform sampler2D uNormSampler;
varying vec2 outTexCoord;
varying vec4 outTint;
void main()
{
vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.rgb * outTint.a, outTint.a);
vec3 normal = texture2D(uNormSampler, outTexCoord).rgb;
gl_FragData[0] = color;
gl_FragData[1] = vec4(normal, color.a);
}

View file

@ -22,7 +22,8 @@ void main()
else if (outTintEffect == 1.0)
{
// Solid color + texture alpha
color.rgb = mix(texture.rgb, outTint.rgb, texture.a);
color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);
color.a = texture.a * texel.a;
}
else if (outTintEffect == 2.0)
{