From 79bf0523a5cafcb44c542b906801016c7e5f6016 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 8 Oct 2023 21:50:27 -0400 Subject: [PATCH] Constructor filled in --- src/engine/InterestManagement/Terrain.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index 463f8fe8..be730b55 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -22,7 +22,6 @@ public class Terrain { public static final HashMap _heightmap_pixel_cache = new HashMap<>(); Zone zone; public short[][] terrain_pixel_data; - public Vector2f terrain_size = new Vector2f(); public Vector2f cell_size = new Vector2f(); public Vector2f cell_count = new Vector2f(); @@ -35,8 +34,15 @@ public class Terrain { this.terrain_size.x = zone.major_radius; this.terrain_size.y = zone.minor_radius; - this.terrain_pixel_data = + this.terrain_pixel_data = _heightmap_pixel_cache.get(zone.terrain_image); + + this.cell_count.x = this.terrain_pixel_data.length - 1; + this.cell_count.y = this.terrain_pixel_data[0].length - 1; + + this.cell_size.x = terrain_size.x / this.cell_count.x; + this.cell_size.y = terrain_size.y / this.cell_count.y; + this.terrain_scale = zone.terrain_max_y / 255f; }