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

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

Best Java code snippets using com.jme3.terrain.geomipmap.TerrainGrid.getTileCell (Showing top 10 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

/**
 * Convert the world location into a cell location (integer coordinates)
 */
public Vector3f toCellSpace(Vector3f worldLocation) {
  Vector3f tileCell = getTileCell(worldLocation);
  tileCell = new Vector3f(Math.round(tileCell.x), tileCell.y, Math.round(tileCell.z));
  return tileCell;
}

origin: jMonkeyEngine/jmonkeyengine

/**
 * Get the terrain tile at the specified world location, in XZ coordinates.
 */
public Terrain getTerrainAt(Vector3f worldLocation) {
  if (worldLocation == null)
    return null;
  Vector3f tileCell = getTileCell(worldLocation.setY(0));
  tileCell = new Vector3f(Math.round(tileCell.x), tileCell.y, Math.round(tileCell.z));
  return cache.get(tileCell);
}

origin: jMonkeyEngine/jmonkeyengine

@Override
public Material getMaterial(Vector3f worldLocation) {
  if (worldLocation == null)
    return null;
  Vector3f tileCell = getTileCell(worldLocation);
  Terrain terrain = cache.get(tileCell);
  if (terrain == null)
    return null; // terrain not loaded for that cell yet!
  return terrain.getMaterial(worldLocation);
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Get the location in cell-coordinates of the specified location.
 * Cell coordinates are integer corrdinates, usually with y=0, each 
 * representing a cell in the world.
 * For example, moving right in the +X direction:
 * (0,0,0) (1,0,0) (2,0,0), (3,0,0)
 * and then down the -Z direction:
 * (3,0,-1) (3,0,-2) (3,0,-3)
 */
public Vector3f getCamCell(Vector3f location) {
  Vector3f tile = getTileCell(location);
  Vector3f offsetHalf = new Vector3f(-0.5f, 0, -0.5f);
  Vector3f shifted = tile.subtract(offsetHalf);
  return new Vector3f(FastMath.floor(shifted.x), 0, FastMath.floor(shifted.z));
}
origin: jMonkeyEngine/jmonkeyengine

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.
  }
}
origin: us.ihmc.thirdparty.jme/jme3-terrain

/**
 * Convert the world location into a cell location (integer coordinates)
 */
public Vector3f toCellSpace(Vector3f worldLocation) {
  Vector3f tileCell = getTileCell(worldLocation);
  tileCell = new Vector3f(Math.round(tileCell.x), tileCell.y, Math.round(tileCell.z));
  return tileCell;
}
 
origin: us.ihmc.thirdparty.jme/jme3-terrain

/**
 * Get the terrain tile at the specified world location, in XZ coordinates.
 */
public Terrain getTerrainAt(Vector3f worldLocation) {
  if (worldLocation == null)
    return null;
  Vector3f tileCell = getTileCell(worldLocation.setY(0));
  tileCell = new Vector3f(Math.round(tileCell.x), tileCell.y, Math.round(tileCell.z));
  return cache.get(tileCell);
}
 
origin: us.ihmc.thirdparty.jme/jme3-terrain

@Override
public Material getMaterial(Vector3f worldLocation) {
  if (worldLocation == null)
    return null;
  Vector3f tileCell = getTileCell(worldLocation);
  Terrain terrain = cache.get(tileCell);
  if (terrain == null)
    return null; // terrain not loaded for that cell yet!
  return terrain.getMaterial(worldLocation);
}
origin: us.ihmc.thirdparty.jme/jme3-terrain

/**
 * Get the location in cell-coordinates of the specified location.
 * Cell coordinates are integer corrdinates, usually with y=0, each 
 * representing a cell in the world.
 * For example, moving right in the +X direction:
 * (0,0,0) (1,0,0) (2,0,0), (3,0,0)
 * and then down the -Z direction:
 * (3,0,-1) (3,0,-2) (3,0,-3)
 */
public Vector3f getCamCell(Vector3f location) {
  Vector3f tile = getTileCell(location);
  Vector3f offsetHalf = new Vector3f(-0.5f, 0, -0.5f);
  Vector3f shifted = tile.subtract(offsetHalf);
  return new Vector3f(FastMath.floor(shifted.x), 0, FastMath.floor(shifted.z));
}
origin: us.ihmc.thirdparty.jme/jme3-terrain

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.
  }
}
com.jme3.terrain.geomipmapTerrainGridgetTileCell

Javadoc

Centered at 0,0. Get the tile index location in integer form:

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,
  • getWorldScale,
  • initData,
  • isCenter,
  • removeQuad,
  • setNeedToRecalculateNormals,
  • updateChildren,
  • updateModelBound

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
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