import { mat4 } from 'gl-matrix'; import { GLclampf4, GLfloat2 } from '../tuples'; import { Camera } from '../camera'; import { ChangeLookup } from '../changelookup'; import { Context } from '../context'; import { Framebuffer } from '../framebuffer'; import { Geometry } from '../geometry'; import { Program } from '../program'; import { Material } from './material'; import { SceneNode } from './scenenode'; import { SceneRenderPass } from './scenerenderpass'; /** * This class renders a SceneNode hierarchy. It uses one single program for rendering the whole scene. * If different programs are necessary to render a scene, multiple SceneNodes should be used for each * program that is used. * This renderpass calls callbacks such as `updateModelTransform`, which have to be set by the renderer * using this renderpass. */ export declare class ForwardSceneRenderPass extends SceneRenderPass { /** * Alterable auxiliary object for tracking changes on render pass inputs and lazy updates. */ protected readonly _altered: ChangeLookup & { any: boolean; camera: boolean; }; /** @see {@link target} */ protected _target: Framebuffer; /** @see {@link camera} */ protected _camera: Camera; /** @see {@link ndcOffset} */ protected _ndcOffset: GLfloat2; /** @see {@link clearColor} */ protected _clearColor: GLclampf4; /** @see {@link program} */ protected _program: Program; /** * These maps are used to map from a material to all geometries using this material. * Alongside the geometry a transform is saved, that is generated during a preprocessing traverse. */ protected _opaqueGeometryMap: Map>; protected _transparentGeometryMap: Map>; updateModelTransform: (matrix: mat4) => void; updateViewProjectionTransform: (matrix: mat4) => void; bindMaterial: (material: Material) => void; bindGeometry: (geometry: Geometry) => void; bindUniforms: () => void; /** * Creates a pass that renders a SceneNode and all of its children. * @param context - @todo The WebGL context for rendering the scene. */ constructor(context: Context); /** * Sort all geometries by their material and save their transform given by a scene traversal. * With this information, rendering can be sped up later on by avoiding material changes * during rendering of the scene. */ protected preprocessScene(): void; /** * Handle a single node during preprocessing. Each GeometryComponent of the node will be added * to the preprocessing maps. * Afterwards all children of the node will also be processed recursively. */ protected preprocessNode(node: SceneNode, transform: mat4): void; /** * Render a preprocessed map, where geometries are already sorted by material. * Thus, each material only needs to be bound once. */ protected renderGeometryMap(map: Map>): void; initialize(): boolean; uninitialize(): void; prepare(): void; /** * @param override - If enabled, everything will be updated, regardless of tracked alterations. */ update(override?: boolean): void; /** * Triggers rendering a frame of the given hierarchy. All nodes in the hierarchy will be visited recursively * and rendered. If nodes contain transformations, they are applied and used for the whole subtree. */ frame(): void; /** * Encapsulates the draw calls made to webgl. This is useful if state should not be changed before rendering, * e.g. for shadow mapping. */ drawCalls(renderTransparentMaterials?: boolean): void; /** * Sets the framebuffer the quads are rendered to. * @param target - Framebuffer to render into. */ set target(target: Framebuffer); /** * The NDC offset is used for vertex displacement within subpixel space for anti-aliasing over * multiple intermediate frames (multi-frame sampling). * @param offset - Subpixel offset used for vertex displacement (multi-frame anti-aliasing). */ set ndcOffset(offset: GLfloat2); /** * The camera's viewProjection is used for 3D label placement calculation. */ set camera(camera: Camera); /** * Sets the clear color for rendering. */ set clearColor(color: GLclampf4); set program(program: Program); }