|
|
@ -99,22 +99,13 @@ public class Terrain { |
|
|
|
// Transform world loc into zone space coordinate system
|
|
|
|
// Transform world loc into zone space coordinate system
|
|
|
|
|
|
|
|
|
|
|
|
Vector2f terrainLoc = ZoneManager.worldToZoneSpace(worldLoc, terrainZone); |
|
|
|
Vector2f terrainLoc = ZoneManager.worldToZoneSpace(worldLoc, terrainZone); |
|
|
|
Vector2f parentLoc = ZoneManager.worldToZoneSpace(worldLoc, parentZone); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Interpolate height for this position in terrain
|
|
|
|
// Interpolate height for this position in terrain
|
|
|
|
|
|
|
|
|
|
|
|
float interpolatedChildHeight = terrainZone.terrain.getInterpolatedTerrainHeight(terrainLoc); |
|
|
|
float interpolatedChildHeight = terrainZone.terrain.getInterpolatedTerrainHeight(terrainLoc); |
|
|
|
interpolatedChildHeight += terrainZone.worldAltitude; |
|
|
|
interpolatedChildHeight += terrainZone.worldAltitude; |
|
|
|
|
|
|
|
|
|
|
|
// Interpolate height for this position in parent
|
|
|
|
return interpolatedChildHeight; |
|
|
|
|
|
|
|
|
|
|
|
float interpolatedParentTerrainHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentLoc); |
|
|
|
|
|
|
|
interpolatedParentTerrainHeight += parentZone.worldAltitude; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Blend between heights
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return interpolatedChildHeight + interpolatedParentTerrainHeight * (1 - terrainZone.terrain.terrainBlend(terrainLoc)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static float getWorldHeight(Vector3fImmutable worldLoc) { |
|
|
|
public static float getWorldHeight(Vector3fImmutable worldLoc) { |
|
|
|