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

    Type Alias Viewer3dSettings

    The settings available for the 3D Viewer

    type Viewer3dSettings = {
        autoRender?: boolean;
        browserFullscreenElement?: HTMLElement;
        cacheGeometry?: boolean;
        clustering?: boolean;
        debugging?: { renderStatistics?: { gpu: GroupStat; viewer?: GroupStat } };
        fatWireframes?: {
            cache?: boolean;
            enabled?: boolean;
            pregenerate?: boolean;
        };
        gisRadiusMeters?: number;
        hideObjectOnMiddleClick?: boolean;
        integrationMode?: 1
        | 2;
        navigationMode?: NavigationMode;
        navigationModes?: Record<string, NavigationModeSettings>;
        nearPlane?: NearPlane;
        planLabels?: {
            dropLines?: boolean;
            enabled?: boolean;
            fontSize?: number;
            height?: "top" | "bottom";
            maxTilt?: number;
            occlusion?: boolean;
            orientation?: "HORIZONTAL" | "AUTO";
            spaces?: boolean;
        };
        pointClouds?: boolean;
        preLoadTriangles?: boolean;
        realtimeSettings?: {
            annotationLimit?: number;
            annotationScaleByDistance?: boolean;
            culling?: boolean;
            cullingSettlingMs?: number;
            cullingTargetFps?: number
            | null;
            cullingTriangleBudget?: number;
            drawWireframes?: WireframeRendering;
            dynamicCullingBudget?: boolean;
            experimentalCapStyles?: boolean;
            experimentalObjectEndcaps?: boolean;
            forceTwoSidedRendering?: boolean;
            orderIndependentTransparency?: boolean;
            persistCullingBudget?: boolean;
            pickTargetHighlight?: {
                enabled?: boolean;
                onTopAlpha?: number;
                outlineColor?: [number, number, number, number];
                outlinePx?: number;
                rampSeconds?: number;
                tint?: number;
            };
            pointCloudIdlePointBudget?: number;
            pointCloudPointBudget?: number;
            progressiveFullDetail?: boolean;
            sectionCulling?: boolean;
            sectionPlaneAnnotationMode?: SectionPlaneAnnotationMode;
            sectionPlaneAnnotationReach?: number;
            textAnnotationMode?: "label"
            | "dot";
        };
        rendering?: { antialias?: boolean; sharedFrames?: boolean };
        rightMouseClick?: (
            event: MouseEvent,
            qid: Qid | null,
            pick: PickResult | null,
        ) => void;
        showLoader?: boolean;
        spatialQuerying?: {
            implementationPreferences?: SpatialQueryingPreference[];
        };
        technologyAllowed?: {
            sharedArrayBuffer?: boolean;
            transferable?: boolean;
            webGl2?: boolean;
            webGpu?: boolean;
            webWorker?: boolean;
        };
        tileSets?: { [id: string]: { [key: string]: unknown }
        | "separator" };
    }
    Index

    Properties

    autoRender?: boolean

    Ignored: MapLibre mode never runs its own render loop, the other modes always do (Viewer3d.start/Viewer3d.stop)

    browserFullscreenElement?: HTMLElement

    The element that goes full screen (Viewer3d.toggleFullScreen, game and drone navigation); default the container. Pass a parent to take overlays such as a minimap along

    cacheGeometry?: boolean

    Whether to cache geometry data in the browser if possible

    clustering?: boolean

    Group models that lie far apart into clusters the user can switch between. Default false.

    debugging?: { renderStatistics?: { gpu: GroupStat; viewer?: GroupStat } }

    Developer diagnostics

    Type Declaration

    • OptionalrenderStatistics?: { gpu: GroupStat; viewer?: GroupStat }

      Count the GPU commands (gpu) and the per-frame work (viewer) into these stat groups, which a stats overlay shows

    fatWireframes?: { cache?: boolean; enabled?: boolean; pregenerate?: boolean }

    Settings related to fat wireframes (currently used in selection visualization)

    Type Declaration

    • Optionalcache?: boolean

      Whether the fat wireframes should be cached, so they load faster the second time, default value is false (not used by the WebGL viewer)

    • Optionalenabled?: boolean

      Whether fat wireframes are enabled at all, default value is false. Needed by FatWireframeSelectionVisualization. Without pregenerate, the viewer keeps a CPU copy of the positions and edges of the geometry until the first selection that needs its fat wireframes

    • Optionalpregenerate?: boolean

      Whether fat wireframes should be generated immediately when loading a model, this makes showing them later on faster, but takes a little more time to load the models, default value is false

    gisRadiusMeters?: number

    GIS margin in metres outside the bounding circle of all loaded buildings. Default 500. Applies to drawing, picking and content requests; reload GIS layers after changing it.

    hideObjectOnMiddleClick?: boolean

    Whether objects should be made invisible when clicking with the middle mouse button

    integrationMode?: 1 | 2

    INTEGRATION_MODE_DEFAULT, or INTEGRATION_MODE_MAPLIBRE to render inside a MapLibre custom layer on the map's canvas (pass that canvas as the constructor's canvas). MapLibre mode is always in GEO mode, with model offsets as the map draws them; the custom layer calls Viewer3d.renderMapLibre every frame and places the frame at Viewer3d.getGeoFrameOrigin. The map cannot draw a camera below its ground, so in MapLibre mode the eye stays 1.5 m above it (the reference anchor's height, anchorZ): an orbit or a zoom in stops there, a zoom out, a pan or a keyboard move slides along it, and a fit, a flight or a camera set below it is lifted onto it

    navigationMode?: NavigationMode

    Camera navigation mode. Defaults to default. Use a predefined mode or a custom name from navigationModes.

    navigationModes?: Record<string, NavigationModeSettings>

    Custom named navigation configurations available through navigationMode and startNavigationMode.

    nearPlane?: NearPlane

    Perspective near plane in meters. Defaults to "auto".

    planLabels?: {
        dropLines?: boolean;
        enabled?: boolean;
        fontSize?: number;
        height?: "top" | "bottom";
        maxTilt?: number;
        occlusion?: boolean;
        orientation?: "HORIZONTAL" | "AUTO";
        spaces?: boolean;
    }

    Text labels in plan views (Viewer3D/docs/plan-labels-design.md): the labels of ObjectStateManager.setLabels and, with spaces, a default label (name, long name, floor area) on every space, drawn inside their objects when the text fits, horizontal on screen at any turn of the plan

    Type Declaration

    • OptionaldropLines?: boolean

      When the whole label does not fit, leave out its last lines until it does. Default false

    • Optionalenabled?: boolean

      Default true

    • OptionalfontSize?: number

      In pixels. Default 15

    • Optionalheight?: "top" | "bottom"

      The label's plane: the top of what the section planes keep of its object, or its floor. Default "top"

    • OptionalmaxTilt?: number

      Also show them in 3D mode when the view looks down within this many degrees of the vertical, lying in the object's plane. Default 70; 1 for views straight down only, 0 keeps them to 2D mode

    • Optionalocclusion?: boolean

      Hide a label where something is drawn above it (the annotations' occlusion pass). Default true

    • Optionalorientation?: "HORIZONTAL" | "AUTO"

      "HORIZONTAL": horizontal on screen at any turn of the plan. "AUTO": horizontal when it fits, otherwise along the object's long axis (corridors), never upside down; within 30° of a plan only. Default "HORIZONTAL"

    • Optionalspaces?: boolean

      A default label on every space without a label of its own. Default true

    pointClouds?: boolean

    Whether the viewer loads the ModelManager's point clouds (E57, LAS, LAZ, PLY). Default true. false leaves them out, as the minimap's plan does: they are neither loaded nor reported loaded

    preLoadTriangles?: boolean

    Whether triangle data should be pre-loaded. This speeds up the initial use of the laser measurement tools, and also temporarily circumvents a Chrome 149 introduced crash

    realtimeSettings?: {
        annotationLimit?: number;
        annotationScaleByDistance?: boolean;
        culling?: boolean;
        cullingSettlingMs?: number;
        cullingTargetFps?: number | null;
        cullingTriangleBudget?: number;
        drawWireframes?: WireframeRendering;
        dynamicCullingBudget?: boolean;
        experimentalCapStyles?: boolean;
        experimentalObjectEndcaps?: boolean;
        forceTwoSidedRendering?: boolean;
        orderIndependentTransparency?: boolean;
        persistCullingBudget?: boolean;
        pickTargetHighlight?: {
            enabled?: boolean;
            onTopAlpha?: number;
            outlineColor?: [number, number, number, number];
            outlinePx?: number;
            rampSeconds?: number;
            tint?: number;
        };
        pointCloudIdlePointBudget?: number;
        pointCloudPointBudget?: number;
        progressiveFullDetail?: boolean;
        sectionCulling?: boolean;
        sectionPlaneAnnotationMode?: SectionPlaneAnnotationMode;
        sectionPlaneAnnotationReach?: number;
        textAnnotationMode?: "label"
        | "dot";
    }

    Settings that apply to realtime rendering

    Type Declaration

    • OptionalannotationLimit?: number

      Show at most this many annotations, those nearest to the camera. Default 0: no limit.

    • OptionalannotationScaleByDistance?: boolean

      Draw annotations smaller further away: normal size up to 10 m, down to 40 % (Annotation.scaleByDistance overrides it per annotation). Default false.

    • Optionalculling?: boolean

      Whether culling should be enabled. Determines which objecs do not have to be rendered by the GPU and can make a big difference in performance on larger models. The actual culling calculations are either done on the CPU or GPU (using WebGL or WebGPU) based on the available technologies

    • OptionalcullingSettlingMs?: number

      Keep interactive detail briefly between gestures. Default 200 milliseconds; 0 disables the settling interval.

    • OptionalcullingTargetFps?: number | null

      Desired moving-camera FPS; null (default) learns the display cadence while idle.

    • OptionalcullingTriangleBudget?: number

      Initial adaptive budget when no device budget is stored, or fixed WebGPU budget when adaptation is disabled. Default 2,000,000 triangles.

    • OptionaldrawWireframes?: WireframeRendering

      When wireframes are drawn. Default "ALWAYS".

    • OptionaldynamicCullingBudget?: boolean

      Adapt the WebGPU moving-camera triangle budget to measured frame cadence. Default true.

    • OptionalexperimentalCapStyles?: boolean

      Section caps in each object's cap style (Viewer3d.setCapStyles) with cut outlines (SectionPlanes.capStyles, docs/section-cap-patterns.md). Default false: the uniform hatch. Viewer3D draws only its uniform hatch

    • OptionalexperimentalObjectEndcaps?: boolean

      Section caps in the colours of the objects they close, and picks on a cap that find its object at the point on the cut, with the plane's normal. Default false: neutral caps that picks go through. A cap belongs to the cut object whose back face is nearest behind it (the planes' straddling objects, queried as section culling does, a few frames behind a plane drag): an object nested in another cut object can show through that one's cap, and an open mesh's false caps take its colour.

    • OptionalforceTwoSidedRendering?: boolean

      Render every triangle from both sides. Default false.

    • OptionalorderIndependentTransparency?: boolean

      Weighted-blended order-independent transparency. Default true.

    • OptionalpersistCullingBudget?: boolean

      Restore/store demonstrated adaptive capacity per browser device. Default true; disable for a deterministic initial budget.

    • OptionalpickTargetHighlight?: {
          enabled?: boolean;
          onTopAlpha?: number;
          outlineColor?: [number, number, number, number];
          outlinePx?: number;
          rampSeconds?: number;
          tint?: number;
      }

      The hovered object while a tool waits for an object click (selectObject, object distance, a click handler): a stronger and faster hover tint, a translucent copy in front of everything and an outline around its silhouette.

      • Optionalenabled?: boolean

        Default true.

      • OptionalonTopAlpha?: number

        Opacity of the copy drawn in front of everything, 0 turns it off. Default 0.4.

      • OptionaloutlineColor?: [number, number, number, number]

        Outline colour, RGBA 0..1. Default [0.25, 0.85, 0.3, 1].

      • OptionaloutlinePx?: number

        Outline width in canvas pixels, 0 turns it off, at most 8. Default 2.

      • OptionalrampSeconds?: number

        Fade in/out time in seconds. Default 0.15.

      • Optionaltint?: number

        How far the object blends towards the hover colour, 0..1. Default 0.55 (an ordinary hover: 0.3).

    • OptionalpointCloudIdlePointBudget?: number

      Total point budget shared by visible tiled clouds at rest. Default 8,000,000.

    • OptionalpointCloudPointBudget?: number

      Total point budget shared by visible tiled clouds while navigating. Default 4,000,000.

    • OptionalprogressiveFullDetail?: boolean

      Experimental cancellable full-detail GPU batches. Defaults to true for touch-only input; disabled on desktops and devices with a fine pointer, including when restored settings enable it.

    • OptionalsectionCulling?: boolean

      Skip objects that section planes cut away entirely. Default false.

    • OptionalsectionPlaneAnnotationMode?: SectionPlaneAnnotationMode

      The annotation mode every new section plane or box starts with (SectionPlanes.annotationDefaults). Default "hide".

    • OptionalsectionPlaneAnnotationReach?: number

      The annotation reach in mm every new section plane or box starts with (SectionPlanes.annotationDefaults). Default: no limit.

    • OptionaltextAnnotationMode?: "label" | "dot"

      Text annotation display: full labels (default), or dots that expand while the dot or linked object is hovered.

    rendering?: { antialias?: boolean; sharedFrames?: boolean }

    Rendering settings

    Type Declaration

    • Optionalantialias?: boolean

      Whether to apply anti aliasing

    • OptionalsharedFrames?: boolean

      Viewer3D-Next only: whether the viewer shares the animation frame with the other viewers of the page's GPU. No effect here

    rightMouseClick?: (
        event: MouseEvent,
        qid: Qid | null,
        pick: PickResult | null,
    ) => void

    Function to call when the right-mouse is clicked, or more specifically when the contextmenu event is triggered on the canvas; the browser's own menu is suppressed. Not called when the button is bound to a viewer action in the active navigation mode. Use it to open your own context menu: position the menu with event.clientX / event.clientY, and keep pick for the menu's actions. See SectionPlanes.startPlaneAt for a "Section plane" entry on the right-clicked face.

    Type Declaration

      • (event: MouseEvent, qid: Qid | null, pick: PickResult | null): void
      • Parameters

        • event: MouseEvent

          The contextmenu event

        • qid: Qid | null

          The object under the pointer, null over empty space

        • pick: PickResult | null

          What is under the pointer (object, point and face normal), null when the viewer could not pick

        Returns void

    showLoader?: boolean

    Whether to show the "LOADER" div whenever a model is loading, this div can be styled by using the .viewer3d.loader CSS class

    spatialQuerying?: { implementationPreferences?: SpatialQueryingPreference[] }

    Setting for spatial querying

    Type Declaration

    • OptionalimplementationPreferences?: SpatialQueryingPreference[]

      An array of SpatialQueryingPreference. This array sets a list of preferences, the first one having the highest priority. Based on actual availability of technology an implementation is chosen by the viewer. The default for this setting is an array with only the CPU setting defined

    technologyAllowed?: {
        sharedArrayBuffer?: boolean;
        transferable?: boolean;
        webGl2?: boolean;
        webGpu?: boolean;
        webWorker?: boolean;
    }

    Type Declaration

    • OptionalsharedArrayBuffer?: boolean

      SharedArrayBuffer minimizes memory copying between threads by allowing controlled shared access. SharedArrayBuffer is only available in a secure context and in cross-origin isolated environments. See also: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer

    • Optionaltransferable?: boolean

      When SharedArrayBuffer is not available/allowed, "transferable" is a good alternative, it also avoids copying data between threads, but does so by transferring ownership. Security restrictions for transferable are less, so chances of it being available are higher.

    • OptionalwebGl2?: boolean

      The WebGL2 backend requires WebGL2 for rendering; other backends ignore it

    • OptionalwebGpu?: boolean

      WebGPU is currently not used for rendering, but can significantly speed up culling and a few other functionalities

    • OptionalwebWorker?: boolean

      Using web workers offloads work from the main thread and generally results in a much smoother viewing experience. WebWorkers are usually available, but there can be issues with build systems such as Vite/Webpack, which can often be a reason to disable web workers. The above issues can usually not be detected during runtime, therefore explicitly disabling web workers in those cases is needed.

    tileSets?: { [id: string]: { [key: string]: unknown } | "separator" }

    TileSets