|
|
@ -325,16 +325,16 @@ public class HeightMap { |
|
|
|
|
|
|
|
|
|
|
|
public Vector2f getGridSquare(Vector2f zoneLoc) { |
|
|
|
public Vector2f getGridSquare(Vector2f zoneLoc) { |
|
|
|
|
|
|
|
|
|
|
|
float xBucket = (zoneLoc.x / this.bucketWidthX); |
|
|
|
// Clamp values.
|
|
|
|
float yBucket = (zoneLoc.y / this.bucketWidthY); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Standing on the pole
|
|
|
|
if (zoneLoc.x >= this.fullExtentsX) |
|
|
|
|
|
|
|
Logger.error("Outside of zone"); |
|
|
|
|
|
|
|
|
|
|
|
if (xBucket == this.bucketCountX) |
|
|
|
if (zoneLoc.y >= this.fullExtentsY) |
|
|
|
xBucket--; |
|
|
|
Logger.error("Outside of zone"); |
|
|
|
|
|
|
|
|
|
|
|
if (yBucket == this.bucketCountY) |
|
|
|
float xBucket = zoneLoc.x / this.bucketWidthX; |
|
|
|
yBucket--; |
|
|
|
float yBucket = zoneLoc.y / this.bucketWidthY; |
|
|
|
|
|
|
|
|
|
|
|
return new Vector2f(xBucket, yBucket); |
|
|
|
return new Vector2f(xBucket, yBucket); |
|
|
|
} |
|
|
|
} |
|
|
|