Browse Source

Unused methods removed

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
6a750f4eb2
  1. 51
      src/engine/InterestManagement/HeightMap.java

51
src/engine/InterestManagement/HeightMap.java

@ -12,8 +12,6 @@ import engine.Enum;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.math.Bounds;
import engine.math.FastMath;
import engine.math.Vector2f; import engine.math.Vector2f;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.Zone; import engine.objects.Zone;
@ -32,8 +30,6 @@ import java.sql.SQLException;
import java.util.HashMap; import java.util.HashMap;
import java.util.stream.Stream; import java.util.stream.Stream;
import static java.lang.Math.abs;
public class HeightMap { public class HeightMap {
// Class variables // Class variables
@ -235,57 +231,10 @@ public class HeightMap {
float interpolatedTerrainHeight = heightMapZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc); float interpolatedTerrainHeight = heightMapZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc);
interpolatedTerrainHeight += heightMapZone.worldAltitude; interpolatedTerrainHeight += heightMapZone.worldAltitude;
// Heightmap blending is based on distance to edge of zone.
// if (Bounds.collide(worldLoc, heightMapZone.blendBounds) == true)
return interpolatedTerrainHeight; return interpolatedTerrainHeight;
// We will need the parent height if we got this far into the method
// return interpolatePLANAR(worldLoc, heightMapZone, zoneLoc, 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) { public static float getWorldHeight(Vector3fImmutable worldLoc) {

Loading…
Cancel
Save