Skip to content

Commit abb16fb

Browse files
committed
Camera culling can be disabled
1 parent ed0d445 commit abb16fb

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

v3/src/camera/Camera.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ var Camera = new Class({
2626
this.zoom = 1.0;
2727
this.rotation = 0.0;
2828
this.matrix = new TransformMatrix(1, 0, 0, 1, 0, 0);
29+
30+
this.disableCull = false;
2931
this.culledObjects = [];
3032

3133
// shake
@@ -58,6 +60,11 @@ var Camera = new Class({
5860

5961
cull: function (renderableObjects)
6062
{
63+
if (this.disableCull)
64+
{
65+
return renderableObjects;
66+
}
67+
6168
var scrollX = this.scrollX;
6269
var scrollY = this.scrollY;
6370
var cameraW = this.width;
@@ -76,7 +83,9 @@ var Camera = new Class({
7683
var determinant = (mva * mvd) - (mvb * mvc);
7784

7885
if (!determinant)
86+
{
7987
return pointIn;
88+
}
8089

8190
determinant = 1 / determinant;
8291

@@ -94,8 +103,8 @@ var Camera = new Class({
94103
var object = renderableObjects[index];
95104

96105
/* Not every renderable object has a dimension */
97-
if (typeof object.width === 'number')
98-
{
106+
// if (typeof object.width === 'number')
107+
// {
99108
var objectW = object.width;
100109
var objectH = object.height;
101110
var objectX = (object.x - (scrollX * object.scrollFactorX)) - (objectW * object.originX);
@@ -112,11 +121,11 @@ var Camera = new Class({
112121
{
113122
culledObjects.push(object);
114123
}
115-
}
116-
else
117-
{
118-
culledObjects.push(object);
119-
}
124+
// }
125+
// else
126+
// {
127+
// culledObjects.push(object);
128+
// }
120129
}
121130

122131
return culledObjects;

0 commit comments

Comments
 (0)