An independent view within a Viewer, with its own canvas, Camera and object visual states.

See @xeokit/sdk/viewing/viewer for usage.

Properties

boundary: number[]

Boundary of the canvas in absolute browser window coordinates. Format is [xmin, ymin, xwidth, ywidth].

camera: Camera

Manages the Camera for this View.

colorizedObjects: { [key: string]: ViewObject }

Map of currently colorized ViewObjects in this View.

Each ViewObject is mapped here by ViewObject.id.

destroyed: boolean = false

True if this View has been destroyed.

effects: Effects

Aggregates the renderer-effect components for this View — SAO, Edges, Bloom, Tonemap, AntiAliasing, and Shadows. Reach the individual effects through Effects.sao, Effects.edges, Effects.bloom, Effects.tonemap, Effects.antiAliasing, and Effects.shadows.

gammaOutput: boolean
highlightedObjects: { [key: string]: ViewObject }

Map of currently highlighted ViewObjects in this View.

A ViewObject is highlighted when ViewObject.highlighted is true.

Each ViewObject is mapped here by ViewObject.id.

highlightMaterial: Effect

Configures the highlighted appearance of ViewObjects in this View.

htmlElement: HTMLElement

The HTML canvas.

id: string

ID of this View, unique within the Viewer.

layers: { [key: string]: ViewLayer }

Map of the all ViewLayers in this View.

Each ViewLayer is mapped here by ViewLayer.id.

lights: Lights

Aggregates the environment-illumination components for this View — cubemap IBL at Lights.ibl, plus the analytical hemispheric ambient at Lights.hemispheric.

lightsList: (AmbientLight | PointLight | DirLight)[] = []

List of legacy light sources in this View, in registration order.

lightSources: { [key: string]: AmbientLight | PointLight | DirLight }

Id-keyed registry of legacy AmbientLight / PointLight / DirLight instances attached to this View. Populated by the light constructors via View.registerLight.

linesMaterial: LinesMaterial

Configures the appearance of lines belonging to ViewObjects in this View.

objects: { [key: string]: ViewObject }

Map of the all ViewObjects in this View.

Each ViewObject is mapped here by ViewObject.id.

The View automatically ensures that there is a ViewObject here for each ViewObject in the Viewer

opacityObjects: { [key: string]: ViewObject }

Map of ViewObjects in this View whose opacity has been updated.

Each ViewObject is mapped here by ViewObject.id.

pointsMaterial: PointsMaterial

Configures the appearance of point primitives belonging to ViewObjects in this View .

resolutionScale: ResolutionScale

Configures resolution scaling for this View.

sectionPlanes: { [key: string]: SectionPlane }

Map of SectionPlanes in this View.

Each SectionPlane is mapped here by SectionPlane.id.

sectionPlanesList: SectionPlane[] = []

List of SectionPlanes in this View.

selectedMaterial: Effect

Configures the appearance of ViewObjects in this View.

selectedObjects: { [key: string]: ViewObject }

Map of currently selected ViewObjects in this View.

A ViewObject is selected when ViewObject.selected is true.

Each ViewObject is mapped here by ViewObject.id.

texturing: Texturing

Configures when textures are rendered for this View.

transforms: { [key: string]: ViewTransform }

Set of ViewTransforms in this View.

transparent: boolean

Indicates if this View is transparent.

viewer: Viewer

The Viewer to which this View belongs.

viewIndex: number

The tileIndex of this View in Viewer.viewList.

visibleObjects: { [key: string]: ViewObject }

Map of the currently visible ViewObjects in this View.

A ViewObject is visible when ViewObject.visible is true.

Each ViewObject is mapped here by ViewObject.id.

xrayedObjects: { [key: string]: ViewObject }

Map of currently x-rayed ViewObjects in this View.

A ViewObject is x-rayed when ViewObject.xrayed is true.

Each ViewObject is mapped here by ViewObject.id.

xrayMaterial: Effect

Configures the X-rayed appearance of ViewObjects in this View.

Accessors

  • get autoLayers(): boolean

    Gets whether this View will automatically create ViewLayers on-demand as ViewerObjects are created.

    Returns boolean

  • set autoLayers(autoLayers: boolean): void

    Sets whether this View will automatically create ViewLayers on-demand as ViewerObjects are created.

    When true (default), the View will automatically create ViewLayers as needed for each new ViewObject.layerId encountered, including a "default" ViewLayer for ViewerObjects that have no layerId. This "default" ViewLayer ensures that a ViewObject is created in the View for every SceneObject that is created.

    If you set this false, however, then the View will only create ViewObjects for SceneObjects that have a layerId that matches the ID of a ViewLayer that you have explicitly created previously with View.createLayer.

    Setting this parameter false enables Views to contain only the ViewObjects that they actually need to show, i.e. to represent only ViewerObjects that they need to view. This enables a View to avoid wastefully creating and maintaining ViewObjects for ViewerObjects that it never needs to show.

    Default value is `true``.

    Parameters

    • autoLayers: boolean

      The new value for atuoLayers

    Returns void

Methods

  • Creates a ViewLayer in this View.

    The ViewLayer is then registered in View.layers.

    Fires ViewerEvents.onViewLayerCreated event.

    Since the ViewLayer is created explicitly by this method, the ViewLayer will persist until ViewLayer.destroy is called, or the View itself is destroyed. If a ViewLayer with the given ID already exists, the method returns that existing ViewLayer. The method also ensures that the existing ViewLayer likewise persists.

    Usage

    const layerResult = view.createLayer({
    id: "myLayer",
    autoDestroy: true,
    });

    if (!layerResult.ok) {
    console.error(layerResult.error);
    } else {
    const viewLayer = layerResult.value;
    console.log("ViewLayer created:", viewLayer.id);
    }

    Parameters

    Returns SDKResult<ViewLayer>

    A result containing the created ViewLayer on success, or an error message on failure.

  • Colorizes the given ViewObjects in this View.

    Passing null or undefined for colorize clears the colorize flag on each affected ViewObject — the underlying SceneMesh material's colour shows through unchanged. This is the call to make when transitioning an object back to its native appearance (e.g. a 4D scheduler returning a finished task's objects to their IFC tint). Passing a Vec3 such as [1, 1, 1] instead enables the colorize path with a white tint, replacing the material colour — not equivalent to clearing it.

    Parameters

    • objectIds: string[]

      One or more ViewObject.id values.

    • colorize: Vec3

      RGB colorize factors in [0..1, 0..1, 0..1], or null / undefined to clear the colorize flag and reveal the underlying material.

    Returns boolean

    True if any ViewObjects changed colorize state, else false if all updates were redundant and not applied.

  • Sets the opacity of the given ViewObjects in this View.

    Passing null or undefined for opacity clears the OPACITY_UPDATED flag on each affected ViewObject — the underlying SceneMesh material's alpha shows through unchanged. Make this call when transitioning an object back to its native appearance (e.g. a 4D scheduler returning a finished task's objects to their IFC materials); passing a number such as 1 instead enables the opacity override with that exact value and replaces the material alpha — equivalent to "force fully opaque", which incorrectly routes naturally-transparent glass / curtain-wall meshes through the opaque render bin.

    Parameters

    • objectIds: string[]

      One or more ViewObject.id values.

    • opacity: number

      Opacity factor in [0..1], or null / undefined to clear the opacity override and let the material alpha through.

    Returns boolean

    True if any ViewObjects changed opacity state, else false if all updates were redundant and not applied.

  • Sets the pickability of the given ViewObjects in this View.

    • Updates ViewObject.pickable on the Objects with the given IDs.
    • Enables or disables the ability to pick the given Objects with viewing!viewer.View.pick | View.pick.

    Parameters

    • objectIds: string[]

      Array of ViewObject.id values.

    • pickable: boolean

      Whether or not to set pickable.

    Returns boolean

    True if any ViewObjects were updated, else false if all updates were redundant and not applied.