Documentation - v20.0.0-dev
    Preparing search index...

    Class SceneObjectController<TObject>Abstract

    Base class owning a set of SceneObjects of one kind: it tracks them by uuid, wires them into the internal three.js scene (onSceneSetup / onSceneClear), and exposes a controller-level visible flag that hides its objects without touching their own visibility. An object is added to the scene through its controller (addObject), which it then references (SceneObject.controller).

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _objects: Map<string, TObject> = ...
    _viewer: Viewer
    isSceneObjectController: true
    signals: {
        onObjectAdded: Signal<(object: TObject) => void>;
        onObjectRemoved: Signal<(object: TObject) => void>;
        onObjectSelectedChanged: Signal<(object: TObject) => void>;
        onObjectUpdated: Signal<(object: TObject) => void>;
        onObjectVisibilityChanged: Signal<(object: TObject) => void>;
        onVisibilityChanged: Signal<() => void>;
    } = ...

    Type Declaration

    • onObjectAdded: Signal<(object: TObject) => void>
    • onObjectRemoved: Signal<(object: TObject) => void>
    • onObjectSelectedChanged: Signal<(object: TObject) => void>

      One of its objects is selected or unselected (SceneObject.selected).

    • onObjectUpdated: Signal<(object: TObject) => void>
    • onObjectVisibilityChanged: Signal<(object: TObject) => void>

      One of its objects is shown or hidden (SceneObject.visible).

    • onVisibilityChanged: Signal<() => void>

    Accessors

    • get count(): number

      Controller objects count

      Returns number

    • get firstObject(): TObject | null

      Returns TObject | null

    • get uuids(): MapIterator<string>

      Iterator over all the uuids contained in the controller.

      Returns MapIterator<string>

    • get visible(): boolean

      Returns boolean

    • set visible(value: boolean): void

      Controller visibility (independant from object own visibility).

      Hiding a controller will hide all its children without modifying their own visibility.

      Parameters

      • value: boolean

      Returns void

    Methods

    • Returns {
          onObjectAdded: Signal<(object: TObject) => void>;
          onObjectRemoved: Signal<(object: TObject) => void>;
          onObjectSelectedChanged: Signal<(object: TObject) => void>;
          onObjectUpdated: Signal<(object: TObject) => void>;
          onObjectVisibilityChanged: Signal<(object: TObject) => void>;
          onVisibilityChanged: Signal<() => void>;
      }

      • onObjectAdded: Signal<(object: TObject) => void>
      • onObjectRemoved: Signal<(object: TObject) => void>
      • onObjectSelectedChanged: Signal<(object: TObject) => void>

        One of its objects is selected or unselected (SceneObject.selected).

      • onObjectUpdated: Signal<(object: TObject) => void>
      • onObjectVisibilityChanged: Signal<(object: TObject) => void>

        One of its objects is shown or hidden (SceneObject.visible).

      • onVisibilityChanged: Signal<() => void>
    • To be implemented by controllers to set global visibility (at controller level)

      Parameters

      • value: boolean

      Returns void

    • Adds the given object to the controller. Controllers may not support object hierarchy.

      Parameters

      • object: TObject

        The object to add.

      • parentUuid: string | null

        The parent uuid of the object if the controller supports it.

      Returns void

    • Whether count objects more can be added: always, but where a limit holds (e.g. planes).

      Parameters

      • count: number

      Returns boolean

    • Clears all objects from the controller

      Returns void

    • Disposes the controller and destroy its data

      Returns void

    • Releases an object out of the scene for good (e.g. once its deletion can no longer be undone).

      Parameters

      • object: TObject

        An object of this controller, removed from it.

      Returns void

    • The hidden objects of this controller.

      Returns TObject[]

    • The uuids of the hidden objects of this controller.

      Returns string[]

    • The objects of this controller: the iterator of its map, no copy.

      Returns MapIterator<TObject>

    • The uuids of the objects of this controller: the iterator of its map, no copy.

      Returns MapIterator<string>

    • The visible objects of this controller.

      Returns TObject[]

    • The uuids of the visible objects of this controller.

      Returns string[]

    • Returns TObject | null

    • Returns the object associated with the given uuid if found

      Parameters

      • uuid: string

      Returns TObject | null

    • The objects of these uuids, in their order; the unknown uuids left out.

      Parameters

      • uuids: Iterable<string>

      Returns TObject[]

    • The transformations the viewport's gizmo may apply to one of its objects: every one by default; override it to restrict them (e.g. per object).

      Parameters

      • object: TObject

        An object of this controller.

      Returns ObjectTransformConfig

    • Returns whether the controller has the given uuid

      Parameters

      • uuid: string

      Returns boolean

    • Callback to clean the controller from the scene

      Parameters

      Returns void

    • Callback to setup the controller into the scene

      Parameters

      Returns void

    • Appends where a ray hits its objects drawn outside the engine to target, those options.filter keeps; none by default. Its engine objects (meshes, sprites, planes) are hit by ViewerRaycaster.raycast, which calls it: a controller drawing objects of its own overrides it.

      Parameters

      • ray: Ray

        World frame.

      • camera: Camera

        The camera the ray goes through, its world matrices as last drawn.

      • options: ViewerRaycastOptions

        The query's options.

      • target: SceneIntersection[]

        The hits of the query, appended to (the raycaster sorts them).

      Returns void

    • Removes the given object from the controller.

      Parameters

      Returns void