mirror of
https://github.com/photonstorm/phaser
synced 2024-11-17 10:18:42 +00:00
Merge pull request #4093 from Cirras/patch-1
Fix Camera culling bugs (Issue #4092)
This commit is contained in:
commit
8a974915d8
1 changed files with 5 additions and 4 deletions
|
@ -727,11 +727,12 @@ 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 cullW = cameraW + objectW;
|
||||
var cullH = cameraH + objectH;
|
||||
var cullTop = this.y;
|
||||
var cullBottom = cullTop + cameraH;
|
||||
var cullLeft = this.x;
|
||||
var cullRight = cullLeft + cameraW;
|
||||
|
||||
if (tx > -objectW && ty > -objectH && tx < cullW && ty < cullH &&
|
||||
tw > -objectW && th > -objectH && tw < cullW && th < cullH)
|
||||
if ((tw > cullLeft && tx < cullRight) && (th > cullTop && ty < cullBottom))
|
||||
{
|
||||
culledObjects.push(object);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue