diff --git a/src/cameras/2d/Camera.js b/src/cameras/2d/Camera.js index bc3b118cb..30779ddcb 100644 --- a/src/cameras/2d/Camera.js +++ b/src/cameras/2d/Camera.js @@ -550,7 +550,7 @@ var Camera = new Class({ { var object = renderableObjects[index]; - if (!object.hasOwnProperty('width')) + if (!object.hasOwnProperty('width') || object.parentContainer) { culledObjects.push(object); continue; @@ -628,7 +628,7 @@ var Camera = new Class({ { var object = interactiveObjects[index].gameObject; - if (!object.hasOwnProperty('width')) + if (!object.hasOwnProperty('width') || object.parentContainer) { culledObjects.push(interactiveObjects[index]); continue; @@ -655,73 +655,6 @@ var Camera = new Class({ return culledObjects; }, - /** - * [description] - * - * @method Phaser.Cameras.Scene2D.Camera#cullTilemap - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.Tilemap} tilemap - [description] - * - * @return {Phaser.GameObjects.GameObject[]} [description] - */ - cullTilemap: function (tilemap) - { - var cameraMatrix = this.matrix.matrix; - - var mva = cameraMatrix[0]; - var mvb = cameraMatrix[1]; - var mvc = cameraMatrix[2]; - var mvd = cameraMatrix[3]; - - /* First Invert Matrix */ - var determinant = (mva * mvd) - (mvb * mvc); - - var tiles = tilemap.tiles; - - if (!determinant) - { - return tiles; - } - - var mve = cameraMatrix[4]; - var mvf = cameraMatrix[5]; - var scrollX = this.scrollX; - var scrollY = this.scrollY; - var cameraW = this.width; - var cameraH = this.height; - var culledObjects = this.culledObjects; - var length = tiles.length; - var tileW = tilemap.tileWidth; - var tileH = tilemap.tileHeight; - var cullW = cameraW + tileW; - var cullH = cameraH + tileH; - var scrollFactorX = tilemap.scrollFactorX; - var scrollFactorY = tilemap.scrollFactorY; - - determinant = 1 / determinant; - - culledObjects.length = 0; - - for (var index = 0; index < length; ++index) - { - var tile = tiles[index]; - var tileX = (tile.x - (scrollX * scrollFactorX)); - var tileY = (tile.y - (scrollY * scrollFactorY)); - var tx = (tileX * mva + tileY * mvc + mve); - var ty = (tileX * mvb + tileY * mvd + mvf); - var tw = ((tileX + tileW) * mva + (tileY + tileH) * mvc + mve); - var th = ((tileX + tileW) * mvb + (tileY + tileH) * mvd + mvf); - - if (tx > -tileW && ty > -tileH && tw < cullW && th < cullH) - { - culledObjects.push(tile); - } - } - - return culledObjects; - }, - /** * Fades the Camera in from the given color over the duration specified. *