Options
All
  • Public
  • Public/Protected
  • All
Menu

Class View

A View represents a viewport where you can show models and overlay items. A viewer can have one or more views.

A view has a collection of models that are shown in the view. You add a model to a view with the addModel function and remove it with the removeModel function.

You can access the Camera from the View with the camera property. The camera can be used to manually control the view point, projection and other view related settings.

You can manage overlay items (legends, text boxes, navigation cube, etc) with the overlay object.

Hierarchy

  • View

Index

Accessors

Readonly ambientOcclusion

ambientOcclusion: AmbientOcclusion

The ambient occlusion configuration object for the view

Readonly background

background: Background

The background config of the view

backgroundColor

backgroundColor: Color3Like

The background color of the view.

Deprecated! Use view.background.setSingleColor()

Readonly camera

camera: Camera

The Camera used in the View.

The camera can be used to specify the View's viewpoint, orientation, direction, projection, clipping, and other viewport related properties.

Note:
This returns a reference to the real object, not a copy, so any changes to the returned object will be applied to the 3D view.

Readonly clipping

clipping: Clipping

The clipping controller for the view

haloHighlightColor

haloHighlightColor: Color3Like

The color used to draw the halo around highlighted parts in the view.

Readonly modelCount

modelCount: number

The number of models in the view.

name

name: string

The name of the view (used for debugging)

Readonly navigation

navigation: Navigation

The navigation controller for the view.

nonHighlightedDimFactor

nonHighlightedDimFactor: number

The amount to dim the areas of the screen that does not contain highlighted parts. Default value is 0.5. Setting a value of 0 disables dimming.

Readonly overlay

overlay: Overlay

The 2d overlay controller for the view.

Readonly ownerViewer

ownerViewer: Viewer

The owner Viewer.

A View can only be in one Viewer. The Viewer creates and manages the View.

Methods

addModel

  • addModel(model: Model): void
  • Adds a model to the view.

    While a model can be shown in any number of views, it can only be added to a particular view once.

    Parameters

    Returns void

getBoundingBox

  • Returns the combined bounding box of all models in the view

    Returns BoundingBox

getBoundingBoxVisibleParts

  • Returns the combined bounding box of all models in the view

    Returns BoundingBox

getIndexOfModel

  • getIndexOfModel(model: Model): number
  • Returns the zero-based index of the given model

    Parameters

    Returns number

getModelArray

  • getModelArray(): ReadonlyArray<Model>
  • Returns a read only array with all models in the view

    Returns ReadonlyArray<Model>

getModelAt

  • getModelAt(index: number): Model
  • Returns the model at the given zero-based index

    Parameters

    • index: number

    Returns Model

getRayThroughPoint

  • getRayThroughPoint(point: Vec3): Ray
  • Returns a ray that intersects the given point (in world coordinates) and starts at the point's projection onto the screen.

    Parameters

    Returns Ray

rayIntersect

  • rayIntersect(ray: Ray, ignoreLabels?: boolean): Vec3
  • Do a ray intersect with all the models in the view.

    Returns the intersection point if there was a hit, and null if there was not a hit.

    Labels have a "special treatment" ray intersect where hitting the label will cause a hit on the label attachment point. This is not always what is intended, e.g. when doing zoom to cursor. Set ignoreLabels to true to skip labels when doing ray intersect. This only applies to PartLabels in the MarkupModel

    Parameters

    • ray: Ray
    • Default value ignoreLabels: boolean = false

    Returns Vec3

removeAllModels

  • removeAllModels(): void
  • Removes all models from the view.

    Returns void

removeModel

  • removeModel(model: Model): void
  • Removes the given model from the view.

    Parameters

    Returns void

removeModelAt

  • removeModelAt(modelIndex: number): void
  • Removes the model at the given index from the view.

    The index must be zero-based and between 0 and modelCount - 1

    Parameters

    • modelIndex: number

    Returns void

requestRedraw

  • requestRedraw(): void

setViewport

  • setViewport(x: number, y: number, width: number, height: number): void
  • Sets the viewport to the given position and size in OpenGL window coordinates.

    This method cannot be called when [[OwnerViewer.viewLayoutMode]] is set to ViewLayoutMode.Auto.

    Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns void

Generated using TypeDoc