|
|
@ -212,7 +212,7 @@ public class HeightMap { |
|
|
|
Zone heightMapZone; |
|
|
|
Zone heightMapZone; |
|
|
|
Zone parentZone; |
|
|
|
Zone parentZone; |
|
|
|
float worldHeight; |
|
|
|
float worldHeight; |
|
|
|
float parentHeight; |
|
|
|
float interpolatedParentTerrainHeight; |
|
|
|
|
|
|
|
|
|
|
|
// Seafloor is rather flat.
|
|
|
|
// Seafloor is rather flat.
|
|
|
|
|
|
|
|
|
|
|
@ -242,11 +242,11 @@ public class HeightMap { |
|
|
|
// We will need the parent height if we got this far into the method
|
|
|
|
// We will need the parent height if we got this far into the method
|
|
|
|
|
|
|
|
|
|
|
|
parentZone = HeightMap.getNextZoneWithTerrain(heightMapZone.getParent()); |
|
|
|
parentZone = HeightMap.getNextZoneWithTerrain(heightMapZone.getParent()); |
|
|
|
parentHeight = HeightMap.getWorldHeight(parentZone, worldLoc); |
|
|
|
interpolatedParentTerrainHeight = HeightMap.getWorldHeight(parentZone, worldLoc); |
|
|
|
|
|
|
|
|
|
|
|
if (Bounds.collide(worldLoc, heightMapZone.minBlend) == true) { |
|
|
|
// Between maxBlend and minBlend distance from edge of zone we LERP between the two heights
|
|
|
|
|
|
|
|
|
|
|
|
// How far into blend zone are we?
|
|
|
|
if (Bounds.collide(worldLoc, heightMapZone.minBlend) == true) { |
|
|
|
|
|
|
|
|
|
|
|
Bounds blendBounds = Bounds.borrow(); |
|
|
|
Bounds blendBounds = Bounds.borrow(); |
|
|
|
zoneLoc.x = abs(zoneLoc.x); |
|
|
|
zoneLoc.x = abs(zoneLoc.x); |
|
|
@ -260,14 +260,14 @@ public class HeightMap { |
|
|
|
|
|
|
|
|
|
|
|
float areaDelta = childArea / parentArea; |
|
|
|
float areaDelta = childArea / parentArea; |
|
|
|
|
|
|
|
|
|
|
|
interpolatedTerrainHeight = FastMath.LERP(areaDelta, interpolatedTerrainHeight, parentHeight); |
|
|
|
interpolatedTerrainHeight = FastMath.LERP(areaDelta, interpolatedTerrainHeight, interpolatedParentTerrainHeight); |
|
|
|
return interpolatedTerrainHeight + heightMapZone.worldAltitude; |
|
|
|
return interpolatedTerrainHeight + heightMapZone.worldAltitude; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Past min blend we just return the parent height.
|
|
|
|
// Past min blend we just return the parent height.
|
|
|
|
|
|
|
|
|
|
|
|
return parentHeight + heightMapZone.worldAltitude; |
|
|
|
return interpolatedParentTerrainHeight + heightMapZone.worldAltitude; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|