/** * The forward renderer renders {@link Scene}s. * * @ignore */ export class ForwardRenderer extends Renderer { static skipRenderCamera: any; static _skipRenderCounter: number; static skipRenderAfter: number; /** @type {WorldClustersDebug|null} */ _worldClustersDebug: WorldClustersDebug | null; /** * Limits how much of one render pass is drawn, for stepping through its draw calls with a * debugging tool. Matched by the camera and render target the pass renders with; for each layer * of the pass, an entry per sub-layer (opaque, transparent) gives either how many of its sorted * instances to draw, or `{ instance, index }` to draw up to and including that instance, found * by identity and falling back to the index when it was culled. Layers without an entry draw in * full. Only honored by the debug engine; other builds ignore it. * * @type {{ camera: Camera, renderTarget: RenderTarget|null, layers: Map> }|null} * @ignore */ debugDrawLimit: { camera: Camera; renderTarget: RenderTarget | null; layers: Map>; } | null; /** * Whether this build honors {@link debugDrawLimit}, which only the debug engine does. * * @type {boolean} * @ignore */ debugDrawLimitSupported: boolean; _forwardDrawCalls: number; _materialSwitches: number; _depthMapTime: number; _forwardTime: number; _sortTime: number; fogColorId: import("../../index.js").ScopeId; fogStartId: import("../../index.js").ScopeId; fogEndId: import("../../index.js").ScopeId; fogDensityId: import("../../index.js").ScopeId; ambientId: import("../../index.js").ScopeId; skyboxIntensityId: import("../../index.js").ScopeId; cubeMapRotationMatrixId: import("../../index.js").ScopeId; sceneEnvAtlasId: import("../../index.js").ScopeId; sceneSkyboxId: import("../../index.js").ScopeId; pcssDiskSamplesId: import("../../index.js").ScopeId; pcssSphereSamplesId: import("../../index.js").ScopeId; screenSizeId: import("../../index.js").ScopeId; screenSizeLegacyId: import("../../index.js").ScopeId; _screenSize: Float32Array; fogColor: Float32Array; ambientColor: Float32Array; pcssDiskSamples: number[]; pcssSphereSamples: number[]; /** * @param {Scene} scene - The scene. */ dispatchGlobalLights(scene: Scene): void; /** * Sets the uniforms of the lights of a pass, each at its light slot. The slot order is the * same for every mesh instance in the pass whatever its light mask selects, so this runs once * per pass, before the view uniform buffer is filled - the light uniforms are part of it, see * {@link Renderer#getViewUniformFormat} - and each shader reads its own slots. The shader * generator reads the same list, so the two cannot disagree about which light a slot holds. * * @param {LightList} lightList - The lights of the pass. * @param {Camera} camera - The camera, for the shadow data rendered for it. */ dispatchLights(lightList: LightList, camera: Camera): void; renderForwardPrepareMaterials(camera: any, renderTarget: any, drawCalls: any, lightList: any, layer: any, pass: any, viewUniformFormat: any): { drawCalls: any[]; shaderInstances: any[]; isNewMaterial: any[]; clear: () => void; }; renderForwardInternal(camera: any, preparedCalls: any, pass: any, drawCallback: any, flipFaces: any): void; renderForward(camera: any, renderTarget: any, allDrawCalls: any, lightList: any, pass: any, drawCallback: any, layer: any, flipFaces: any, viewUniformFormat: any): void; /** * Forward render mesh instances on a specified layer, using a camera and a render target. * Shaders used are based on the shaderPass provided, with optional clustered lighting support. * * @param {Camera} camera - The camera. * @param {RenderTarget|undefined} renderTarget - The render target. * @param {Layer} layer - The layer. * @param {boolean} transparent - True if transparent sublayer should be rendered, opaque * otherwise. * @param {number} shaderPass - A type of shader to use during rendering. * @param {object} [options] - Object for passing optional arguments. * @param {boolean} [options.clearColor] - True if the color buffer should be cleared. * @param {boolean} [options.clearDepth] - True if the depth buffer should be cleared. * @param {boolean} [options.clearStencil] - True if the stencil buffer should be cleared. * @param {WorldClusters} [options.lightClusters] - The world clusters object to be used for * clustered lighting. * @param {MeshInstance[]} [options.meshInstances] - The mesh instances to be rendered. Use * when layer is not provided. * @param {LightList} [options.lightList] - The lights to render with. Use when layer is not * provided; none by default. * @param {Function} [options.drawCallback] - Function called before each mesh instance is * rendered, with the mesh instance as the argument. * @param {UniformBufferFormat} [options.viewUniformFormat] - A custom view uniform buffer * format to use for this layer. When not provided, the renderer's format for the lights of the * pass is used, see {@link Renderer#getViewUniformFormat}. The shaders are processed and the * view uniform buffer is set up using the same format, so they always match. */ renderForwardLayer(camera: Camera, renderTarget: RenderTarget | undefined, layer: Layer, transparent: boolean, shaderPass: number, options?: { clearColor?: boolean; clearDepth?: boolean; clearStencil?: boolean; lightClusters?: WorldClusters; meshInstances?: MeshInstance[]; lightList?: LightList; drawCallback?: Function; viewUniformFormat?: UniformBufferFormat; }): void; setFogConstants(fogParams: any): void; setSceneConstants(): void; /** * Builds a frame graph for the rendering of the whole frame. * * @param {FrameGraph} frameGraph - The frame-graph that is built. * @param {LayerComposition} layerComposition - The layer composition used to build the frame * graph. * @ignore */ buildFrameGraph(frameGraph: FrameGraph, layerComposition: LayerComposition): void; /** * @param {any} camera - The camera component for the current render action. The XR data lives on * the underlying `Camera` (`CameraComponent.camera`), as `xrActive` / `xrViews`, not on the * component itself, so we dereference it before checking. * @returns {boolean} True if the camera should have its passes replicated per XR view (currently * gated to the WebGPU backend; other backends keep the existing single-pass multi-viewport flow). * @private */ private _isMultiview; /** * @param {FrameGraph} frameGraph - The frame graph. * @param {LayerComposition} layerComposition - The layer composition. */ addMainRenderPass(frameGraph: FrameGraph, layerComposition: LayerComposition, renderTarget: any, startIndex: any, endIndex: any): void; /** * Build a {@link LayerRenderStep} from a composition {@link RenderAction}. This is the only * place that bridges the internal RenderAction scheduling type to the render pass's own * LayerRenderStep, so neither RenderPassForward nor LayerRenderStep reference RenderAction. * * @param {RenderAction} renderAction - The composition render action. * @returns {LayerRenderStep} The layer render step. * @private */ private _layerRenderStepFromRenderAction; /** * @param {LayerComposition} comp - The layer composition. */ update(comp: LayerComposition): void; /** * Visibility culling of mesh instances and shadow casters, followed by GPU data updates for the * resulting visible objects, and consuming one-shot shadow updates. Runs after the frame graph * has been built (which is itself after {@link ForwardRenderer#update}), so shadow-pass building * and shadow-caster culling have both read the shadow update mode before it is consumed here. * * @param {LayerComposition} comp - The layer composition. */ cull(comp: LayerComposition): void; } import { Renderer } from './renderer.js'; import { WorldClustersDebug } from '../lighting/world-clusters-debug.js'; import type { Camera } from '../camera.js'; import type { RenderTarget } from '../../platform/graphics/render-target.js'; import type { Layer } from '../layer.js'; import type { MeshInstance } from '../mesh-instance.js'; import type { Scene } from '../scene.js'; import { LightList } from '../lighting/light-list.js'; import type { WorldClusters } from '../lighting/world-clusters.js'; import type { UniformBufferFormat } from '../../platform/graphics/uniform-buffer-format.js'; import type { FrameGraph } from '../frame-graph.js'; import type { LayerComposition } from '../composition/layer-composition.js';