Browse Source

Grid flip testing

feature-workorder
MagicBot 1 year ago
parent
commit
afb1ad8e94
  1. 21
      src/engine/InterestManagement/HeightMap.java

21
src/engine/InterestManagement/HeightMap.java

@ -15,7 +15,6 @@ import engine.gameManager.ZoneManager; @@ -15,7 +15,6 @@ import engine.gameManager.ZoneManager;
import engine.math.Vector2f;
import engine.math.Vector3fImmutable;
import engine.objects.Zone;
import engine.util.MapLoader;
import org.pmw.tinylog.Logger;
import javax.imageio.ImageIO;
@ -92,7 +91,7 @@ public class HeightMap { @@ -92,7 +91,7 @@ public class HeightMap {
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
this.heightmapImage = MapLoader.flipImage(this.heightmapImage);
// this.heightmapImage = MapLoader.flipImage(this.heightmapImage);
// Calculate the data we do not load from table
@ -122,14 +121,11 @@ public class HeightMap { @@ -122,14 +121,11 @@ public class HeightMap {
this.outsetX = 128;
this.outsetZ = 128;
// Cache the full extents to avoid the calculation
this.fullExtentsX = halfExtentsX * 2;
this.fullExtentsY = halfExtentsY * 2;
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
this.heightmapImage = null;
// Calculate the data we do not load from table
@ -163,8 +159,6 @@ public class HeightMap { @@ -163,8 +159,6 @@ public class HeightMap {
this.fullExtentsX = halfExtentsX * 2;
this.fullExtentsY = halfExtentsY * 2;
// We needed to flip the image as OpenGL and Shadowbane both use the bottom left corner as origin.
this.heightmapImage = null;
// Calculate the data we do not load from table
@ -325,7 +319,6 @@ public class HeightMap { @@ -325,7 +319,6 @@ public class HeightMap {
HeightMap.GeneratePlayerCityHeightMap();
// Clear all heightmap image data as it's no longer needed.
for (HeightMap heightMap : HeightMap.heightmapByLoadNum.values()) {
@ -351,14 +344,18 @@ public class HeightMap { @@ -351,14 +344,18 @@ public class HeightMap {
if (zoneLoc.x < 0)
zoneLoc.setX(0);
if (zoneLoc.x > this.fullExtentsX - 1)
zoneLoc.setX((this.fullExtentsX - 1) + .9999999f);
if (zoneLoc.x >= this.fullExtentsX)
zoneLoc.setX(this.fullExtentsX);
if (zoneLoc.y < 0)
zoneLoc.setY(0);
if (zoneLoc.y > this.fullExtentsY - 1)
zoneLoc.setY((this.fullExtentsY - 1) + .9999999f);
if (zoneLoc.y > this.fullExtentsY)
zoneLoc.setY(this.fullExtentsY);
// Flip Y coordinates
zoneLoc.setY(this.fullExtentsY - zoneLoc.y);
float xBucket = (zoneLoc.x / this.bucketWidthX);
float yBucket = (zoneLoc.y / this.bucketWidthY);

Loading…
Cancel
Save