import type { Box3, Box3Helper, Color, ColorRepresentation, Group, Matrix4, Sprite, Storage3DTexture, StorageInstancedBufferAttribute } from 'three/webgpu'; export interface SDFVolumeBoundsSource { readonly bounds: Box3; readonly meshMatrixWorld?: Matrix4 | null | undefined; } export interface SDFVolumeDebugSource extends SDFVolumeBoundsSource { readonly boundsMatrix: Matrix4; readonly sdfTexture: Storage3DTexture | null; } export interface SDFPointCloudSamplerSource { readonly positionsBuffer: StorageInstancedBufferAttribute; readonly count: number; } export interface SDFPointCloudHelperOptions { pointSize?: number | undefined; color?: ColorRepresentation | undefined; } export interface SDFDebugGridOptions { gridSize?: number | undefined; sphereRadius?: number | undefined; colorFn?: ((distance: number) => Color) | undefined; } /** * Collection of helper utilities for debugging and visualizing SDF volumes. * * **Overview** * These helpers provide visual feedback for SDF generation and sampling, which is crucial for debugging: * - **Bounds Helper**: Visualizes the volume extent. * - **Point Cloud**: Visualizes sampled points to verify distribution and containment. * - **Debug Grid**: Visualizes the SDF values (distance field) directly using a grid of spheres. * * @module SDFVolumeHelpers * @short Debug helpers to visualize SDF bounds, sampled points, and grid probes. * @category Compute * @tags WebGPU */ /** * Creates a Box3Helper for visualizing SDF volume bounds. * * @param {ComputeSDFGenerator} sdfGenerator - SDF generator instance. * @param {number} [color=0xffff00] - Helper line color. * @returns {THREE.Box3Helper} Box helper for SDF bounds. * * @example * import { createSDFBoundsHelper } from 'three-blocks/sdf-raymarching'; * * const boundsHelper = createSDFBoundsHelper(sdfGenerator); * scene.add(boundsHelper); * * // Update when SDF regenerates * await sdfGenerator.generate(mesh, bvh, renderer); * updateSDFBoundsHelper(boundsHelper, sdfGenerator); */ export declare function createSDFBoundsHelper(sdfGenerator: SDFVolumeBoundsSource, color?: ColorRepresentation): Box3Helper; /** * Updates an existing Box3Helper to match current SDF bounds. * * @param {THREE.Box3Helper} helper - Existing Box3Helper. * @param {ComputeSDFGenerator} sdfGenerator - SDF generator instance. * * @example * // After regenerating SDF * await sdfGenerator.generate(mesh, bvh, renderer); * updateSDFBoundsHelper(boundsHelper, sdfGenerator); */ export declare function updateSDFBoundsHelper(helper: Box3Helper, sdfGenerator: SDFVolumeBoundsSource): void; /** * Creates a point cloud visualization of sampled positions. * * @param {ComputeBVHSampler} sampler - BVH sampler instance. * @param {Object} [options] - Configuration options. * @param {number} [options.pointSize=2] - Point size in pixels. * @param {number} [options.color=0x00ffff] - Point color. * @returns {Promise} Points mesh for visualization. * * @example * import { createSDFPointCloudHelper } from 'three-blocks/sdf-raymarching'; * * await sampler.compute(); * const pointCloud = await createSDFPointCloudHelper(sampler, { * pointSize: 3, * color: 0xff00ff * }); * scene.add(pointCloud); */ export declare function createSDFPointCloudHelper(sampler: SDFPointCloudSamplerSource, options?: SDFPointCloudHelperOptions): Promise; /** * Creates a grid of spheres showing SDF sample locations (for debugging sampling). * * @param {ComputeSDFGenerator} sdfGenerator - SDF generator instance. * @param {Object} [options] - Configuration options. * @param {number} [options.gridSize=8] - Number of samples per axis. * @param {number} [options.sphereRadius=0.02] - Sphere radius. * @param {Function} [options.colorFn] - Custom color function: `(sdfValue) => THREE.Color`. * @returns {THREE.Group} Group containing sphere instances. * * This implementation-level API is intentionally internal and has no public package import. */ export declare function createSDFDebugGrid(sdfGenerator: SDFVolumeDebugSource, options?: SDFDebugGridOptions): Group;