added toCellSpace() and toWorldSpace() utility methods to TerrainGrid

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

@ -332,6 +332,20 @@ public class TerrainGrid extends TerrainQuad {
return cache.get(tileCell);
}
/**
* Convert the world location into a cell location (integer coordinates)
*/
public Vector3f toCellSpace(Vector3f worldLocation) {
return getTileCell(worldLocation);
}
/**
* Convert the cell coordinate (integer coordinates) into world coordinates.
*/
public Vector3f toWorldSpace(Vector3f cellLocation) {
return cellLocation.mult(getLocalScale()).multLocal(quadSize - 1);
}
protected void removeQuad(TerrainQuad q) {
if (q != null && ( (q.getQuadrant() > 0 && q.getQuadrant()<5) || q.getParent() != null) ) {
for (TerrainGridListener l : listeners) {

Loading…
Cancel
Save