Skip to content

Commit

Permalink
Removed unused assignment and extended condition where necessary as t…
Browse files Browse the repository at this point in the history
…his variable could cause a 1/0 sometimes
  • Loading branch information
Tomas Heinsohn Huala authored and TCatshoek committed Mar 16, 2018
1 parent 2ea8489 commit ef72c0d
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/cameras/2d/Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,6 @@ var Camera = new Class({
var culledObjects = this.culledObjects;
var length = renderableObjects.length;

determinant = 1 / determinant;

culledObjects.length = 0;

for (var index = 0; index < length; ++index)
Expand Down Expand Up @@ -556,8 +554,6 @@ var Camera = new Class({
var cameraH = this.height;
var length = interactiveObjects.length;

determinant = 1 / determinant;

var culledObjects = [];

for (var index = 0; index < length; ++index)
Expand Down Expand Up @@ -615,7 +611,7 @@ var Camera = new Class({

if (!determinant)
{
return tiles;
return tilemap.tiles;
}

var mve = cameraMatrix[4];
Expand All @@ -634,8 +630,6 @@ var Camera = new Class({
var scrollFactorX = tilemap.scrollFactorX;
var scrollFactorY = tilemap.scrollFactorY;

determinant = 1 / determinant;

culledObjects.length = 0;

for (var index = 0; index < length; ++index)
Expand Down Expand Up @@ -765,7 +759,7 @@ var Camera = new Class({
/* First Invert Matrix */
var determinant = (mva * mvd) - (mvb * mvc);

if (!determinant)
if (!determinant || determinant === 0)
{
output.x = x;
output.y = y;
Expand Down Expand Up @@ -1323,7 +1317,7 @@ var Camera = new Class({
{
this._shakeOffsetX = (Math.random() * intensity * this.width * 2 - intensity * this.width) * this.zoom;
this._shakeOffsetY = (Math.random() * intensity * this.height * 2 - intensity * this.height) * this.zoom;

if (this.roundPixels)
{
this._shakeOffsetX |= 0;
Expand Down

0 comments on commit ef72c0d

Please sign in to comment.