Class DetailMeshBuilder

  extended by org.critterai.nmgen.DetailMeshBuilder

public final class DetailMeshBuilder
extends Object

Builds an triangle mesh from OpenHeightfield and PolyMeshField data. The polygon mesh field is triangulated and detail added as needed to match the surface of the mesh to the surface defined in the open heightfield.

See Also:
Detail Mesh Generation, TriangleMesh

Constructor Summary
DetailMeshBuilder(float contourSampleDistance, float contourMaxDeviation)
Method Summary
 TriangleMesh build(PolyMeshField sourceMesh, OpenHeightfield heightField)
          Build a triangle mesh with detailed height information from the provided polygon mesh.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DetailMeshBuilder(float contourSampleDistance,
                         float contourMaxDeviation)
contourSampleDistance - Sets the sampling distance to use when matching the final mesh to the surface defined by the OpenHeightfield.

Impacts how well the final mesh conforms to surface data in the OpenHeightfield Higher values, closer conforming, higher final triangle count.

Setting this argument to zero will disable this functionality.

Constraints: >= 0

contourMaxDeviation - The maximum distance the surface of the navmesh may deviate from the surface data in the OpenHeightfield.

The accuracy of the algorithm which uses this value is impacted by the value of the contour sample distance argument.

The value of this argument has no meaning if the contour sample distance argument is set to zero.

Setting the value to zero is not recommended since it can result in a large increase in the number of triangles in the final navmesh at a high processing cost.

Constraints: >= 0

Method Detail


public TriangleMesh build(PolyMeshField sourceMesh,
                          OpenHeightfield heightField)
Build a triangle mesh with detailed height information from the provided polygon mesh.

Concerning sampling: Sampling functionality will only work correctly if the y-values in the source mesh are accurate to within BoundedField.cellHeight() of an associated span within the provided height field. Otherwise the algorithms used by this operation may not be able to find accurate height information from the OpenHeightfield.

sourceMesh - The source polygon mesh to build the triangle mesh from.
heightField - The heightfield from which the PolyMeshField was derived.
The generated triangle mesh. Or null if there were errors which prevented triangulation.

Project Home and Source Code

Copyright 2010 Stephen Pratt. All rights reserved. Use is subject to license terms.