utp = new UpdatedTerrainPatch(patch, patch.lod); updated.put(utp.getName(), utp); UpdatedTerrainPatch utpR = updated.get(right.getName()); if (utpR == null) { utpR = new UpdatedTerrainPatch(right); updated.put(utpR.getName(), utpR); utpR.setNewLod(right.lod); utp.setRightLod(utpR.getNewLod()); utpR.setLeftLod(utp.getNewLod()); utpD = new UpdatedTerrainPatch(down); updated.put(utpD.getName(), utpD); utpD.setNewLod(down.lod); utp.setBottomLod(utpD.getNewLod()); utpD.setTopLod(utp.getNewLod()); UpdatedTerrainPatch utpL = updated.get(left.getName()); if (utpL == null) { utpL = new UpdatedTerrainPatch(left); updated.put(utpL.getName(), utpL); utpL.setNewLod(left.lod); utp.setLeftLod(utpL.getNewLod()); utpL.setRightLod(utp.getNewLod()); utpT = new UpdatedTerrainPatch(top);
protected void reIndexGeometry(HashMap<String,UpdatedTerrainPatch> updated, boolean useVariableLod) { UpdatedTerrainPatch utp = updated.get(getName()); if (utp != null && utp.isReIndexNeeded() ) { int pow = (int) Math.pow(2, utp.getNewLod()); boolean left = utp.getLeftLod() > utp.getNewLod(); boolean top = utp.getTopLod() > utp.getNewLod(); boolean right = utp.getRightLod() > utp.getNewLod(); boolean bottom = utp.getBottomLod() > utp.getNewLod(); IndexBuffer idxB; if (useVariableLod) idxB = geomap.writeIndexArrayLodVariable(pow, (int) Math.pow(2, utp.getRightLod()), (int) Math.pow(2, utp.getTopLod()), (int) Math.pow(2, utp.getLeftLod()), (int) Math.pow(2, utp.getBottomLod()), totalSize); else idxB = geomap.writeIndexArrayLodDiff(pow, right, top, left, bottom, totalSize); Buffer b; if (idxB.getBuffer() instanceof IntBuffer) b = (IntBuffer)idxB.getBuffer(); else b = (ShortBuffer)idxB.getBuffer(); utp.setNewIndexBuffer(b); } }
public boolean isReIndexNeeded() { if (lodChanged() || isFixEdges()) return true; //if (leftLod != newLod || rightLod != newLod || bottomLod != newLod || topLod != newLod) // return true; return false; }
UpdatedTerrainPatch utp = updates.get(patch.getName()); if (utp == null) { utp = new UpdatedTerrainPatch(patch); updates.put(utp.getName(), utp); utp.setNewLod(0); utp.setPreviousLod(prevLOD); utp = new UpdatedTerrainPatch(patch);//save in here, do not update actual variables updates.put(utp.getName(), utp); utp.setNewLod(i); utp.setPreviousLod(prevLOD);
public void updateAll() { updatedPatch.setLod(newLod); updatedPatch.setLodRight(rightLod); updatedPatch.setLodTop(topLod); updatedPatch.setLodLeft(leftLod); updatedPatch.setLodBottom(bottomLod); if (newIndexBuffer != null && isReIndexNeeded()) { updatedPatch.setPreviousLod(previousLod); updatedPatch.getMesh().clearBuffer(Type.Index); if (newIndexBuffer instanceof IntBuffer) updatedPatch.getMesh().setBuffer(Type.Index, 3, (IntBuffer)newIndexBuffer); else if (newIndexBuffer instanceof ShortBuffer) updatedPatch.getMesh().setBuffer(Type.Index, 3, (ShortBuffer)newIndexBuffer); } }
UpdatedTerrainPatch utp = updates.get(terrainPatch.getName()); if (utp == null) { utp = new UpdatedTerrainPatch(terrainPatch); updates.put(utp.getName(), utp); utp.setNewLod(0); utp.setPreviousLod(prevLOD); utp = new UpdatedTerrainPatch(terrainPatch);//save in here, do not update actual variables updates.put(utp.getName(), utp); utp.setNewLod(i); utp.setPreviousLod(prevLOD);
public void updateAll() { updatedPatch.setLod(newLod); updatedPatch.setLodRight(rightLod); updatedPatch.setLodTop(topLod); updatedPatch.setLodLeft(leftLod); updatedPatch.setLodBottom(bottomLod); if (newIndexBuffer != null && isReIndexNeeded()) { updatedPatch.setPreviousLod(previousLod); updatedPatch.getMesh().clearBuffer(Type.Index); if (newIndexBuffer instanceof IntBuffer) updatedPatch.getMesh().setBuffer(Type.Index, 3, (IntBuffer)newIndexBuffer); else if (newIndexBuffer instanceof ShortBuffer) updatedPatch.getMesh().setBuffer(Type.Index, 3, (ShortBuffer)newIndexBuffer); } }
if(utp != null && utp.lodChanged()) { if (!patch.searchedForNeighboursAlready) { UpdatedTerrainPatch utpR = updated.get(right.getName()); if (utpR == null) { utpR = new UpdatedTerrainPatch(right); updated.put(utpR.getName(), utpR); utpR.setNewLod(right.lod); utpR.setLeftLod(utp.getNewLod()); utpR.setFixEdges(true); utpD = new UpdatedTerrainPatch(down); updated.put(utpD.getName(), utpD); utpD.setNewLod(down.lod); utpD.setTopLod(utp.getNewLod()); utpD.setFixEdges(true); utpT = new UpdatedTerrainPatch(top); updated.put(utpT.getName(), utpT); utpT.setNewLod(top.lod); utpT.setBottomLod(utp.getNewLod()); utpT.setFixEdges(true); utpL = new UpdatedTerrainPatch(left); updated.put(utpL.getName(), utpL); utpL.setNewLod(left.lod);
protected void reIndexGeometry(HashMap<String,UpdatedTerrainPatch> updated, boolean useVariableLod) { UpdatedTerrainPatch utp = updated.get(getName()); if (utp != null && utp.isReIndexNeeded() ) { int pow = (int) Math.pow(2, utp.getNewLod()); boolean left = utp.getLeftLod() > utp.getNewLod(); boolean top = utp.getTopLod() > utp.getNewLod(); boolean right = utp.getRightLod() > utp.getNewLod(); boolean bottom = utp.getBottomLod() > utp.getNewLod(); IndexBuffer idxB; if (useVariableLod) idxB = geomap.writeIndexArrayLodVariable(pow, (int) Math.pow(2, utp.getRightLod()), (int) Math.pow(2, utp.getTopLod()), (int) Math.pow(2, utp.getLeftLod()), (int) Math.pow(2, utp.getBottomLod()), totalSize); else idxB = geomap.writeIndexArrayLodDiff(pow, right, top, left, bottom, totalSize); Buffer b; if (idxB.getBuffer() instanceof IntBuffer) b = (IntBuffer)idxB.getBuffer(); else b = (ShortBuffer)idxB.getBuffer(); utp.setNewIndexBuffer(b); } }
UpdatedTerrainPatch utp = updates.get(terrainPatch.getName()); if (utp == null) { utp = new UpdatedTerrainPatch(terrainPatch); updates.put(utp.getName(), utp); utp.setNewLod(0); utp.setPreviousLod(prevLOD); utp = new UpdatedTerrainPatch(terrainPatch);//save in here, do not update actual variables updates.put(utp.getName(), utp); utp.setNewLod(i); utp.setPreviousLod(prevLOD);
public boolean isReIndexNeeded() { if (lodChanged() || isFixEdges()) return true; //if (leftLod != newLod || rightLod != newLod || bottomLod != newLod || topLod != newLod) // return true; return false; }
if(utp != null && utp.lodChanged()) { if (!patch.searchedForNeighboursAlready) { UpdatedTerrainPatch utpR = updated.get(right.getName()); if (utpR == null) { utpR = new UpdatedTerrainPatch(right); updated.put(utpR.getName(), utpR); utpR.setNewLod(right.lod); utpR.setLeftLod(utp.getNewLod()); utpR.setFixEdges(true); utpD = new UpdatedTerrainPatch(down); updated.put(utpD.getName(), utpD); utpD.setNewLod(down.lod); utpD.setTopLod(utp.getNewLod()); utpD.setFixEdges(true); utpT = new UpdatedTerrainPatch(top); updated.put(utpT.getName(), utpT); utpT.setNewLod(top.lod); utpT.setBottomLod(utp.getNewLod()); utpT.setFixEdges(true); utpL = new UpdatedTerrainPatch(left); updated.put(utpL.getName(), utpL); utpL.setNewLod(left.lod);
UpdatedTerrainPatch utp = updates.get(patch.getName()); if (utp == null) { utp = new UpdatedTerrainPatch(patch); updates.put(utp.getName(), utp); utp.setNewLod(0); utp.setPreviousLod(prevLOD); utp = new UpdatedTerrainPatch(patch);//save in here, do not update actual variables updates.put(utp.getName(), utp); utp.setNewLod(i); utp.setPreviousLod(prevLOD);
utp = new UpdatedTerrainPatch(patch, patch.lod); updated.put(utp.getName(), utp); UpdatedTerrainPatch utpR = updated.get(right.getName()); if (utpR == null) { utpR = new UpdatedTerrainPatch(right); updated.put(utpR.getName(), utpR); utpR.setNewLod(right.lod); utp.setRightLod(utpR.getNewLod()); utpR.setLeftLod(utp.getNewLod()); utpD = new UpdatedTerrainPatch(down); updated.put(utpD.getName(), utpD); utpD.setNewLod(down.lod); utp.setBottomLod(utpD.getNewLod()); utpD.setTopLod(utp.getNewLod()); UpdatedTerrainPatch utpL = updated.get(left.getName()); if (utpL == null) { utpL = new UpdatedTerrainPatch(left); updated.put(utpL.getName(), utpL); utpL.setNewLod(left.lod); utp.setLeftLod(utpL.getNewLod()); utpL.setRightLod(utp.getNewLod()); utpT = new UpdatedTerrainPatch(top);