Get RAPTOR

RaptorMeshQueries

Read-only queries on Blocks, their meshes and the Mesh tool's element selection.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0

Read-only queries for modules that derive a copy of a Block's mesh. Mesh values are in the mesh core's coordinate space.

public static class RaptorMeshQueries

Methods

CornerNormals

public static List<SVector3> CornerNormals(PolygonMesh mesh)

Returns every face's corner normals in FaceHandles order, with corners in face order. They match the normals a build packs, which come from the smoothing angle and each edge's Hard or Soft setting. Returns a new list on each call.

ParameterTypeDescription
meshPolygonMeshThe Block's editable mesh.

Returns: The normals.

EdgeFaces

public static bool EdgeFaces(PolygonMesh mesh, HalfEdgeHandle h, out FaceHandle a, out FaceHandle b)

Gets the two faces of the closed edge h.

ParameterTypeDescription
meshPolygonMeshThe Block's editable mesh.
hHalfEdgeHandleThe half-edge.
aout FaceHandleThe first face.
bout FaceHandleThe second face.

Returns: True for a closed edge. False for an open or invalid edge.

FaceMaterialIndex

public static int FaceMaterialIndex(PolygonMesh mesh, FaceHandle face)

Returns the index of face's material in mesh's material list. Faces with the same index use the same material.

ParameterTypeDescription
meshPolygonMeshThe Block's editable mesh.
faceFaceHandleThe face.

Returns: The index.

FaceTriangles

public static int[] FaceTriangles(SVector3[] positions)

Returns the build's triangulation of one face as indices into positions, wound like the face.

ParameterTypeDescription
positionsSVector3[]The face's corners, in order.

Returns: The indices, or null when the build emits no triangles for the face.

LiveMeshOf

public static PolygonMesh LiveMeshOf(RaptorMesh km)

Returns the live or preview mesh of km while the Mesh tool edits it. Does not create an edit session or load anything.

ParameterTypeDescription
kmRaptorMeshThe Block.

Returns: The mesh, or null when the Block is not being edited (read the packed data instead).

LiveVersionOf

public static int LiveVersionOf(RaptorMesh km)

Returns a number that changes whenever the live or preview mesh of km may have changed. Use it as a cache key alongside the Block's revision.

ParameterTypeDescription
kmRaptorMeshThe Block.

Returns: The version, or 0 when there is no live mesh.

SelectedClosedEdges

public static List<MeshEdge> SelectedClosedEdges(IEnumerable<RaptorMesh> meshes)

Returns the closed edges selected in Edge mode on meshes. Returns a new list on each call.

ParameterTypeDescription
meshesIEnumerable<RaptorMesh>The Blocks.

Returns: The edges. Empty unless Mesh mode and Edge mode are active and some of the Blocks' edges are selected.