Skip to content

Commit 83f8f00

Browse files
committed
Now uses GetCalcMatrix
1 parent 3dbc547 commit 83f8f00

1 file changed

Lines changed: 4 additions & 31 deletions

File tree

src/gameobjects/extern/ExternWebGLRenderer.js

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* @license {@link https://opensource.org/licenses/MIT|MIT License}
55
*/
66

7+
var GetCalcMatrix = require('../GetCalcMatrix');
8+
79
/**
810
* Renders this Game Object with the WebGL Renderer to the given Camera.
911
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
@@ -15,44 +17,15 @@
1517
*
1618
* @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer.
1719
* @param {Phaser.GameObjects.Extern} src - The Game Object being rendered in this call.
18-
* @param {number} interpolationPercentage - Reserved for future use and custom pipelines.
1920
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object.
2021
* @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested
2122
*/
22-
var ExternWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
23+
var ExternWebGLRenderer = function (renderer, src, camera, parentMatrix)
2324
{
2425
renderer.pipelines.clear();
2526

26-
var camMatrix = renderer._tempMatrix1;
27-
var spriteMatrix = renderer._tempMatrix2;
28-
var calcMatrix = renderer._tempMatrix3;
29-
30-
spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY);
31-
32-
camMatrix.copyFrom(camera.matrix);
33-
34-
if (parentMatrix)
35-
{
36-
// Multiply the camera by the parent matrix
37-
camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY);
38-
39-
// Undo the camera scroll
40-
spriteMatrix.e = src.x;
41-
spriteMatrix.f = src.y;
42-
43-
// Multiply by the Sprite matrix, store result in calcMatrix
44-
camMatrix.multiply(spriteMatrix, calcMatrix);
45-
}
46-
else
47-
{
48-
spriteMatrix.e -= camera.scrollX * src.scrollFactorX;
49-
spriteMatrix.f -= camera.scrollY * src.scrollFactorY;
50-
51-
// Multiply by the Sprite matrix, store result in calcMatrix
52-
camMatrix.multiply(spriteMatrix, calcMatrix);
53-
}
27+
var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc;
5428

55-
// Callback
5629
src.render.call(src, renderer, camera, calcMatrix);
5730

5831
renderer.pipelines.rebind();

0 commit comments

Comments
 (0)