forked from MagicBane/Server
Unused methods removed
This commit is contained in:
@@ -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,58 +231,11 @@ 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;
|
|
||||||
|
|
||||||
// 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;
|
return interpolatedTerrainHeight;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static float getWorldHeight(Vector3fImmutable worldLoc) {
|
public static float getWorldHeight(Vector3fImmutable worldLoc) {
|
||||||
|
|
||||||
Zone currentZone = ZoneManager.findSmallestZone(worldLoc);
|
Zone currentZone = ZoneManager.findSmallestZone(worldLoc);
|
||||||
|
|||||||
Reference in New Issue
Block a user