UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

95 lines (93 loc) 4.63 kB
import type Accessor from "../../../core/Accessor.js"; export interface RenderCameraProperties extends Partial<Pick<RenderCamera, "center" | "eye" | "far" | "fovX" | "fovY" | "near" | "pixelRatio" | "up" | "viewMatrix" | "viewport">> {} /** * This is the RenderCamera interface used by the [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). The RenderCamera specifies * the view position and orientation in render coordinates only. See [section on coordinate systems](https://developers.arcgis.com/javascript/latest/references/core/views/3d/webgl/RenderNode/#coordinate-systems) for details. * * The render camera is distinct from [Camera](https://developers.arcgis.com/javascript/latest/references/core/Camera/) and is meant to be worked with when using * [RenderNode](https://developers.arcgis.com/javascript/latest/references/core/views/3d/webgl/RenderNode/). * * > [!WARNING] * > * > ### Important guidelines * > * > **This interface is experimental**. Please read the following information carefully before using it in a product: * > It is not possible to shield users of this interface from SceneView internal implementation details. Therefore, * > this interface should be considered **not stable and subject to changes in upcoming minor releases** of the ArcGIS * > Maps SDK for JavaScript. * > Because of the complex nature of WebGL and hardware-accelerated 3D rendering, this interface is targeting * > expert developers that are experienced with WebGL or OpenGL. * > * Improper use of WebGL might not only break the custom rendering, but also the rendering of * > [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) itself. * > * Esri does not provide any support for issues related to WebGL rendering in custom rendering code, or for issues * > that arise in [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) rendering while using custom rendering code. * > Integration with third-party libraries is only possible under certain conditions. Specifically, the third-party * > library has to be capable of working on the same WebGL context as [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/), and able to * > set the relevant parts of the WebGL state in every frame. * * In this documentation vectors (`Vec3` and `Vec4`) are presented as arrays of numbers. Matrices (`Mat4`) are presented as arrays * with 16 elements following the WebGL conventions where the translation component occupies the 13th, 14th, * and 15th elements. * * @since 4.30 */ export default class RenderCamera extends Accessor { constructor(properties?: RenderCameraProperties); /** * The camera target ("look at") position in the internal Cartesian rendering coordinate system represented * by a vector with 3 components. */ accessor center: readonly [ number, number, number ]; /** * The position of the camera in the internal Cartesian rendering coordinate system represented * by a vector with 3 components. */ accessor eye: readonly [ number, number, number ]; /** The distance to the far plane. */ accessor far: number; /** The horizontal field of view. */ accessor fovX: number; /** The vertical field of view. */ accessor fovY: number; /** The distance to the near plane. */ accessor near: number; /** * The render pixel ratio. This can be used to adjust screen sizes so that they * correctly match up to CSS pixel sizes when rendered in HiDPI. */ accessor pixelRatio: number; /** A 4x4 matrix that defines the perspective projection transformation. */ get projectionMatrix(): readonly number[]; /** * The camera up vector with 3 components. Returns the unorthogonalized up direction used for the * view matrix construction. This is not necessarily equal to the up axis of the camera * local coordinate system. */ accessor up: readonly [ number, number, number ]; /** A 4x4 matrix representing the inverse transpose of `viewMatrix`, used to transform normals */ get viewInverseTransposeMatrix(): readonly number[]; /** A 4x4 matrix that transforms coordinates from world space to camera space. */ accessor viewMatrix: readonly number[]; /** * The viewport expressed as vector with 4 components (x, y, width, height). This viewport does not consider * padding. */ accessor viewport: readonly [ number, number, number, number ]; }