import * as THREE from 'three'; import type { ResolvedSettings } from '../options.js'; export type SheetUniforms = Record; /** Uniforms every sheet in a scene shares. */ export interface SheetShading { /** Direction across of the turning sheet's root (x, z) and whether one is turning. */ spineContact: THREE.IUniform; /** Towards the sun, in the magazine's frame. */ lightDirection: THREE.IUniform; /** Where the sheets' group sits in the magazine's frame; the engine keeps it current. */ origin: THREE.IUniform; } export interface SheetShader { /** GLSL defining `vec3 sheetPosition(vec2 uv, float noise)` and its uniforms. */ vertexChunk: string; /** GLSL defining `bool sheetHidden(vec3 p)` and its uniforms: true where not to draw. */ fragmentChunk?: string; /** Finite difference step for normals, in page widths. */ epsilon: number; /** Read per-vertex noise from the `aNoise` attribute (declared by the chunk). */ noise?: boolean; /** Nudges the shadow caster sideways. */ shadowOffsetX: number; } /** * Give a material using BasicShadowMap a soft PCF-like lookup in its onBeforeCompile * callback. Since 0.182, three.js samples PCF shadows through a hardware depth comparison, * which iOS Safari answers with "in shadow" everywhere; BasicShadowMap avoids it. This * changes only the shader passed in, not three's shared chunks. With an older three.js, * whose PCF works on iOS, it returns the shader unchanged. */ export declare function withSoftBasicShadows(fragmentShader: string): string; /** Whether withSoftBasicShadows can soften this three.js's basic shadow map. */ export declare function softensBasicShadows(): boolean; export type SheetMesh = THREE.Mesh; export declare function createSheetMesh(geometry: THREE.BufferGeometry, uniforms: SheetUniforms, shader: SheetShader, settings: ResolvedSettings): SheetMesh; /** * Without a sheet gap every sheet rises from the spine at height 0, so along the spine they * all but touch and the depth buffer can't separate them: sheets further down flicker through * as a light seam. Bias each sheet's depth by its place in the stack instead: the top sheet * wins, and a sheet that's turning wins over everything. `bias` false leaves depth alone. */ export declare function layerSheet(mesh: SheetMesh, depth: number, count: number, moving: boolean, bias: boolean): void; export declare function disposeSheetMesh(mesh: SheetMesh): void; /** A 1×1 texture of one colour, for blank pages and placeholders. */ export declare function solidTexture(color: THREE.ColorRepresentation): THREE.DataTexture;