|
|
@ -306,11 +306,17 @@ public class HeightMap { |
|
|
|
|
|
|
|
|
|
|
|
Vector2f gridSquare; |
|
|
|
Vector2f gridSquare; |
|
|
|
|
|
|
|
|
|
|
|
if (zoneLoc.x < 0 || zoneLoc.x > this.fullExtentsX) |
|
|
|
if (zoneLoc.x < 0) |
|
|
|
return -1; |
|
|
|
zoneLoc.x = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (zoneLoc.y < 0) |
|
|
|
|
|
|
|
zoneLoc.y = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (zoneLoc.y < 0 || zoneLoc.y > this.fullExtentsY) |
|
|
|
if (zoneLoc.x > this.fullExtentsX) |
|
|
|
return -1; |
|
|
|
zoneLoc.x = this.fullExtentsX; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (zoneLoc.y > this.fullExtentsY) |
|
|
|
|
|
|
|
zoneLoc.y = this.fullExtentsY; |
|
|
|
|
|
|
|
|
|
|
|
int maxX = (int) (this.fullExtentsX / this.bucketWidthX); |
|
|
|
int maxX = (int) (this.fullExtentsX / this.bucketWidthX); |
|
|
|
int maxY = (int) (this.fullExtentsY / this.bucketWidthY); |
|
|
|
int maxY = (int) (this.fullExtentsY / this.bucketWidthY); |
|
|
@ -320,10 +326,15 @@ public class HeightMap { |
|
|
|
int gridX = (int) gridSquare.x; |
|
|
|
int gridX = (int) gridSquare.x; |
|
|
|
int gridY = (int) gridSquare.y; |
|
|
|
int gridY = (int) gridSquare.y; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gridX < 0) |
|
|
|
|
|
|
|
gridX = 0; |
|
|
|
|
|
|
|
if (gridY < 0) |
|
|
|
|
|
|
|
gridY = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (gridX > maxX) |
|
|
|
if (gridX > maxX) |
|
|
|
gridX = maxX; |
|
|
|
gridX = maxX - 1; |
|
|
|
if (gridY > maxY) |
|
|
|
if (gridY > maxY) |
|
|
|
gridY = maxY; |
|
|
|
gridY = maxY - 1; |
|
|
|
|
|
|
|
|
|
|
|
float offsetX = (gridSquare.x - gridX); |
|
|
|
float offsetX = (gridSquare.x - gridX); |
|
|
|
float offsetY = gridSquare.y - gridY; |
|
|
|
float offsetY = gridSquare.y - gridY; |
|
|
|