From a3a3070158016cfc0fd96dbdb1d6710c06aa9f10 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 17 Sep 2023 07:42:46 -0400 Subject: [PATCH] Blending configuration setup in SetParent() --- src/engine/InterestManagement/HeightMap.java | 4 ++-- src/engine/objects/Zone.java | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index fef1edf9..5be2524f 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -55,8 +55,8 @@ public class HeightMap { private float seaLevel = 0; private int[][] pixelColorValues; - private float zone_minBlend; - private float zone_maxBlend; + public float zone_minBlend; + public float zone_maxBlend; public HeightMap(ResultSet rs) throws SQLException { diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 67b356bc..e92b3feb 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -60,6 +60,10 @@ public class Zone extends AbstractGameObject { private float seaLevel = 0f; public static final Set respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>()); public static long lastRespawn = 0; + + public Bounds minBlend; + public Bounds maxBlend; + /** * ResultSet Constructor */ @@ -162,9 +166,6 @@ public class Zone extends AbstractGameObject { */ public void setBounds() { - float halfExtentX; - float halfExtentY; - // Set initial bounds object this.bounds = Bounds.borrow(); @@ -185,6 +186,16 @@ public class Zone extends AbstractGameObject { else bounds.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents), 0.0f); + HeightMap heightMap = this.getHeightMap(); + + // Set heightmap blending bounds + + if (heightMap != null) { + this.minBlend = Bounds.borrow(); + this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents).subtract(heightMap.zone_maxBlend, heightMap.zone_maxBlend), 0.0f); + this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), new Vector2f(Enum.CityBoundsType.ZONE.extents, Enum.CityBoundsType.ZONE.extents).subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f); + } + } public int getPlayerCityUUID() {