Browse Source

Removed usless method: added grid to cmd output.

feature-workorder
MagicBot 1 year ago
parent
commit
68794c170b
  1. 73
      src/engine/InterestManagement/HeightMap.java
  2. 6
      src/engine/devcmd/cmds/GetHeightCmd.java

73
src/engine/InterestManagement/HeightMap.java

@ -315,79 +315,6 @@ public class HeightMap { @@ -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

6
src/engine/devcmd/cmds/GetHeightCmd.java

@ -12,6 +12,7 @@ package engine.devcmd.cmds; @@ -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 { @@ -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());

Loading…
Cancel
Save