|
|
|
@ -12,6 +12,7 @@ import engine.Enum;
@@ -12,6 +12,7 @@ import engine.Enum;
|
|
|
|
|
import engine.gameManager.ConfigManager; |
|
|
|
|
import engine.gameManager.DbManager; |
|
|
|
|
import engine.gameManager.ZoneManager; |
|
|
|
|
import engine.math.Bounds; |
|
|
|
|
import engine.math.Vector2f; |
|
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
|
import engine.objects.Zone; |
|
|
|
@ -26,6 +27,8 @@ import java.sql.ResultSet;
@@ -26,6 +27,8 @@ import java.sql.ResultSet;
|
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
|
|
import static java.lang.Math.abs; |
|
|
|
|
|
|
|
|
|
public class HeightMap { |
|
|
|
|
|
|
|
|
|
// Class variables
|
|
|
|
@ -206,6 +209,7 @@ public class HeightMap {
@@ -206,6 +209,7 @@ public class HeightMap {
|
|
|
|
|
public static float getWorldHeight(Zone currentZone, Vector3fImmutable worldLoc) { |
|
|
|
|
|
|
|
|
|
Zone heightMapZone; |
|
|
|
|
float worldHeight; |
|
|
|
|
|
|
|
|
|
// Seafloor is rather flat.
|
|
|
|
|
|
|
|
|
@ -226,6 +230,24 @@ public class HeightMap {
@@ -226,6 +230,24 @@ public class HeightMap {
|
|
|
|
|
|
|
|
|
|
float interpolatedTerrainHeight = heightMapZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc); |
|
|
|
|
|
|
|
|
|
// Heightmap blending is based on distance to edge of zone.
|
|
|
|
|
|
|
|
|
|
if (Bounds.collide(worldLoc, heightMapZone.maxBlend) == true) { |
|
|
|
|
worldHeight = interpolatedTerrainHeight + heightMapZone.worldAltitude; |
|
|
|
|
return worldHeight; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (Bounds.collide(worldLoc, heightMapZone.minBlend) == true) { |
|
|
|
|
|
|
|
|
|
// How far into blend zone are we?
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Position returned from Heightmap engine is relative to zone world height
|
|
|
|
|
|
|
|
|
|
return interpolatedTerrainHeight + heightMapZone.worldAltitude; |
|
|
|
|