import * as THREE from 'three'; import type { ThreeElement } from "../three-types.js"; import type { EventManager } from "./events.js"; import { type Dpr, type Frameloop, type Performance, type Renderer, type RootState, type RootStore, type Size } from "./store.js"; import { type Camera, type Properties } from "./utils.js"; interface OffscreenCanvas extends EventTarget { } export type DefaultGLProps = Omit & { canvas: HTMLCanvasElement | OffscreenCanvas; }; export type GLProps = Renderer | ((defaultProps: DefaultGLProps) => Renderer) | ((defaultProps: DefaultGLProps) => Promise) | Partial | THREE.WebGLRendererParameters>; export type CameraProps = (Camera | Partial & ThreeElement & ThreeElement>) & { /** Flags the camera as manual, putting projection into your own hands */ manual?: boolean; }; export interface RenderProps { /** A threejs renderer instance or props that go into the default renderer */ gl?: GLProps; /** Dimensions to fit the renderer to. Will measure canvas dimensions if omitted */ size?: Size; /** * Enables shadows (by default PCFsoft). Can accept `gl.shadowMap` options for fine-tuning, * but also strings: 'basic' | 'percentage' | 'soft' | 'variance'. * @see https://threejs.org/docs/#api/en/renderers/WebGLRenderer.shadowMap */ shadows?: boolean | 'basic' | 'percentage' | 'soft' | 'variance' | Partial; /** * Disables three r139 color management. * @see https://threejs.org/manual/#en/color-management */ legacy?: boolean; /** Switch off automatic sRGB encoding and gamma correction */ linear?: boolean; /** Use `THREE.NoToneMapping` instead of `THREE.ACESFilmicToneMapping` */ flat?: boolean; /** Creates an orthographic camera */ orthographic?: boolean; /** * R3F's render mode. Set to `demand` to only render on state change or `never` to take control. * @see https://docs.pmnd.rs/react-three-fiber/advanced/scaling-performance#on-demand-rendering */ frameloop?: Frameloop; /** * R3F performance options for adaptive performance. * @see https://docs.pmnd.rs/react-three-fiber/advanced/scaling-performance#movement-regression */ performance?: Partial>; /** Target pixel ratio. Can clamp between a range: `[min, max]` */ dpr?: Dpr; /** Props that go into the default raycaster */ raycaster?: Partial; /** A `THREE.Scene` instance or props that go into the default scene */ scene?: THREE.Scene | Partial; /** A `THREE.Camera` instance or props that go into the default camera */ camera?: CameraProps; /** An R3F event manager to manage elements' pointer events */ events?: (store: RootStore) => EventManager; /** Callback after the canvas has rendered (but not yet committed) */ onCreated?: (state: RootState) => void; /** Response for pointer clicks that have missed any target */ onPointerMissed?: (event: MouseEvent) => void; } type Canvas = DefaultGLProps['canvas']; export type Configuration = RenderProps; /** What a root has applied, so its next configuration applies only what changed */ export interface AppliedConfiguration { /** The last configuration applied in full */ previous?: Configuration; /** The camera prop that set the current camera */ camera?: Configuration['camera']; } /** The renderer to configure, or a promise for one from an async factory */ export declare function createRenderer(canvas: Canvas, gl?: GLProps): Renderer | PromiseLike; /** * Applies the inputs that changed since the last configuration applied in full, to a root whose * renderer is installed. A runtime change, such as setFrameloop or an edit to gl.shadowMap, lasts * until its input changes. The pixel ratio instead follows the device on every call. Objects and * arrays compare shallowly, so an equal inline value is unchanged. */ export declare function applyRootConfiguration({ store, configuration }: { store: RootStore; configuration: AppliedConfiguration; }, canvas: Canvas, props: Configuration): void; export {};