From affe6b08ab2f4e3287df78ecc6de332e53c94a3f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 12 Oct 2023 06:33:22 -0400 Subject: [PATCH] Method is now called --- src/engine/InterestManagement/Terrain.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index f49eb9f3..9de5e0a6 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -102,17 +102,26 @@ public class Terrain { // Retrieve the next zone with a terrain defined. Zone terrainZone = getNextZoneWithTerrain(zone); + Zone parentZone = getNextZoneWithTerrain(zone); // Transform world loc into zone space coordinate system Vector2f terrainLoc = ZoneManager.worldToTerrainSpace(world_loc, terrainZone); + Vector2f terrainOffset = ZoneManager.worldToZoneOffset(world_loc, terrainZone); + Vector2f parentLoc = ZoneManager.worldToTerrainSpace(world_loc, parentZone); // Interpolate height for this position in terrain float interpolatedChildHeight = terrainZone.terrain.getInterpolatedTerrainHeight(terrainLoc); interpolatedChildHeight += terrainZone.global_height; - return interpolatedChildHeight; + float interpolatedParentTerrainHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentLoc); + interpolatedParentTerrainHeight += parentZone.global_height; + + // Blend between terrains + + return interpolatedChildHeight + interpolatedParentTerrainHeight * (1 - terrainZone.terrain.terrainBlend(terrainOffset)); + } public static float getWorldHeight(Vector3fImmutable world_loc) {