Codota Logo
TerrainGrid.updateChildren
Code IndexAdd Codota to your IDE (free)

How to use
updateChildren
method
in
com.jme3.terrain.geomipmap.TerrainGrid

Best Java code snippets using com.jme3.terrain.geomipmap.TerrainGrid.updateChildren (Showing top 2 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: jMonkeyEngine/jmonkeyengine

  @Override
  protected void updateLOD(SafeArrayList<Vector3f> locations, LodCalculator lodCalculator) {
    TerrainGrid terrainGrid = (TerrainGrid)getSpatial();
    
    // for now, only the first camera is handled.
    // to accept more, there are two ways:
    // 1: every camera has an associated grid, then the location is not enough to identify which camera location has changed
    // 2: grids are associated with locations, and no incremental update is done, we load new grids for new locations, and unload those that are not needed anymore
    Vector3f cam = locations.isEmpty() ? Vector3f.ZERO.clone() : locations.get(0);
    Vector3f camCell = terrainGrid.getCamCell(cam); // get the grid index value of where the camera is (ie. 2,1)
    if (terrainGrid.cellsLoaded > 1) {                  // Check if cells are updated before updating gridoffset.
      terrainGrid.gridOffset[0] = Math.round(camCell.x * (terrainGrid.size / 2));
      terrainGrid.gridOffset[1] = Math.round(camCell.z * (terrainGrid.size / 2));
      terrainGrid.cellsLoaded = 0;
    }
    if (camCell.x != terrainGrid.currentCamCell.x || camCell.z != terrainGrid.currentCamCell.z || !terrainGrid.runOnce) {
      // if the camera has moved into a new cell, load new terrain into the visible 4 center quads
      terrainGrid.updateChildren(camCell);
      for (TerrainGridListener l : terrainGrid.listeners) {
        l.gridMoved(camCell);
      }
    }
    terrainGrid.runOnce = true;
    super.updateLOD(locations, lodCalculator);
  }
}
origin: us.ihmc.thirdparty.jme/jme3-terrain

  @Override
  protected void updateLOD(List<Vector3f> locations, LodCalculator lodCalculator) {
    TerrainGrid terrainGrid = (TerrainGrid)getSpatial();
    
    // for now, only the first camera is handled.
    // to accept more, there are two ways:
    // 1: every camera has an associated grid, then the location is not enough to identify which camera location has changed
    // 2: grids are associated with locations, and no incremental update is done, we load new grids for new locations, and unload those that are not needed anymore
    Vector3f cam = locations.isEmpty() ? Vector3f.ZERO.clone() : locations.get(0);
    Vector3f camCell = terrainGrid.getCamCell(cam); // get the grid index value of where the camera is (ie. 2,1)
    if (terrainGrid.cellsLoaded > 1) {                  // Check if cells are updated before updating gridoffset.
      terrainGrid.gridOffset[0] = Math.round(camCell.x * (terrainGrid.size / 2));
      terrainGrid.gridOffset[1] = Math.round(camCell.z * (terrainGrid.size / 2));
      terrainGrid.cellsLoaded = 0;
    }
    if (camCell.x != terrainGrid.currentCamCell.x || camCell.z != terrainGrid.currentCamCell.z || !terrainGrid.runOnce) {
      // if the camera has moved into a new cell, load new terrain into the visible 4 center quads
      terrainGrid.updateChildren(camCell);
      for (TerrainGridListener l : terrainGrid.listeners) {
        l.gridMoved(camCell);
      }
    }
    terrainGrid.runOnce = true;
    super.updateLOD(locations, lodCalculator);
  }
}
com.jme3.terrain.geomipmapTerrainGridupdateChildren

Javadoc

Called when the camera has moved into a new cell. We need to update what quads are in the scene now. Step 1: touch cache LRU cache is used, so elements that need to remain should be touched. Step 2: load new quads in background thread if the camera has moved into a new cell, we load in new quads

Popular methods of TerrainGrid

  • addControl
  • getCurrentCell
  • getLocalScale
  • attachChild
  • attachQuadAt
    Runs on the rendering thread
  • createExecutorService
    This will print out any exceptions from the thread
  • detachChild
  • fixNormalEdges
  • getCamCell
    Get the location in cell-coordinates of the specified location. Cell coordinates are integer corrdin
  • getChildren
  • getControl
  • getQuadrant
  • getControl,
  • getQuadrant,
  • getTileCell,
  • getWorldScale,
  • initData,
  • isCenter,
  • removeQuad,
  • setNeedToRecalculateNormals,
  • updateModelBound

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • findViewById (Activity)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Reference (javax.naming)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now