From 68794c170b77c9d68afcf55fb18deae7a79aed1f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 11 Sep 2023 14:30:14 -0400 Subject: [PATCH] Removed usless method: added grid to cmd output. --- src/engine/InterestManagement/HeightMap.java | 73 -------------------- src/engine/devcmd/cmds/GetHeightCmd.java | 6 ++ 2 files changed, 6 insertions(+), 73 deletions(-) diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index ff03dbce..3904107a 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -315,79 +315,6 @@ public class HeightMap { } - public static float getOutsetHeight(float interpolatedAltitude, Zone zone, Vector3fImmutable worldLocation) { - - Vector2f parentLoc; - float outsetALt = 0; - - if (zone.getParent() == null || zone.getParent().getHeightMap() == null) - return interpolatedAltitude + zone.getWorldAltitude(); - - if (zone.getParent() != null && zone.getParent().getHeightMap() != null) { - - parentLoc = ZoneManager.worldToZoneSpace(worldLocation, zone.getParent()); - - Vector3fImmutable localLocFromCenter = ZoneManager.worldToLocal(worldLocation, zone); - - float parentXRadius = zone.getBounds().getHalfExtents().x; - float parentZRadius = zone.getBounds().getHalfExtents().y; - - float bucketScaleX = zone.getHeightMap().outsetX / parentXRadius; - float bucketScaleZ = zone.getHeightMap().outsetZ / parentZRadius; - - float outsideGridSizeX = 1 - bucketScaleX; //32/256 - float outsideGridSizeZ = 1 - bucketScaleZ; - - float weight; - double scale; - - float offsetX = Math.abs((localLocFromCenter.x / parentXRadius)); - float offsetZ = Math.abs((localLocFromCenter.z / parentZRadius)); - - if (offsetX > outsideGridSizeX && offsetX > offsetZ) { - weight = (offsetX - outsideGridSizeX) / bucketScaleX; - scale = Math.atan2((.5 - weight) * 3.1415927, 1); - - float scaleChild = (float) ((scale + 1) * .5); - float scaleParent = 1 - scaleChild; - - float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc); - float parentCenterAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone.getParent())); - - parentCenterAltitude += zone.getYCoord(); - parentCenterAltitude += interpolatedAltitude; - - float firstScale = parentAltitude * scaleParent; - float secondScale = parentCenterAltitude * scaleChild; - outsetALt = firstScale + secondScale; - - outsetALt += zone.getParent().getAbsY(); - - } else if (offsetZ > outsideGridSizeZ) { - - weight = (offsetZ - outsideGridSizeZ) / bucketScaleZ; - scale = Math.atan2((.5 - weight) * 3.1415927, 1); - - float scaleChild = (float) ((scale + 1) * .5); - float scaleParent = 1 - scaleChild; - float parentAltitude = zone.getParent().getHeightMap().getInterpolatedTerrainHeight(parentLoc); - float parentCenterAltitude = zone.getHeightMap().getInterpolatedTerrainHeight(ZoneManager.worldToZoneSpace(zone.getLoc(), zone)); - - parentCenterAltitude += zone.getYCoord(); - parentCenterAltitude += interpolatedAltitude; - - float firstScale = parentAltitude * scaleParent; - float secondScale = parentCenterAltitude * scaleChild; - outsetALt = firstScale + secondScale; - - outsetALt += zone.getParent().getAbsY(); - } - - } - - return outsetALt; - } - public static void loadAlHeightMaps() { // Load the heightmaps into staging hashmap keyed by HashMapID diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java index b189d499..f7cbca51 100644 --- a/src/engine/devcmd/cmds/GetHeightCmd.java +++ b/src/engine/devcmd/cmds/GetHeightCmd.java @@ -12,6 +12,7 @@ package engine.devcmd.cmds; import engine.InterestManagement.HeightMap; import engine.devcmd.AbstractDevCmd; import engine.gameManager.ZoneManager; +import engine.math.Vector2f; import engine.objects.AbstractGameObject; import engine.objects.PlayerCharacter; import engine.objects.Zone; @@ -38,6 +39,11 @@ public class GetHeightCmd extends AbstractDevCmd { this.throwbackInfo(playerCharacter, "Zone : " + currentZone.getName()); this.throwbackInfo(playerCharacter, "Altitude : " + currentHeight); + + Vector2f zoneLoc = ZoneManager.worldToZoneSpace(playerCharacter.getLoc(), currentZone); + Vector2f gridSquare = currentZone.getHeightMap().getGridSquare(zoneLoc); + + this.throwbackInfo(playerCharacter, "Grid : " + gridSquare.toString()); this.throwbackInfo(playerCharacter, "Parent : " + parentZone.getName()); this.throwbackInfo(playerCharacter, "Altitude : " + parentHeight); this.throwbackInfo(playerCharacter, "Character Height: " + playerCharacter.getCharacterHeight());