public class LODGeomap extends GeoMap
Modifier and Type | Class and Description |
---|---|
class |
LODGeomap.VerboseBuffer
Keeps a count of the number of indexes, good for debugging
|
Constructor and Description |
---|
LODGeomap() |
LODGeomap(int size,
float[] heightMap) |
Modifier and Type | Method and Description |
---|---|
static Vector3f |
calculateTangent(Vector3f[] v,
Vector2f[] t,
Vector3f tangent,
Vector3f binormal) |
Mesh |
createMesh(Vector3f scale,
Vector2f tcScale,
Vector2f tcOffset,
float offsetAmount,
int totalSize,
boolean center) |
Mesh |
createMesh(Vector3f scale,
Vector2f tcScale,
Vector2f tcOffset,
float offsetAmount,
int totalSize,
boolean center,
int lod,
boolean rightLod,
boolean topLod,
boolean leftLod,
boolean bottomLod) |
protected int |
findClosestHeightIndex(int x,
int z) |
protected Triangle[] |
getGridTrianglesAtPoint(float x,
float z)
Get the two triangles that make up the grid section at the specified point.
|
protected Triangle[] |
getGridTrianglesAtPoint(float x,
float z,
Vector3f scale,
Vector3f translation)
Get the two triangles that make up the grid section at the specified point,
translated to world coordinates.
|
protected float |
getHeight(int x,
int z,
float xm,
float zm)
Get the two triangles that make up the grid section at the specified point.
|
protected Triangle |
getTriangleAtPoint(float x,
float z)
Get the triangle that the point is on.
|
protected Triangle |
getTriangleAtPoint(float x,
float z,
Vector3f scale,
Vector3f translation)
Get a representation of the underlying triangle at the given point,
translated to world coordinates.
|
Vector2f |
getUV(int x,
int y,
Vector2f store,
Vector2f offset,
float offsetAmount,
int totalSize) |
void |
read(JmeImporter im) |
void |
write(JmeExporter ex) |
IndexBuffer |
writeIndexArrayLodDiff(int lod,
boolean rightLod,
boolean topLod,
boolean leftLod,
boolean bottomLod,
int totalSize)
Create the LOD index array that will seam its edges with its neighbour's LOD.
|
IndexBuffer |
writeIndexArrayLodVariable(int lod,
int rightLod,
int topLod,
int leftLod,
int bottomLod,
int totalSize) |
java.nio.FloatBuffer |
writeNormalArray(java.nio.FloatBuffer store,
Vector3f scale)
Creates a normal array from the normal data in this Geomap
|
java.nio.FloatBuffer[] |
writeTangentArray(java.nio.FloatBuffer normalBuffer,
java.nio.FloatBuffer tangentStore,
java.nio.FloatBuffer binormalStore,
java.nio.FloatBuffer textureBuffer,
Vector3f scale) |
java.nio.FloatBuffer |
writeTexCoordArray(java.nio.FloatBuffer store,
Vector2f offset,
Vector2f scale,
float offsetAmount,
int totalSize) |
createMesh, getHeight, getHeightArray, getMaximumValue, getUV, getUV, getValue, getValue, getWidth, isLoaded, writeIndexArray, writeTexCoordArray, writeVertexArray
public LODGeomap()
public LODGeomap(int size, float[] heightMap)
public Mesh createMesh(Vector3f scale, Vector2f tcScale, Vector2f tcOffset, float offsetAmount, int totalSize, boolean center)
public Mesh createMesh(Vector3f scale, Vector2f tcScale, Vector2f tcOffset, float offsetAmount, int totalSize, boolean center, int lod, boolean rightLod, boolean topLod, boolean leftLod, boolean bottomLod)
public java.nio.FloatBuffer writeTexCoordArray(java.nio.FloatBuffer store, Vector2f offset, Vector2f scale, float offsetAmount, int totalSize)
public Vector2f getUV(int x, int y, Vector2f store, Vector2f offset, float offsetAmount, int totalSize)
public IndexBuffer writeIndexArrayLodDiff(int lod, boolean rightLod, boolean topLod, boolean leftLod, boolean bottomLod, int totalSize)
lod
- level of detail of the meshrightLod
- LOD of the right neighbourtopLod
- LOD of the top neighbourleftLod
- LOD of the left neighbourbottomLod
- LOD of the bottom neighbourpublic IndexBuffer writeIndexArrayLodVariable(int lod, int rightLod, int topLod, int leftLod, int bottomLod, int totalSize)
public java.nio.FloatBuffer[] writeTangentArray(java.nio.FloatBuffer normalBuffer, java.nio.FloatBuffer tangentStore, java.nio.FloatBuffer binormalStore, java.nio.FloatBuffer textureBuffer, Vector3f scale)
public static Vector3f calculateTangent(Vector3f[] v, Vector2f[] t, Vector3f tangent, Vector3f binormal)
v
- Takes 3 vertices: root, right, bottomt
- Takes 3 tex coords: root, right, bottomtangent
- that will store the resultpublic java.nio.FloatBuffer writeNormalArray(java.nio.FloatBuffer store, Vector3f scale)
GeoMap
writeNormalArray
in class GeoMap
store
- A preallocated FloatBuffer where to store the data (optional), size must be >= getWidth()*getHeight()*3protected float getHeight(int x, int z, float xm, float zm)
protected Triangle getTriangleAtPoint(float x, float z, Vector3f scale, Vector3f translation)
x
- local x coordinatez
- local z coordinateprotected Triangle[] getGridTrianglesAtPoint(float x, float z, Vector3f scale, Vector3f translation)
x
- local x coordinatez
- local z coordinatescale
- translation
- protected Triangle[] getGridTrianglesAtPoint(float x, float z)
x
- local x coordinatez
- local z coordinateprotected Triangle getTriangleAtPoint(float x, float z)
x
- coordinate in local space to the geomapz
- coordinate in local space to the geomapprotected int findClosestHeightIndex(int x, int z)
public void write(JmeExporter ex) throws java.io.IOException
public void read(JmeImporter im) throws java.io.IOException