mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 13:43:26 +00:00
Merge pull request #5154 from samme/feature/camera-cull-opt
Tiny optimization for BaseCamera#cull
This commit is contained in:
commit
17e9a762a0
1 changed files with 4 additions and 4 deletions
|
@ -756,6 +756,10 @@ var BaseCamera = new Class({
|
|||
var scrollY = this.scrollY;
|
||||
var cameraW = this.width;
|
||||
var cameraH = this.height;
|
||||
var cullTop = this.y;
|
||||
var cullBottom = cullTop + cameraH;
|
||||
var cullLeft = this.x;
|
||||
var cullRight = cullLeft + cameraW;
|
||||
var culledObjects = this.culledObjects;
|
||||
var length = renderableObjects.length;
|
||||
|
||||
|
@ -781,10 +785,6 @@ var BaseCamera = new Class({
|
|||
var ty = (objectX * mvb + objectY * mvd + mvf);
|
||||
var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve);
|
||||
var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf);
|
||||
var cullTop = this.y;
|
||||
var cullBottom = cullTop + cameraH;
|
||||
var cullLeft = this.x;
|
||||
var cullRight = cullLeft + cameraW;
|
||||
|
||||
if ((tw > cullLeft && tx < cullRight) && (th > cullTop && ty < cullBottom))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue