Package org.recast4j.recast
Class RecastRasterization
java.lang.Object
org.recast4j.recast.RecastRasterization
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddSpan(Heightfield heightfield, int x, int y, int spanMin, int spanMax, int areaId, int flagMergeThreshold) Adds a span to the heightfield.static voidrasterizeTriangle(Heightfield heightfield, float[] verts, int v0, int v1, int v2, int areaId, int flagMergeThreshold, Telemetry ctx) Rasterizes a single triangle into the specified heightfield.static voidrasterizeTriangles(Heightfield heightfield, float[] verts, int[] tris, int[] areaIds, int numTris, int flagMergeThreshold, Telemetry ctx) Rasterizes an indexed triangle mesh into the specified heightfield.static voidrasterizeTriangles(Heightfield heightfield, float[] verts, int[] areaIds, int numTris, int flagMergeThreshold, Telemetry ctx) Rasterizes a triangle list into the specified heightfield.
-
Constructor Details
-
RecastRasterization
public RecastRasterization()
-
-
Method Details
-
addSpan
public static void addSpan(Heightfield heightfield, int x, int y, int spanMin, int spanMax, int areaId, int flagMergeThreshold) Adds a span to the heightfield. If the new span overlaps existing spans, it will merge the new span with the existing ones. The span addition can be set to favor flags. If the span is merged to another span and the new spanMax is within flagMergeThreshold units from the existing span, the span flags are merged.- Parameters:
heightfield- An initialized heightfield.x- The width index where the span is to be added. [Limits: 0 <= value < Heightfield::width]y- The height index where the span is to be added. [Limits: 0 <= value < Heightfield::height]spanMin- The minimum height of the span. [Limit: < spanMax] [Units: vx]spanMax- The minimum height of the span. [Limit: <= RecastConstants.SPAN_MAX_HEIGHT] [Units: vx]areaId- The area id of the span. [Limit: <= WALKABLE_AREA)flagMergeThreshold- The merge theshold. [Limit: >= 0] [Units: vx]
-
rasterizeTriangle
public static void rasterizeTriangle(Heightfield heightfield, float[] verts, int v0, int v1, int v2, int areaId, int flagMergeThreshold, Telemetry ctx) Rasterizes a single triangle into the specified heightfield. Calling this for each triangle in a mesh is less efficient than calling rasterizeTriangles. No spans will be added if the triangle does not overlap the heightfield grid.- Parameters:
heightfield- An initialized heightfield.verts- An array with vertex coordinates [(x, y, z) * N]v0- Index of triangle vertex 0, will be multiplied by 3 to get vertex coordinatesv1- Triangle vertex 1 indexv2- Triangle vertex 2 indexareaId- The area id of the triangle. [Limit: <= WALKABLE_AREA)flagMergeThreshold- The distance where the walkable flag is favored over the non-walkable flag. [Limit: >= 0] [Units: vx]- See Also:
-
rasterizeTriangles
public static void rasterizeTriangles(Heightfield heightfield, float[] verts, int[] tris, int[] areaIds, int numTris, int flagMergeThreshold, Telemetry ctx) Rasterizes an indexed triangle mesh into the specified heightfield. Spans will only be added for triangles that overlap the heightfield grid.- Parameters:
heightfield- An initialized heightfield.verts- The vertices. [(x, y, z) * N]tris- The triangle indices. [(vertA, vertB, vertC) * nt]areaIds- The area id's of the triangles. [Limit: <e; WALKABLE_AREA] [Size: numTris]numTris- The number of triangles.flagMergeThreshold- The distance where the walkable flag is favored over the non-walkable flag. [Limit: >= 0] [Units: vx]- See Also:
-
rasterizeTriangles
public static void rasterizeTriangles(Heightfield heightfield, float[] verts, int[] areaIds, int numTris, int flagMergeThreshold, Telemetry ctx) Rasterizes a triangle list into the specified heightfield. Expects each triangle to be specified as three sequential vertices of 3 floats. Spans will only be added for triangles that overlap the heightfield grid.- Parameters:
heightfield- An initialized heightfield.verts- The vertices. [(x, y, z) * numVerts]areaIds- The area id's of the triangles. [Limit: <= WALKABLE_AREA] [Size: numTris]numTris- The number of triangles.flagMergeThreshold- The distance where the walkable flag is favored over the non-walkable flag. [Limit: >= 0] [Units: vx]- See Also:
-