Fix FillRect.

It wasn't updated to the latest batch paradigm. This fixes camera
fill, flash, and fade.
This commit is contained in:
Ben Richards 2024-05-20 17:03:41 +12:00
parent 261399642e
commit fedf494a4c

View file

@ -31,15 +31,6 @@ var FillRect = new Class({
{ {
RenderNode.call(this, 'FillRect', manager, renderer); RenderNode.call(this, 'FillRect', manager, renderer);
/**
* Temporary matrix for computing the area covered by the rectangle.
*
* @name Phaser.Renderer.WebGL.RenderNodes.FillRect#_objectMatrix
* @type {Phaser.GameObjects.Components.TransformMatrix}
* @private
*/
this._objectMatrix = new TransformMatrix();
/** /**
* An unchanging identity matrix. * An unchanging identity matrix.
* *
@ -78,8 +69,6 @@ var FillRect = new Class({
*/ */
run: function (drawingContext, parentMatrix, x, y, width, height, tintTL, tintTR, tintBL, tintBR, tintFill, inWorldSpace) run: function (drawingContext, parentMatrix, x, y, width, height, tintTL, tintTR, tintBL, tintBR, tintFill, inWorldSpace)
{ {
this._objectMatrix.applyITRS(x, y, 0, width, height);
var currentMatrix = this._identityMatrix; var currentMatrix = this._identityMatrix;
if (inWorldSpace) if (inWorldSpace)
@ -93,17 +82,23 @@ var FillRect = new Class({
currentMatrix = this._calcMatrix; currentMatrix = this._calcMatrix;
} }
this.manager.nodes.BatchTexturedTintedRawQuads.batch( var quad = currentMatrix.setQuad(x, y, x + width, y + height);
this.manager.nodes.BatchTexturedTintedTransformedQuads.batch(
drawingContext, drawingContext,
this.renderer.whiteTexture, this.renderer.whiteTexture,
tintFill,
this._objectMatrix, // Quad vertices in TRIANGLE_STRIP order:
this._identityMatrix, quad[0], quad[1],
currentMatrix, quad[2], quad[3],
quad[6], quad[7],
quad[4], quad[5],
// Texture coordinates in X, Y, Width, Height: // Texture coordinates in X, Y, Width, Height:
0, 0, 1, 1, 0, 0, 1, 1,
tintFill,
// Tint colors in TRIANGLE_STRIP order: // Tint colors in TRIANGLE_STRIP order:
tintTL, tintTR, tintBL, tintBR tintTL, tintTR, tintBL, tintBR
); );