import * as THREEJS from "three"; import type { Context } from "../../context"; import * as Inputs from "../../inputs"; import type { OrbitCameraInstance, InputHandler, OrbitCameraController } from "../../inputs/threejs-camera-inputs"; export type { OrbitCameraInstance, InputHandler, OrbitCameraController }; /** * The orbiting camera for Three.js: it looks at a pivot point from a distance and turns around it * with `yaw` around the vertical axis and `pitch` up or down, both in degrees. The controller it * gives back carries the camera and its input handlers; the methods here move the pivot, frame an * object, reset the view and fence the distance and pitch. */ export declare class ThreeJSOrbitCamera { private readonly context; constructor(context: Context); /** * Creates an orbit camera that circles `pivotPoint` at `distance`, placed by `yaw` and `pitch` * in degrees, with mouse, touch and keyboard controls attached to `domElement` or the page. * * The limits fence how far it can zoom and tilt, damping and inertia smooth its motion, and * with `focusObject` and `frameOnStart` it starts framed on that object. * @param inputs - The pivot, distance, angles, limits, sensitivities, smoothing and start options * @returns The orbit camera controller holding the camera and its input handlers * @group create * @shortname new orbit camera * @example * ```typescript * const orbit = bitbybit.three.camera.orbitCamera.create({ pivotPoint: [0, 0, 0], distance: 20, pitch: 30, yaw: 45, distanceMin: 0.1, distanceMax: 1000, pitchAngleMin: -90, pitchAngleMax: 90, orbitSensitivity: 0.3, distanceSensitivity: 0.15, panSensitivity: 1, inertiaFactor: 0.1, autoRender: true, frameOnStart: true, enableDamping: true, dampingFactor: 0.1 }); * ``` */ create(inputs: Inputs.ThreeJSCamera.OrbitCameraDto): OrbitCameraController; /** * Moves the point an orbit camera looks at and circles around, keeping its distance and angles. * @param inputs - The orbit camera controller and the new pivot point * @group adjust * @shortname set pivot point * @example * ```typescript * bitbybit.three.camera.orbitCamera.setPivotPoint({ orbitCamera: orbit, pivotPoint: [0, 5, 0] }); * ``` */ setPivotPoint(inputs: Inputs.ThreeJSCamera.PivotPointDto): void; /** * Reads the point an orbit camera looks at and circles around. * @param inputs - The orbit camera controller * @returns The pivot point * @group get * @shortname get pivot point */ getPivotPoint(inputs: Inputs.ThreeJSCamera.PivotPointDto): Inputs.Base.Point3; /** * Turns an orbit camera toward an object and backs off until the whole object fits the view, * with `padding` above 1 leaving space around it. * @param inputs - The orbit camera controller, the object and the padding factor * @group adjust * @shortname focus on object * @example * ```typescript * bitbybit.three.camera.orbitCamera.focusOnObject({ orbitCamera: orbit, object: drawn, padding: 1.5 }); * ``` */ focusOnObject(inputs: Inputs.ThreeJSCamera.FocusObjectDto): void; /** * Puts an orbit camera at the given `yaw` and `pitch` in degrees and `distance` from its pivot, * discarding whatever the user has done with it. * @param inputs - The orbit camera controller, the two angles and the distance * @group adjust * @shortname reset camera * @example * ```typescript * bitbybit.three.camera.orbitCamera.resetCamera({ orbitCamera: orbit, yaw: 45, pitch: 30, distance: 20 }); * ``` */ resetCamera(inputs: Inputs.ThreeJSCamera.ResetCameraDto): void; /** * Reads how far an orbit camera currently is from its pivot point, in scene units. * @param inputs - The orbit camera controller * @returns The distance * @group get * @shortname get distance */ getDistance(inputs: Inputs.ThreeJSCamera.OrbitCameraControllerDto): number; /** * Moves an orbit camera to `distance` scene units from its pivot point, within its distance * limits; the angles in the same input are ignored. * @param inputs - The orbit camera controller and the distance * @group adjust * @shortname set distance */ setDistance(inputs: Inputs.ThreeJSCamera.ResetCameraDto): void; /** * Reads the angle an orbit camera has turned around the vertical axis, in degrees. * @param inputs - The orbit camera controller * @returns The yaw in degrees * @group get * @shortname get yaw */ getYaw(inputs: Inputs.ThreeJSCamera.OrbitCameraControllerDto): number; /** * Reads how far an orbit camera looks up or down, in degrees; 0 is level, positive looks down * from above. * @param inputs - The orbit camera controller * @returns The pitch in degrees * @group get * @shortname get pitch */ getPitch(inputs: Inputs.ThreeJSCamera.OrbitCameraControllerDto): number; /** * Fences how close to and how far from its pivot an orbit camera may zoom, in scene units. * @param inputs - The orbit camera controller and the minimum and maximum distance * @group adjust * @shortname set distance limits * @example * ```typescript * bitbybit.three.camera.orbitCamera.setDistanceLimits({ orbitCamera: orbit, min: 5, max: 100 }); * ``` */ setDistanceLimits(inputs: Inputs.ThreeJSCamera.SetDistanceLimitsDto): void; /** * Fences how far up and down an orbit camera may tilt, in degrees, so it cannot go below the * ground or over the top. * @param inputs - The orbit camera controller and the minimum and maximum pitch * @group adjust * @shortname set pitch limits * @example * ```typescript * bitbybit.three.camera.orbitCamera.setPitchLimits({ orbitCamera: orbit, min: 0, max: 89 }); * ``` */ setPitchLimits(inputs: Inputs.ThreeJSCamera.SetPitchLimitsDto): void; private createOrbitCameraInstance; private createMouseInput; private createTouchInput; private createKeyboardInput; } /** * Standalone function to create an orbit camera without requiring a BitByBit context. * This is useful for the initThreeJS helper function. * * @param inputs Configuration options including scene and domElement * @returns Orbit camera controller instance */ export declare function createOrbitCamera(inputs: Inputs.ThreeJSCamera.OrbitCameraDto & { scene: THREEJS.Scene; domElement?: HTMLElement; }): OrbitCameraController;