|
4 | 4 | * @license {@link https://opensource.org/licenses/MIT|MIT License} |
5 | 5 | */ |
6 | 6 |
|
| 7 | +var GetCalcMatrix = require('../GetCalcMatrix'); |
| 8 | + |
7 | 9 | /** |
8 | 10 | * Renders this Game Object with the WebGL Renderer to the given Camera. |
9 | 11 | * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. |
|
15 | 17 | * |
16 | 18 | * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. |
17 | 19 | * @param {Phaser.GameObjects.Extern} src - The Game Object being rendered in this call. |
18 | | - * @param {number} interpolationPercentage - Reserved for future use and custom pipelines. |
19 | 20 | * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. |
20 | 21 | * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested |
21 | 22 | */ |
22 | | -var ExternWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix) |
| 23 | +var ExternWebGLRenderer = function (renderer, src, camera, parentMatrix) |
23 | 24 | { |
24 | 25 | renderer.pipelines.clear(); |
25 | 26 |
|
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; |
54 | 28 |
|
55 | | - // Callback |
56 | 29 | src.render.call(src, renderer, camera, calcMatrix); |
57 | 30 |
|
58 | 31 | renderer.pipelines.rebind(); |
|
0 commit comments