three-mesh-bvh
Classes
BVHAbstract base class for BVH implementations.BVHHelperATHREE.Groupthat visualizes a BVH as wireframe bounding boxes or solid face overlays.ExtendedTriangleAn extended version of three.js' Triangle class.FloatVertexAttributeTextureA VertexAttributeTexture that forces the float texture type.GenerateMeshBVHWorkerHelper class for generating a MeshBVH for a given geometry in asynchronously in a worker.GeometryBVHAbstract base class for geometry-backed BVH implementations.IntVertexAttributeTextureA VertexAttributeTexture that forces the signed integer texture type.LineBVHBVH forTHREE.Linegeometries.LineLoopBVHBVH forTHREE.LineLoopgeometries.LineSegmentsBVHBVH forTHREE.LineSegmentsgeometries.MeshBVHThe MeshBVH generation process modifies the geometry's index bufferAttribute in place to save memory.MeshBVHUniformStructA shader uniform object corresponding to theBVHshader struct defined in shaderStructs.ObjectBVHBVH built from a scene hierarchy rather than a single geometry.OrientedBoxAn oriented version of three.js' Box3 class.ParallelMeshBVHWorkerA drop-in replacement forGenerateMeshBVHWorkerthat distributes BVH construction across multiple Web Workers in parallel for faster builds on large geometry.PointsBVHBVH forTHREE.Pointsgeometries.SkinnedMeshBVHBVH forSkinnedMeshobjects.StaticGeometryGeneratorA utility class for taking a set of SkinnedMeshes or morph target geometry and baking it into a single, static geometry that a BVH can be generated for.UIntVertexAttributeTextureA VertexAttributeTexture that forces the unsigned integer texture type.VertexAttributeTextureFloat, Uint, and Int VertexAttributeTexture implementations are designed to simplify the efficient packing of a three.js BufferAttribute into a texture.
Functions
acceleratedRaycastAn accelerated raycast function with the same signature asTHREE.Mesh.raycast.computeBatchedBoundsTreeEquivalent ofcomputeBoundsTreeforBatchedMesh.computeBoundsTreeA pre-made BufferGeometry extension function that builds a new BVH, assigns it toboundsTreefor BufferGeometry, and applies the new index buffer to the geometry.disposeBatchedBoundsTreeEquivalent ofdisposeBoundsTreeforBatchedMesh.disposeBoundsTreeA BufferGeometry extension function that disposes of the BVH.estimateMemoryInBytesRoughly estimates the amount of memory in bytes used by a BVH by walking its object graph and summing typed-array byte lengths and primitive sizes.getBVHExtremesMeasures the min and max extremes of the BVH tree structure, including node depth, leaf primitive count, split axis distribution, and a surface-area heuristic score.getJSONStructureReturns a plain-object tree that mirrors the BVH hierarchy, useful for inspecting or serialising the structure for debugging.getTriangleHitPointInfoComputes hit-point information for a point on a triangle within aBufferGeometry.validateBoundsValidates that every node's bounding box fully contains its children and, for leaf nodes, fully contains all of its primitives.
Constants
AVERAGEOption for splitting each BVH node at the average point along the longest axis for all triangle centroids in the bounds.bvh_distance_functionsSet of shader functions used for interacting with the packed BVH in a shader and sampling VertexAttributeTextures.bvh_ray_functionsSet of shader functions used for interacting with the packed BVH in a shader and sampling VertexAttributeTextures.bvh_struct_definitionsSet of shader structs and defined constants used for interacting with the packed BVH in a shader.CENTEROption for splitting each BVH node down the center of the longest axis of the bounds.common_functionsSet of shader functions used for interacting with the packed BVH in a shader and sampling VertexAttributeTextures.CONTAINEDIndicate the shape entirely contains the given bounding box.INTERSECTEDIndicates the shape did intersect the given bounding box.NOT_INTERSECTEDIndicates the shape did not intersect the given bounding box.SAHOption to use a Surface Area Heuristic to split the bounds more optimally.