|
|
|
@ -229,16 +229,18 @@ public class HeightMap {
@@ -229,16 +229,18 @@ public class HeightMap {
|
|
|
|
|
// Interpolate height for this position using pixel array.
|
|
|
|
|
|
|
|
|
|
float interpolatedTerrainHeight = heightMapZone.getHeightMap().getInterpolatedTerrainHeight(zoneLoc); |
|
|
|
|
interpolatedTerrainHeight += heightMapZone.worldAltitude; |
|
|
|
|
|
|
|
|
|
// Heightmap blending is based on distance to edge of zone.
|
|
|
|
|
|
|
|
|
|
if (Bounds.collide(worldLoc, heightMapZone.maxBlend) == true) |
|
|
|
|
return interpolatedTerrainHeight + heightMapZone.worldAltitude; |
|
|
|
|
return interpolatedTerrainHeight; |
|
|
|
|
|
|
|
|
|
// We will need the parent height if we got this far into the method
|
|
|
|
|
|
|
|
|
|
parentZone = HeightMap.getNextZoneWithTerrain(heightMapZone.getParent()); |
|
|
|
|
interpolatedParentTerrainHeight = HeightMap.getWorldHeight(parentZone, worldLoc); |
|
|
|
|
interpolatedParentTerrainHeight += parentZone.worldAltitude; |
|
|
|
|
|
|
|
|
|
Bounds blendBounds = Bounds.borrow(); |
|
|
|
|
zoneLoc.x = abs(zoneLoc.x); |
|
|
|
@ -262,9 +264,9 @@ public class HeightMap {
@@ -262,9 +264,9 @@ public class HeightMap {
|
|
|
|
|
percentage = currentDelta / blendDelta; |
|
|
|
|
else |
|
|
|
|
percentage = 0.0f; |
|
|
|
|
float interpolatedWorldAltitude = FastMath.LERP(percentage, heightMapZone.worldAltitude, parentZone.worldAltitude); |
|
|
|
|
|
|
|
|
|
interpolatedTerrainHeight = FastMath.LERP(percentage, interpolatedTerrainHeight, interpolatedParentTerrainHeight); |
|
|
|
|
return interpolatedTerrainHeight + interpolatedWorldAltitude; |
|
|
|
|
return interpolatedTerrainHeight; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|