Browse Source

Unused methods removed

combat-2
MagicBot 1 year ago
parent
commit
6a750f4eb2
  1. 53
      src/engine/InterestManagement/HeightMap.java

53
src/engine/InterestManagement/HeightMap.java

@ -12,8 +12,6 @@ import engine.Enum; @@ -12,8 +12,6 @@ import engine.Enum;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager;
import engine.math.Bounds;
import engine.math.FastMath;
import engine.math.Vector2f;
import engine.math.Vector3fImmutable;
import engine.objects.Zone;
@ -32,8 +30,6 @@ import java.sql.SQLException; @@ -32,8 +30,6 @@ import java.sql.SQLException;
import java.util.HashMap;
import java.util.stream.Stream;
import static java.lang.Math.abs;
public class HeightMap {
// Class variables
@ -235,57 +231,10 @@ public class HeightMap { @@ -235,57 +231,10 @@ public class HeightMap {
float interpolatedTerrainHeight = heightMapZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
interpolatedTerrainHeight += heightMapZone.worldAltitude;
// Heightmap blending is based on distance to edge of zone.
// if (Bounds.collide(worldLoc, heightMapZone.blendBounds) == true)
return interpolatedTerrainHeight;
// We will need the parent height if we got this far into the method
// return interpolatePLANAR(worldLoc, heightMapZone, zoneLoc, interpolatedTerrainHeight);
return interpolatedTerrainHeight;
}
private static float interpolatePLANAR(Vector3fImmutable worldLoc, Zone heightMapZone, Vector2f zoneLoc, float interpolatedTerrainHeight) {
// zones of type PLANAR
Zone parentZone;
float interpolatedParentTerrainHeight;
parentZone = HeightMap.getNextZoneWithTerrain(heightMapZone.parent);
interpolatedParentTerrainHeight = HeightMap.getWorldHeight(parentZone, worldLoc);
interpolatedParentTerrainHeight += parentZone.worldAltitude;
Bounds blendBounds = Bounds.borrow();
zoneLoc.x = abs(zoneLoc.x);
zoneLoc.y = abs(zoneLoc.x);
blendBounds.setBounds(new Vector2f(heightMapZone.absX, heightMapZone.absZ), zoneLoc, 0.0f);
float maxBlendArea = (heightMapZone.blendBounds.getHalfExtents().x) *
(heightMapZone.blendBounds.getHalfExtents().y);
float currentArea = (blendBounds.getHalfExtents().x) *
(blendBounds.getHalfExtents().y);
float zoneArea = (heightMapZone.bounds.getHalfExtents().x) *
(heightMapZone.bounds.getHalfExtents().y);
blendBounds.release();
float blendDelta = zoneArea - maxBlendArea;
float currentDelta = zoneArea - currentArea;
float percentage;
if (currentDelta != 0 && blendDelta != 0)
percentage = currentDelta / blendDelta;
else
percentage = 0.0f;
interpolatedTerrainHeight = FastMath.LERP(percentage, interpolatedTerrainHeight, interpolatedParentTerrainHeight);
return interpolatedTerrainHeight;
}
public static float getWorldHeight(Vector3fImmutable worldLoc) {

Loading…
Cancel
Save