@needle-tools/gltf-progressive
Version:
three.js support for loading glTF or GLB files that contain progressive loading data
31 lines (30 loc) • 1.46 kB
TypeScript
import { BufferGeometry, Object3D } from "three";
export declare const isSSR: boolean;
/**
* The raycast mesh is a low poly version of the mesh used for raycasting. It is set when a mesh that has LOD level with more vertices is discovered for the first time
* @param obj the object to get the raycast mesh from
* @returns the raycast mesh or null if not set
*/
export declare function getRaycastMesh(obj: Object3D): BufferGeometry<any> | null;
/**
* Set the raycast mesh for an object.
* The raycast mesh is a low poly version of the mesh used for raycasting. It is set when a mesh that has LOD level with more vertices is discovered for the first time
* @param obj the object to set the raycast mesh for
* @param geom the raycast mesh
*/
export declare function registerRaycastMesh(obj: Object3D, geom: BufferGeometry): void;
/**
* Call this method to enable raycasting with the lowpoly raycast meshes (if available) for all meshes in the scene.
* This is useful for performance optimization when the scene contains high poly meshes that are not visible to the camera.
* @example
* ```ts
* // call to enable raycasting with low poly raycast meshes
* useRaycastMeshes();
*
* // then use the raycaster as usual
* const raycaster = new Raycaster();
* raycaster.setFromCamera(mouse, camera);
* const intersects = raycaster.intersectObjects(scene.children, true);
* ```
*/
export declare function useRaycastMeshes(enabled?: boolean): void;