|
|
|
@ -21,6 +21,8 @@ import static java.lang.Math.PI;
@@ -21,6 +21,8 @@ import static java.lang.Math.PI;
|
|
|
|
|
public class Terrain { |
|
|
|
|
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>(); |
|
|
|
|
public short[][] terrain_pixel_data; |
|
|
|
|
|
|
|
|
|
public Vector2f image_size = new Vector2f(); |
|
|
|
|
public Vector2f terrain_size = new Vector2f(); |
|
|
|
|
public Vector2f cell_size = new Vector2f(); |
|
|
|
|
public Vector2f cell_count = new Vector2f(); |
|
|
|
@ -44,6 +46,7 @@ public class Terrain {
@@ -44,6 +46,7 @@ public class Terrain {
|
|
|
|
|
// Load pixel data for this terrain from cache
|
|
|
|
|
|
|
|
|
|
this.terrain_pixel_data = Terrain._heightmap_pixel_cache.get(heightmap); |
|
|
|
|
this.image_size.set(this.terrain_pixel_data.length, this.terrain_pixel_data[0].length); |
|
|
|
|
|
|
|
|
|
if (terrain_pixel_data == null) |
|
|
|
|
Logger.error("Pixel map empty for zone: " + this.zone.getObjectUUID() + ":" + this.zone.zoneName); |
|
|
|
@ -53,8 +56,8 @@ public class Terrain {
@@ -53,8 +56,8 @@ public class Terrain {
|
|
|
|
|
this.terrain_size.x = this.zone.major_radius * 2; |
|
|
|
|
this.terrain_size.y = this.zone.minor_radius * 2; |
|
|
|
|
|
|
|
|
|
this.cell_count.x = this.terrain_pixel_data.length - 1; |
|
|
|
|
this.cell_count.y = this.terrain_pixel_data[0].length - 1; |
|
|
|
|
this.cell_count.x = this.image_size.x - 1; |
|
|
|
|
this.cell_count.y = this.image_size.y - 1; |
|
|
|
|
|
|
|
|
|
this.cell_size.x = terrain_size.x / this.cell_count.x; |
|
|
|
|
this.cell_size.y = terrain_size.y / this.cell_count.y; |
|
|
|
|