OUTPUT_MESH: numberOUTPUT_LINE_SEGMENTS: numberOUTPUT_BOTH: numberSet of projected edges produced by ProjectionGenerator.
getLineGeometry( meshes = null: Array<Mesh> | null ): BufferGeometryReturns a new BufferGeometry representing the edges.
Pass a list of meshes in to extract edges from a specific subset of meshes in the given order. Returns all edges if null.
getRangeForMesh( mesh: Mesh ): Object | nullReturns the range of vertices associated with the given mesh in the geometry returned from
getLineGeometry. The start value is only relevant if lines are generated with the default
order and set of meshes.
Can be used to add extra vertex attributes in a geometry associated with a specific subrange of the geometry.
Utility for determining visible geometry from a top down orthographic perspective. This can be run before performing projection generation to reduce the complexity of the operation at the cost of potentially missing small details.
Constructor for the visibility culler that takes the renderer to use for culling.
pixelsPerMeter: numberThe size of a pixel on a single dimension. If this results in a texture larger than what the graphics context can provide then the rendering is tiled.
constructor(
renderer: WebGLRenderer,
{
pixelsPerMeter = 0.1: number,
}
)async cull( object: Object3D | Array<Object3D> ): Promise<Array<Object3D>>Returns the set of meshes that are visible within the given object.
Utility for generating the line segments produced by a planar intersection with geometry.
plane: PlanePlane that defaults to y up plane at the origin.
generate( geometry: MeshBVH | BufferGeometry ): BufferGeometryGenerates a geometry of the resulting line segments from the planar intersection.
Utility for generating 2D projections of 3D geometry.
iterationTime: numberHow long to spend trimming edges before yielding.
angleThreshold: numberThe threshold angle in degrees at which edges are generated.
includeIntersectionEdges: booleanWhether to generate edges representing the intersections between triangles.
async generateAsync(
geometry: Object3D | BufferGeometry | Array<Object3D>,
{
onProgress?: (
percent: number,
message: string
) => void,
signal?: AbortSignal,
}
): ProjectionResultGenerate the geometry with a promise-style API.
generate(
scene: Object3D | BufferGeometry | Array<Object3D>,
{
onProgress?: (
percent: number,
message: string
) => void,
}
): ProjectionResultGenerate the edge geometry result using a generator function.
Result object returned by ProjectionGenerator containing visible and hidden edge sets.
visibleEdges: EdgeSet.hiddenEdges
hiddenEdges: EdgeSetUsed for generating a projected silhouette of a geometry using the clipper2-js project. Performing these operations can be extremely slow with more complex geometry and not always yield a stable result.
iterationTime: numberHow long to spend trimming edges before yielding.
doubleSided: booleanIf false then only the triangles facing upwards are included in the silhouette.
sortTriangles: booleanWhether to sort triangles and project them large-to-small. In some cases this can cause the performance to drop since the union operation is best performed with smooth, simple edge shapes.
output: numberWhether to output mesh geometry, line segments geometry, or both in an array
( [ mesh, line segments ] ).
async generateAsync(
geometry: BufferGeometry,
{
onProgress?: (
percent: number
) => void,
signal?: AbortSignal,
}
): BufferGeometry | Array<BufferGeometry>Generate the silhouette geometry with a promise-style API.
generate(
geometry: BufferGeometry,
{
onProgress?: (
percent: number
) => void,
}
): BufferGeometry | Array<BufferGeometry>Generate the geometry using a generator function.
Utility for determining visible geometry from a top down orthographic perspective. This can be run before performing projection generation to reduce the complexity of the operation at the cost of potentially missing small details.
Takes the WebGPURenderer instance used to render.
pixelsPerMeter: numberThe size of a pixel on a single dimension. If this results in a texture larger than what the graphics context can provide then the rendering is tiled.
constructor(
renderer: WebGPURenderer,
{
pixelsPerMeter = 0.1: number,
}
)async cull( object: Object3D | Array<Object3D> ): Promise<Array<Object3D>>Returns the set of meshes that are visible within the given object.
Takes the WebGPURenderer instance used to run compute kernels.
angleThreshold: number = 50The threshold angle in degrees at which edges are generated.
batchSize: number = 100000The number of edges to process in one compute kernel pass. Larger values can process faster but may cause internal buffers to overflow, resulting in extra kernel executions, taking more time.
includeIntersectionEdges: boolean = trueWhether to generate edges representing the intersections between triangles.
iterationTime: number = 300How long to spend generating edges.
parallelJobs: number = 3How many compute jobs to perform in parallel.
constructor( renderer: WebGPURenderer )async generate(
scene: Object3D | BufferGeometry | Array<Object3D>,
{
onProgress?: (
percent: number,
message: string
) => void,
signal?: AbortSignal,
}
): Promise<ProjectionResult>Asynchronously generate the edge geometry result.