three-mesh-bvh
Version:
A BVH implementation to speed up raycasting against three.js meshes.
15 lines (11 loc) • 474 B
JavaScript
// Note that a struct cannot be used for the hit record including faceIndices, faceNormal, barycoord,
// side, and dist because on some mobile GPUS (such as Adreno) numbers are afforded less precision specifically
// when in a struct leading to inaccurate hit results. See KhronosGroup/WebGL#3351 for more details.
export const bvh_struct_definitions = /* glsl */`
struct BVH {
usampler2D index;
sampler2D position;
sampler2D bvhBounds;
usampler2D bvhContents;
};
`;