/** * Copyright (c) 2021-2026 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose * @author Gianluca Tomasello */ import { WebGLContext } from '../../mol-gl/webgl/context.js'; import { Texture } from '../../mol-gl/webgl/texture.js'; import { ParamDefinition as PD } from '../../mol-util/param-definition.js'; import { RenderTarget } from '../../mol-gl/webgl/render-target.js'; import { PostprocessingProps } from './postprocessing.js'; import { ICamera } from '../camera.js'; import { StereoCamera } from '../camera/stereo.js'; import { RendererProps } from '../../mol-gl/renderer.js'; import { Scene } from '../../mol-gl/scene.js'; import { RenderContext as BaseRenderContext } from '../util.js'; export declare const MarkingParams: { enabled: PD.BooleanParam; highlightEdgeColor: PD.Color; selectEdgeColor: PD.Color; edgeScale: PD.Numeric; highlightEdgeStrength: PD.Numeric; selectEdgeStrength: PD.Numeric; ghostEdgeStrength: PD.Numeric; innerEdgeFactor: PD.Numeric; }; export type MarkingProps = PD.Values; export declare const SingleSample: number[][]; /** Whether marked objects are tinted and unmarked ones dimmed in the material color instead of by the marking pass. */ export declare function isMaterialColorMarker(rendererProps: Pick, markingProps: MarkingProps): boolean; type Props = { marking: MarkingProps; postprocessing: PostprocessingProps; transparentBackground: boolean; }; export type MarkingPresentOptions = { /** image to blend the marking over */ base: RenderTarget; toDrawingBuffer: boolean; /** jitter offsets the layer is accumulated from */ offsets: number[][]; /** start the layer over instead of adding to it */ restart: boolean; /** maximum number of samples to add */ samples: number; /** how the base image was shaded, kept on tinted and dimmed objects */ shading: MarkingShading | null; }; export type MarkingShading = { name: 'ssao'; ssao: Texture; } /** the (denoised) base image relative to the direct `shaded` color gives the path traced occlusion and shadows */ | { name: 'traced'; shaded: Texture; }; type RenderContext = BaseRenderContext; export declare class MarkingPass { private webgl; static isEnabled(props: MarkingProps): boolean; static hasMarking(scene: Scene, props: { marking: MarkingProps; }): boolean; private readonly depthTarget; private readonly maskTarget; private readonly edgesTarget; /** premultiplied marking, the running average of the samples taken so far */ private readonly layerTarget; private readonly edge; private readonly overlay; private readonly composite; private antialiasing; /** coverage of the visible unmarked geometry, created on first use */ private dim; /** jitter offsets the layer is accumulated from */ private offsets; /** number of offsets the layer holds samples for, 0 if it is not valid */ private sampleCount; /** image of the last render to the drawing buffer, before marking was blended over it */ private base; /** shading of `base` */ private baseShading; constructor(webgl: WebGLContext, width: number, height: number); getByteCount(): number; private setEdgeState; private setViewport; setSize(width: number, height: number): void; private update; /** Forgets the base image, needed when the last render did not go through `present`. */ invalidate(): void; /** Whether the layer is still missing samples that can be added by `redraw`. */ get needsMoreSamples(): boolean; /** * Adds up to `samples` jittered samples to the marking layer (starting over if `restart`) * and blends it over `base`, either into the drawing buffer (remembering `base` for redraws) * or in place. */ present(ctx: RenderContext, props: Props, options: MarkingPresentOptions): void; /** * Redraws marking over the image of the last render to the drawing buffer, without * re-rendering the scene. Returns false if that image is not available. */ redraw(ctx: RenderContext, props: Props, offsets: number[][], restart: boolean, samples: number): boolean; /** Returns false if there is no marking. */ private updateLayer; private getAntialiasing; /** Antialiases `input` into `output`, returns the texture to use. */ private antialias; private getDim; /** Renders the antialiased coverage of the visible unmarked geometry, from the depth and raw mask of the current sample. */ private renderDim; /** Blends the marking of the current mask into the layer, with `weight` for the new sample. */ private renderSample; /** Blends the overlay of the current sample's textures into the layer, with `weight` for the new sample. */ private renderOverlay; /** Blends the layer over the currently bound framebuffer. */ private compositeLayer; private copyToDrawingBuffer; } export {};