UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

132 lines (131 loc) 4.99 kB
import { RenderTargetTexture } from "../../Materials/Textures/renderTargetTexture.js"; import { Matrix } from "../../Maths/math.vector.js"; import { type Mesh } from "../../Meshes/mesh.js"; import { type Scene } from "../../scene.js"; import { Observable } from "../../Misc/observable.js"; import { ProceduralTexture } from "../../Materials/Textures/Procedurals/proceduralTexture.js"; import { type IblShadowsRenderPipeline } from "./iblShadowsRenderPipeline.js"; import "../../Engines/Extensions/engine.multiRender.js"; /** * Voxel-based shadow rendering for IBL's. * This should not be instanciated directly, as it is part of a scene component * @internal * @see https://playground.babylonjs.com/#8R5SSE#222 */ export declare class _IblShadowsVoxelRenderer { private _scene; private _engine; private _voxelGrid; private _voxelGridRT; private _combinedVoxelGridPT; private _voxelGridXaxis; private _voxelGridYaxis; private _voxelGridZaxis; private _voxelMrtsXaxis; private _voxelMrtsYaxis; private _voxelMrtsZaxis; private _voxelMaterial; private _voxelClearColor; /** * Return the voxel grid texture. * @returns The voxel grid texture. */ getVoxelGrid(): ProceduralTexture | RenderTargetTexture; /** * Return the voxel render target used during voxelization. * @returns The voxel render target. */ getRT(): ProceduralTexture | RenderTargetTexture; /** * Observable that triggers when the voxelization is complete */ onVoxelizationCompleteObservable: Observable<void>; private _maxDrawBuffers; private _renderTargets; private _triPlanarVoxelization; /** * Whether to use tri-planar voxelization. More expensive, but can help with artifacts. */ get triPlanarVoxelization(): boolean; /** * Whether to use tri-planar voxelization. More expensive, but can help with artifacts. */ set triPlanarVoxelization(enabled: boolean); private _voxelizationInProgress; private _invWorldScaleMatrix; /** * Set the matrix to use for scaling the world space to voxel space * @param matrix The matrix to use for scaling the world space to voxel space */ setWorldScaleMatrix(matrix: Matrix): void; /** * @returns Whether voxelization is currently happening. */ isVoxelizationInProgress(): boolean; private _voxelResolution; private _voxelResolutionExp; /** * Resolution of the voxel grid. The final resolution will be 2^resolutionExp. */ get voxelResolutionExp(): number; /** * Resolution of the voxel grid. The final resolution will be 2^resolutionExp. */ set voxelResolutionExp(resolutionExp: number); private _copyMipEffectRenderer; private _copyMipEffectWrapper; private _copyMipSourceTexture?; private _copyMipLayer; private _mipArray; /** * Instanciates the voxel renderer * @param scene Scene to attach to * @param iblShadowsRenderPipeline The render pipeline this pass is associated with * @param resolutionExp Resolution of the voxel grid. The final resolution will be 2^resolutionExp. * @param triPlanarVoxelization Whether to use tri-planar voxelization. Only applies to WebGL. Voxelization will take longer but will reduce missing geometry. * @returns The voxel renderer */ constructor(scene: Scene, iblShadowsRenderPipeline: IblShadowsRenderPipeline, resolutionExp?: number, triPlanarVoxelization?: boolean); private _generateMipMaps; private _generateMipMap; private _copyMipMaps; private _copyMipMap; private _computeNumberOfSlabs; private _createTextures; private _createVoxelMRTs; private _disposeVoxelTextures; private _createVoxelMaterials; /** * Checks if the voxel renderer is ready to voxelize scene * @returns true if the voxel renderer is ready to voxelize scene */ isReady(): boolean; /** * If the MRT's are already in the list of render targets, this will * remove them so that they don't get rendered again. */ private _stopVoxelization; private _removeVoxelRTs; /** * Renders voxel grid of scene for IBL shadows * @param includedMeshes * @param registerAfterRenderObservable Whether to register scene onAfterRender callback (legacy path). */ updateVoxelGrid(includedMeshes: Mesh[], registerAfterRenderObservable?: boolean): void; /** * Advances voxelization work when running in custom render loops (for example FrameGraph tasks) * where scene onAfterRender timing may differ from classic pipeline flow. */ processVoxelization(): void; private _renderVoxelGridBound; private _renderVoxelGrid; private _addRTsForRender; /** * Called by the pipeline to resize resources. */ resize(): void; /** * Disposes the voxel renderer and associated resources */ dispose(): void; }