Browse Source

Method is now called

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
affe6b08ab
  1. 11
      src/engine/InterestManagement/Terrain.java

11
src/engine/InterestManagement/Terrain.java

@ -102,17 +102,26 @@ public class Terrain {
// Retrieve the next zone with a terrain defined. // Retrieve the next zone with a terrain defined.
Zone terrainZone = getNextZoneWithTerrain(zone); Zone terrainZone = getNextZoneWithTerrain(zone);
Zone parentZone = getNextZoneWithTerrain(zone);
// Transform world loc into zone space coordinate system // Transform world loc into zone space coordinate system
Vector2f terrainLoc = ZoneManager.worldToTerrainSpace(world_loc, terrainZone); Vector2f terrainLoc = ZoneManager.worldToTerrainSpace(world_loc, terrainZone);
Vector2f terrainOffset = ZoneManager.worldToZoneOffset(world_loc, terrainZone);
Vector2f parentLoc = ZoneManager.worldToTerrainSpace(world_loc, 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.global_height; interpolatedChildHeight += terrainZone.global_height;
return interpolatedChildHeight; float interpolatedParentTerrainHeight = parentZone.terrain.getInterpolatedTerrainHeight(parentLoc);
interpolatedParentTerrainHeight += parentZone.global_height;
// Blend between terrains
return interpolatedChildHeight + interpolatedParentTerrainHeight * (1 - terrainZone.terrain.terrainBlend(terrainOffset));
} }
public static float getWorldHeight(Vector3fImmutable world_loc) { public static float getWorldHeight(Vector3fImmutable world_loc) {

Loading…
Cancel
Save