@three.ez/batched-mesh-extensions
Version:
Utility extension methods for BatchedMesh
56 lines • 2.87 kB
TypeScript
import { BatchedMesh, BufferGeometry, Camera, Material, Scene, WebGLRenderer } from 'three';
import { MultiDrawRenderItem } from '../MultiDrawRenderList.js';
/**
* A custom sorting callback for render items.
*/
export type CustomSortCallback = (list: MultiDrawRenderItem[]) => void;
/**
* Callback invoked when an instance is within the frustum.
* @param index The index of the instance.
* @param camera The camera used for rendering.
* @param cameraLOD The camera used for LOD calculations (provided only if LODs are initialized).
* @param LODIndex The LOD level of the instance (provided only if LODs are initialized and `sortObjects` is false).
* @returns True if the instance should be rendered, false otherwise.
*/
export type OnFrustumEnterCallback = (index: number, camera: Camera, cameraLOD?: Camera, LODIndex?: number) => boolean;
declare module 'three' {
interface BatchedMesh {
/**
* Callback function called if an instance is inside the frustum.
*/
onFrustumEnter?: OnFrustumEnterCallback;
/**
* Performs frustum culling and sorting.
* @param camera The main camera used for rendering.
* @param cameraLOD The camera used for LOD calculations (provided only if LODs are initialized).
*/
frustumCulling(camera: Camera, cameraLOD?: Camera): void;
/**
* Updates the index array for indirect rendering.
*/
updateIndexArray(): void;
/**
* Updates the render list based on the current visibility and sorting settings.
*/
updateRenderList(): void;
/**
* Performs BVH frustum culling.
* @param camera The main camera used for rendering.
* @param cameraLOD The camera used for LOD calculations (provided only if LODs are initialized).
*/
BVHCulling(camera: Camera, cameraLOD: Camera): void;
/**
* Performs linear frustum culling.
* @param camera The main camera used for rendering.
* @param cameraLOD The camera used for LOD calculations (provided only if LODs are initialized).
*/
linearCulling(camera: Camera, cameraLOD: Camera): void;
}
}
export declare function onBeforeRender(this: BatchedMesh, renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: any): void;
export declare function frustumCulling(this: BatchedMesh, camera: Camera, cameraLOD?: Camera): void;
export declare function updateIndexArray(this: BatchedMesh): void;
export declare function updateRenderList(this: BatchedMesh): void;
export declare function BVHCulling(this: BatchedMesh, camera: Camera, cameraLOD: Camera): void;
export declare function linearCulling(this: BatchedMesh, camera: Camera, cameraLOD: Camera): void;
//# sourceMappingURL=FrustumCulling.d.ts.map