diff options
author | Julien Gouesse <[email protected]> | 2018-01-26 22:50:14 +0100 |
---|---|---|
committer | Julien Gouesse <[email protected]> | 2018-01-26 22:50:14 +0100 |
commit | ce18a5cd6c6162c598f2d00490d4e66c361c3b44 (patch) | |
tree | 55162f70f70599e5a007e3844a504aa6c72e518f /ardor3d-terrain | |
parent | 35a0d53a08b8ebb613faa7271f375387743793c1 (diff) | |
parent | d07dfa20670807a588bfa0f643d88e8b8183d118 (diff) |
Merges Renanse's commit d07dfa20670807a588bfa0f643d88e8b8183d118
Diffstat (limited to 'ardor3d-terrain')
-rw-r--r-- | ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java index 9d4b343..1e50ba7 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java @@ -298,14 +298,21 @@ public class TerrainGridCache implements TerrainCache, Runnable { int tileX = MathUtils.floor((float) x / tileSize); int tileY = MathUtils.floor((float) z / tileSize); final CacheData tileData; - final int cacheMin = -cacheSize / 2, cacheMax = cacheSize / 2 - (cacheSize % 2 == 0 ? 1 : 0); - if (tileX < cacheMin || tileX > cacheMax || tileY < cacheMin || tileY > cacheMax) { - tileData = null; - } else { - tileX = MathUtils.moduloPositive(tileX, cacheSize); - tileY = MathUtils.moduloPositive(tileY, cacheSize); - tileData = cache[tileX][tileY]; - } + // mallan - 2016-01-26: this conditional will ALWAYS fail once view has + // moved outside the origin cache bounds (tileX,tileY are source tile coordinates, + // cacheSize are desintation tile coordinates). The moduloPositive does what we need, + // this conditional breaks the terrain. + // final int cacheMin = -cacheSize / 2, cacheMax = cacheSize / 2 - (cacheSize % 2 == 0 ? 1 : 0); + // if (tileX < cacheMin || tileX > cacheMax || tileY < cacheMin || tileY > cacheMax) { + // tileData = null; + // } else { + // tileX = MathUtils.moduloPositive(tileX, cacheSize); + // tileY = MathUtils.moduloPositive(tileY, cacheSize); + // tileData = cache[tileX][tileY]; + // } + tileX = MathUtils.moduloPositive(tileX, cacheSize); + tileY = MathUtils.moduloPositive(tileY, cacheSize); + tileData = cache[tileX][tileY]; if (tileData == null || !tileData.isValid) { if (parentCache != null) { |