added TerrainGrid.getTerrainAtCell(Vector3f cellCoordinate) to get the terrain tile from cell coordinates

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9953 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..om 12 years ago
parent 9c2a897bfb
commit fa29b95c39
  1. 11
      engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java

@ -321,6 +321,17 @@ public class TerrainGrid extends TerrainQuad {
return cache.get(tileCell); return cache.get(tileCell);
} }
/**
* Get the terrain tile at the specified XZ cell coordinate (not world coordinate).
* @param cellCoordinate integer cell coordinates
* @return the terrain tile at that location
*/
public Terrain getTerrainAtCell(Vector3f cellCoordinate) {
Vector3f gridLocation = cellCoordinate.mult(getLocalScale()).multLocal(quadSize - 1);
Vector3f tileCell = getTileCell(gridLocation);
return cache.get(tileCell);
}
protected void removeQuad(TerrainQuad q) { protected void removeQuad(TerrainQuad q) {
if (q != null && ( (q.getQuadrant() > 0 && q.getQuadrant()<5) || q.getParent() != null) ) { if (q != null && ( (q.getQuadrant() > 0 && q.getQuadrant()<5) || q.getParent() != null) ) {
for (TerrainGridListener l : listeners) { for (TerrainGridListener l : listeners) {

Loading…
Cancel
Save