BIM.works SDKs - v3.0.0-b.115
    Preparing search index...
    Index

    Constructors

    Accessors

    • get center(): vec3

      The point the camera orbits around (the pivot), in viewer coordinates

      Returns vec3

    • get eye(): vec3

      Returns vec3

    • set eye(eye: vec3): void

      The position of the camera, in viewer coordinates

      Parameters

      Returns void

    • get fov(): number

      Returns number

      The current fov (field of view)

    • set fov(fov: number): void

      Set the fov (field of view). Whenever a fov of 0 is set, the camera wil switch to orthographic view. Whenever the fov is set to any positive value below 120 it will switch to perspective view.

      Parameters

      • fov: number

        The new fov

      Returns void

    • get nearPlane(): NearPlane

      Returns NearPlane

      The configured near plane in meters, or "auto" when automatic near-plane calculation is enabled.

    • set nearPlane(nearPlane: NearPlane): void

      Set the perspective near plane in meters, or "auto" to use automatic near-plane calculation.

      Parameters

      Returns void

    • get projMatrix(): mat4

      The current projection matrix: view space to clip space as in WebGL2, z −1 at the near plane to +1 at the far plane (not reversed, no infinite far plane), with the finite near and far the camera uses: the nearPlane setting or the automatic one. Perspective or orthographic (fov 0). Conventions as viewMatrix

      Returns mat4

    • get target(): vec3

      Returns vec3

    • set target(target: vec3): void

      The point the camera looks at, in viewer coordinates

      Parameters

      Returns void

    • get up(): vec3

      Returns vec3

    • set up(up: vec3): void

      The camera's up direction

      Parameters

      Returns void

    • get viewMatrix(): mat4

      The current view matrix: render frame to view space. The camera matrices keep the WebGL2 conventions whatever the viewer renders with (Viewer3D-Next/docs/plan.md §3.13): gl-matrix mat4 values (Float64Array, 16 numbers, column-major), a right-handed view space with the camera looking down −z and y up. They are the camera's own arrays, updated when it moves: read them, copy what you keep

      Returns mat4

    • get viewProjMatrix(): mat4

      The current view-projection matrix, projMatrix × viewMatrix: render frame to clip space, for example to place DOM elements over the canvas. Un-projecting a canvas point with its inverse at z −1 and +1 gives the point on the near and on the far plane. Conventions as viewMatrix and projMatrix

      Returns mat4

    Methods

    • The size of one viewer pixel (Viewer3d.getHeight) in mm: the same everywhere in an orthographic view; in a perspective view at the depth of point (render frame, default the target); 0 before the viewer has a size

      Parameters

      Returns number

    • Get the current ViewPoint

      Returns ViewPoint

      The current ViewPoint

    • Moves the camera to a new eye and target (render frame, mm), animated over animationTimeMs. An eye below the camera's eye floor (the lowest height the eye may have, if one is set) is lifted onto it with the target

      Parameters

      • newEye: vec3
      • newTarget: vec3
      • animationTimeMs: number
      • Optionaloptions: { orthoHalfHeight?: number; pivot?: vec3; up?: vec3 }

        pivot: the orbit pivot at the end (render frame), the current one when absent; up: the up direction at the end, derived from the current one when absent; orthoHalfHeight: in orthographic mode, the half height of the view window at the end in mm, the current one when absent

      Returns void

    • Whether the camera stands still: no animation, drag or navigation key in progress

      Returns boolean

    • Rotates the eye around the target, about the up direction

      Parameters

      • degrees: number
      • Optionaloptions: { animate?: boolean }

      Returns void

    • Set the current viewpoint, make sure to wait for this call to finish

      Parameters

      • viewPoint: ViewPoint

        The ViewPoint to set. When no fov has been set on the ViewPoint, the fov will be unchanged

      • animationTime: number

        The time to animate in ms, the default is 0 and indicates no animation at all

      Returns Promise<void>

    • Fits the camera on a box

      Parameters

      • params: {
            aabb?: AxisAlignedBoundingBox3D;
            animate?: boolean;
            animationTimeMs?: number;
            box?: { max: vec3; min: vec3 };
            fov?: number;
            margin?: number;
            target?: vec3;
            updatePivot?: boolean;
            viewDirection?: vec3;
        }

        aabb: the box (render frame), for example from Viewer3d.getFocusAabb, the camera's scene bounds when absent; box: the same box as a plain value {min, max} (render frame, mm), used when aabb is absent, for example a box computed from points with Viewer3d.measurementToRenderCoordinates; margin, animate, animationTimeMs, updatePivot (make the box's centre the orbit pivot), viewDirection and target as in @bimworks/viewercommon!ViewFitOptions; fov: change the field of view first

      Returns void

      Error when box has a corner that is not three finite numbers, or a min above its max