mirror of
https://github.com/photonstorm/phaser
synced 2024-09-20 22:41:54 +00:00
GameObject.willRender
now takes a Camera as its only argument and uses it within the check. This has allowed me to remove 23 duplicate checks spread across the various Game Objects, all of which did the same thing, saving both KB and CPU time as the flags were being checked twice in most cases.
This commit is contained in:
parent
1d697b1371
commit
ec5bd1912e
27 changed files with 57 additions and 99 deletions
|
@ -13,6 +13,7 @@
|
|||
* `Camera.x` and `Camera.y` have been turned into getters / setters, mapped to the internal private values `_x` and `_y` respectively. This is so that setting the Camera viewport position directly will now update the new internal resolution calculation vars too.
|
||||
* `Camera.setScene` will now set the Cameras `resolution` property at the same time and update the internal viewport vars.
|
||||
* The `Cull Tiles` method used by the Dynamic Tilemap Layer has had a nice and significant optimization. It will now use the cull area dimensions to restrict the amount of tile iteration that takes place per layer, resulting in dramatic reductions in processing time on large layers, or multiple layers (thanks @tarsupin)
|
||||
* `GameObject.willRender` now takes a Camera as its only argument and uses it within the check. This has allowed me to remove 23 duplicate checks spread across the various Game Objects, all of which did the same thing, saving both KB and CPU time as the flags were being checked twice in most cases.
|
||||
|
||||
### Game Config Resolution Specific Bug Fixes
|
||||
|
||||
|
|
|
@ -436,15 +436,18 @@ var GameObject = new Class({
|
|||
|
||||
/**
|
||||
* Compares the renderMask with the renderFlags to see if this Game Object will render or not.
|
||||
* Also checks the Game Object against the given Cameras exclusion list.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObject#willRender
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object.
|
||||
*
|
||||
* @return {boolean} True if the Game Object should be rendered, otherwise false.
|
||||
*/
|
||||
willRender: function ()
|
||||
willRender: function (camera)
|
||||
{
|
||||
return (GameObject.RENDER_MASK === this.renderFlags);
|
||||
return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter > 0 && (this.cameraFilter & camera.id)));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc
|
|||
var text = src.text;
|
||||
var textLength = text.length;
|
||||
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
if (textLength === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, interpolationPerce
|
|||
var text = src.text;
|
||||
var textLength = text.length;
|
||||
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
||||
if (textLength === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage,
|
|||
var text = src._text;
|
||||
var textLength = text.length;
|
||||
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
if (textLength === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage,
|
|||
var text = src._text;
|
||||
var textLength = text.length;
|
||||
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || textLength === 0 || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
||||
if (textLength === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ var BlitterCanvasRenderer = function (renderer, src, interpolationPercentage, ca
|
|||
{
|
||||
var list = src.getRenderList();
|
||||
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)) || list.length === 0)
|
||||
if (list.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@ var Utils = require('../../renderer/webgl/Utils');
|
|||
*/
|
||||
var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
||||
var list = src.getRenderList();
|
||||
|
||||
if (list.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -48,7 +50,6 @@ var BlitterWebGLRenderer = function (renderer, src, interpolationPercentage, cam
|
|||
cameraScrollY = 0;
|
||||
}
|
||||
|
||||
var list = src.getRenderList();
|
||||
var blitterX = src.x - cameraScrollX;
|
||||
var blitterY = src.y - cameraScrollY;
|
||||
var prevTextureSourceIndex = -1;
|
||||
|
|
|
@ -24,12 +24,13 @@ var GameObject = require('../GameObject');
|
|||
*/
|
||||
var ContainerCanvasRenderer = function (renderer, container, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== container.renderFlags || (container.cameraFilter > 0 && (container.cameraFilter & camera._id)))
|
||||
var children = container.list;
|
||||
|
||||
if (children.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var children = container.list;
|
||||
var transformMatrix = container.localTransform;
|
||||
|
||||
if (parentMatrix === undefined)
|
||||
|
@ -49,9 +50,9 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
|
|||
var scrollFactorX = container.scrollFactorX;
|
||||
var scrollFactorY = container.scrollFactorY;
|
||||
|
||||
for (var index = 0; index < children.length; ++index)
|
||||
for (var i = 0; i < children.length; i++)
|
||||
{
|
||||
var child = children[index];
|
||||
var child = children[i];
|
||||
var childAlpha = child._alpha;
|
||||
var childScrollFactorX = child.scrollFactorX;
|
||||
var childScrollFactorY = child.scrollFactorY;
|
||||
|
|
|
@ -24,12 +24,13 @@ var GameObject = require('../GameObject');
|
|||
*/
|
||||
var ContainerWebGLRenderer = function (renderer, container, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== container.renderFlags || (container.cameraFilter > 0 && (container.cameraFilter & camera._id)))
|
||||
var children = container.list;
|
||||
|
||||
if (children.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var children = container.list;
|
||||
var transformMatrix = container.localTransform;
|
||||
|
||||
if (parentMatrix === undefined)
|
||||
|
@ -49,9 +50,9 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent
|
|||
var scrollFactorX = container.scrollFactorX;
|
||||
var scrollFactorY = container.scrollFactorY;
|
||||
|
||||
for (var index = 0; index < children.length; ++index)
|
||||
for (var i = 0; i < children.length; i++)
|
||||
{
|
||||
var child = children[index];
|
||||
var child = children[i];
|
||||
var childAlpha = child._alpha;
|
||||
var childScrollFactorX = child.scrollFactorX;
|
||||
var childScrollFactorY = child.scrollFactorY;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
var Commands = require('./Commands');
|
||||
var GameObject = require('../GameObject');
|
||||
|
||||
/**
|
||||
* Renders this Game Object with the Canvas Renderer to the given Camera.
|
||||
|
@ -26,7 +25,10 @@ var GameObject = require('../GameObject');
|
|||
*/
|
||||
var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix, renderTargetCtx, allowClip)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
var commandBuffer = src.commandBuffer;
|
||||
var commandBufferLength = commandBuffer.length;
|
||||
|
||||
if (commandBufferLength === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -38,7 +40,6 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c
|
|||
var srcScaleX = src.scaleX;
|
||||
var srcScaleY = src.scaleY;
|
||||
var srcRotation = src.rotation;
|
||||
var commandBuffer = src.commandBuffer;
|
||||
var ctx = renderTargetCtx || renderer.currentContext;
|
||||
var lineAlpha = 1.0;
|
||||
var fillAlpha = 1.0;
|
||||
|
@ -92,7 +93,7 @@ var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, c
|
|||
ctx.fillStyle = '#fff';
|
||||
ctx.globalAlpha = src.alpha;
|
||||
|
||||
for (var index = 0, length = commandBuffer.length; index < length; ++index)
|
||||
for (var index = 0; index < commandBufferLength; ++index)
|
||||
{
|
||||
var commandID = commandBuffer[index];
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
|
||||
/**
|
||||
* Renders this Game Object with the WebGL Renderer to the given Camera.
|
||||
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
|
||||
|
@ -16,19 +14,22 @@ var GameObject = require('../GameObject');
|
|||
* @private
|
||||
*
|
||||
* @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer.
|
||||
* @param {Phaser.GameObjects.Graphics} graphics - The Game Object being rendered in this call.
|
||||
* @param {Phaser.GameObjects.Graphics} src - The Game Object being rendered in this call.
|
||||
* @param {number} interpolationPercentage - Reserved for future use and custom pipelines.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object.
|
||||
* @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested
|
||||
*/
|
||||
var GraphicsWebGLRenderer = function (renderer, graphics, interpolationPercentage, camera, parentMatrix)
|
||||
var GraphicsWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== graphics.renderFlags || (graphics.cameraFilter > 0 && (graphics.cameraFilter & camera._id)))
|
||||
var commandBuffer = src.commandBuffer;
|
||||
var commandBufferLength = commandBuffer.length;
|
||||
|
||||
if (commandBufferLength === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.pipeline.batchGraphics(this, camera, parentMatrix);
|
||||
this.pipeline.batchGraphics(src, camera, parentMatrix);
|
||||
};
|
||||
|
||||
module.exports = GraphicsWebGLRenderer;
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
|
||||
/**
|
||||
* Renders this Game Object with the Canvas Renderer to the given Camera.
|
||||
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
|
||||
|
@ -23,11 +21,6 @@ var GameObject = require('../GameObject');
|
|||
*/
|
||||
var ImageCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.drawImage(src, camera, parentMatrix);
|
||||
};
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
|
||||
/**
|
||||
* Renders this Game Object with the WebGL Renderer to the given Camera.
|
||||
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
|
||||
|
@ -23,11 +21,6 @@ var GameObject = require('../GameObject');
|
|||
*/
|
||||
var ImageWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.pipeline.batchSprite(src, camera, parentMatrix);
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
var Utils = require('../../renderer/webgl/Utils');
|
||||
|
||||
/**
|
||||
|
@ -24,11 +23,6 @@ var Utils = require('../../renderer/webgl/Utils');
|
|||
*/
|
||||
var MeshWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var pipeline = this.pipeline;
|
||||
|
||||
renderer.setPipeline(pipeline, src);
|
||||
|
|
|
@ -24,8 +24,9 @@ var GameObject = require('../GameObject');
|
|||
var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
var emitters = emitterManager.emitters.list;
|
||||
var emittersLength = emitters.length;
|
||||
|
||||
if (emitters.length === 0 || GameObject.RENDER_MASK !== emitterManager.renderFlags || (emitterManager.cameraFilter > 0 && (emitterManager.cameraFilter & camera._id)))
|
||||
if (emittersLength === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -41,7 +42,7 @@ var ParticleManagerCanvasRenderer = function (renderer, emitterManager, interpol
|
|||
ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < emitters.length; i++)
|
||||
for (var i = 0; i < emittersLength; i++)
|
||||
{
|
||||
var emitter = emitters[i];
|
||||
|
||||
|
|
|
@ -24,8 +24,9 @@ var GameObject = require('../GameObject');
|
|||
var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
var emitters = emitterManager.emitters.list;
|
||||
var emittersLength = emitters.length;
|
||||
|
||||
if (emitters.length === 0 || GameObject.RENDER_MASK !== emitterManager.renderFlags || (emitterManager.cameraFilter > 0 && (emitterManager.cameraFilter & camera._id)))
|
||||
if (emittersLength === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -43,7 +44,7 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola
|
|||
|
||||
pipeline.setTexture2D(texture, 0);
|
||||
|
||||
for (var e = 0; e < emitters.length; e++)
|
||||
for (var e = 0; e < emittersLength; e++)
|
||||
{
|
||||
var emitter = emitters[e];
|
||||
var particles = emitter.alive;
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
|
||||
/**
|
||||
* Renders this Game Object with the Canvas Renderer to the given Camera.
|
||||
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
|
||||
|
@ -23,11 +21,6 @@ var GameObject = require('../GameObject');
|
|||
*/
|
||||
var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== renderTexture.renderFlags || (renderTexture.cameraFilter > 0 && (renderTexture.cameraFilter & camera._id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var ctx = renderer.currentContext;
|
||||
|
||||
// Alpha
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
var Utils = require('../../renderer/webgl/Utils');
|
||||
|
||||
/**
|
||||
|
@ -24,11 +23,6 @@ var Utils = require('../../renderer/webgl/Utils');
|
|||
*/
|
||||
var RenderTextureWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var getTint = Utils.getTintAppendFloatAlpha;
|
||||
|
||||
this.pipeline.batchTexture(
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
|
||||
/**
|
||||
* Renders this Game Object with the Canvas Renderer to the given Camera.
|
||||
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
|
||||
|
@ -23,11 +21,6 @@ var GameObject = require('../GameObject');
|
|||
*/
|
||||
var SpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.drawImage(src, camera, parentMatrix);
|
||||
};
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
|
||||
/**
|
||||
* Renders this Game Object with the WebGL Renderer to the given Camera.
|
||||
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
|
||||
|
@ -23,11 +21,6 @@ var GameObject = require('../GameObject');
|
|||
*/
|
||||
var SpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.pipeline.batchSprite(src, camera, parentMatrix);
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ var GameObject = require('../../GameObject');
|
|||
*/
|
||||
var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)) || src.text === '')
|
||||
if (src.text === '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ var Utils = require('../../../renderer/webgl/Utils');
|
|||
*/
|
||||
var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)) || src.text === '')
|
||||
if (src.text === '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
|
||||
/**
|
||||
* Renders this Game Object with the Canvas Renderer to the given Camera.
|
||||
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
|
||||
|
@ -23,11 +21,6 @@ var GameObject = require('../GameObject');
|
|||
*/
|
||||
var TileSpriteCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var ctx = renderer.currentContext;
|
||||
var frame = src.frame;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var GameObject = require('../GameObject');
|
||||
var Utils = require('../../renderer/webgl/Utils');
|
||||
|
||||
/**
|
||||
|
@ -24,11 +23,6 @@ var Utils = require('../../renderer/webgl/Utils');
|
|||
*/
|
||||
var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera.id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
src.updateTileTexture();
|
||||
|
||||
var getTint = Utils.getTintAppendFloatAlpha;
|
||||
|
|
|
@ -380,6 +380,9 @@ var CanvasRenderer = new Class({
|
|||
*/
|
||||
render: function (scene, children, interpolationPercentage, camera)
|
||||
{
|
||||
var list = children.list;
|
||||
var childCount = list.length;
|
||||
|
||||
var cx = camera._cx;
|
||||
var cy = camera._cy;
|
||||
var cw = camera._cw;
|
||||
|
@ -387,7 +390,6 @@ var CanvasRenderer = new Class({
|
|||
|
||||
var ctx = scene.sys.context;
|
||||
var scissor = (cx !== 0 || cy !== 0 || cw !== ctx.canvas.width || ch !== ctx.canvas.height);
|
||||
var list = children.list;
|
||||
|
||||
this.currentContext = ctx;
|
||||
|
||||
|
@ -425,9 +427,14 @@ var CanvasRenderer = new Class({
|
|||
|
||||
ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
|
||||
|
||||
for (var c = 0; c < list.length; c++)
|
||||
for (var i = 0; i < childCount; i++)
|
||||
{
|
||||
var child = list[c];
|
||||
var child = list[i];
|
||||
|
||||
if (!child.willRender(camera))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child.mask)
|
||||
{
|
||||
|
|
|
@ -1574,11 +1574,11 @@ var WebGLRenderer = new Class({
|
|||
// Apply scissor for cam region + render background color, if not transparent
|
||||
this.preRenderCamera(camera);
|
||||
|
||||
for (var index = 0; index < childCount; ++index)
|
||||
for (var i = 0; i < childCount; i++)
|
||||
{
|
||||
var child = list[index];
|
||||
var child = list[i];
|
||||
|
||||
if (!child.willRender())
|
||||
if (!child.willRender(camera))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue