Browse Source

clamping cleaned up.

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
227bd0523e
  1. 24
      src/engine/InterestManagement/HeightMap.java

24
src/engine/InterestManagement/HeightMap.java

@ -328,6 +328,8 @@ public class HeightMap { @@ -328,6 +328,8 @@ public class HeightMap {
public Vector2f getGridSquare(Vector2f zoneLoc) {
// Clamp values.
if (zoneLoc.x < 0)
zoneLoc.setX(0);
@ -354,18 +356,6 @@ public class HeightMap { @@ -354,18 +356,6 @@ public class HeightMap {
Vector2f gridSquare;
if (zoneLoc.x < 0)
zoneLoc.x = 0;
if (zoneLoc.y < 0)
zoneLoc.y = 0;
if (zoneLoc.x > this.fullExtentsX)
zoneLoc.x = this.fullExtentsX;
if (zoneLoc.y > this.fullExtentsY)
zoneLoc.y = this.fullExtentsY;
int maxX = (int) (this.fullExtentsX / this.bucketWidthX);
int maxY = (int) (this.fullExtentsY / this.bucketWidthY);
@ -374,16 +364,6 @@ public class HeightMap { @@ -374,16 +364,6 @@ public class HeightMap {
int gridX = (int) gridSquare.x;
int gridY = (int) gridSquare.y;
if (gridX < 0)
gridX = 0;
if (gridY < 0)
gridY = 0;
if (gridX >= maxX)
gridX = maxX - 1;
if (gridY >= maxY)
gridY = maxY - 1;
float offsetX = (gridSquare.x - gridX);
float offsetY = gridSquare.y - gridY;

Loading…
Cancel
Save