protected void removeQuad(TerrainQuad q) { if (q != null && ( (q.getQuadrant() > 0 && q.getQuadrant()<5) || q.getParent() != null) ) { for (TerrainGridListener l : listeners) { l.tileDetached(getTileCell(q.getWorldTranslation()), q); } q.setQuadrant((short)0); this.detachChild(q); cellsLoaded++; // For gridoffset calc., maybe the run() method is a better location for this. } }
/** * Runs on the rendering thread * @param shifted quads are still attached to the parent and don't need to re-load */ protected void attachQuadAt(TerrainQuad q, int quadrant, Vector3f quadCell, boolean shifted) { q.setQuadrant((short) quadrant); if (!shifted) this.attachChild(q); Vector3f loc = quadCell.mult(this.quadSize - 1).subtract(quarterSize, 0, quarterSize);// quadrant location handled TerrainQuad automatically now q.setLocalTranslation(loc); if (!shifted) { for (TerrainGridListener l : listeners) { l.tileAttached(quadCell, q); } } updateModelBound(); }
protected void removeQuad(TerrainQuad q) { if (q != null && ( (q.getQuadrant() > 0 && q.getQuadrant()<5) || q.getParent() != null) ) { for (TerrainGridListener l : listeners) { l.tileDetached(getTileCell(q.getWorldTranslation()), q); } q.setQuadrant((short)0); this.detachChild(q); cellsLoaded++; // For gridoffset calc., maybe the run() method is a better location for this. } }
/** * Runs on the rendering thread * @param shifted quads are still attached to the parent and don't need to re-load */ protected void attachQuadAt(TerrainQuad q, int quadrant, Vector3f quadCell, boolean shifted) { q.setQuadrant((short) quadrant); if (!shifted) this.attachChild(q); Vector3f loc = quadCell.mult(this.quadSize - 1).subtract(quarterSize, 0, quarterSize);// quadrant location handled TerrainQuad automatically now q.setLocalTranslation(loc); if (!shifted) { for (TerrainGridListener l : listeners) { l.tileAttached(quadCell, q); } } updateModelBound(); }