Skip to main content

Class: RootScene<TCamera>

Core-API.RootScene

Type parameters

NameType
TCameraextends CameraController = CameraController

Hierarchy

  • Scene

    RootScene

Implements

Properties

isRootScene

isRootScene: boolean = true

Defined in

webgi/src/core/threejs/RootScene.ts:46


assetType

assetType: "model"

Implementation of

IScene.assetType

Defined in

webgi/src/core/threejs/RootScene.ts:47


boxHelper

Readonly boxHelper: Box3Helper

For visualizing the scene bounds. API incomplete.

Defined in

webgi/src/core/threejs/RootScene.ts:55


modelRoot

Readonly modelRoot: IModel<Group> & Group

The root object where all imported objects are added.

Implementation of

IScene.modelRoot

Defined in

webgi/src/core/threejs/RootScene.ts:65


defaultCamera

Readonly defaultCamera: TCamera

The default camera in the scene

Implementation of

IScene.defaultCamera

Defined in

webgi/src/core/threejs/RootScene.ts:71


envMapIntensity

envMapIntensity: number = 1

The intensity for the environment light.

Implementation of

IScene.envMapIntensity

Defined in

webgi/src/core/threejs/RootScene.ts:77


environment

environment: null | Texture = null

deprecated Use setEnvironment

Overrides

Scene.environment

Defined in

webgi/src/core/threejs/RootScene.ts:295


background

background: null | Color | Texture = null

deprecated Use setBackground

Overrides

Scene.background

Defined in

webgi/src/core/threejs/RootScene.ts:306


minNearDistance

minNearDistance: number = 0.2

Minimum Camera near plane

Defined in

webgi/src/core/threejs/RootScene.ts:516

Methods

refreshEnvMapIntensity

refreshEnvMapIntensity(root?): RootScene<TCamera>

Updates the intensity of all objects in the scene. This is automatically called when envMapIntensity is changed.

Parameters

NameTypeDescription
root?Object3D<Event>Optional root object to traverse.

Returns

RootScene<TCamera>

Defined in

webgi/src/core/threejs/RootScene.ts:84


addModel

addModel(model, options?): IModel<any>

Add a processed model to the scene.

Parameters

NameType
modelIModel<Object3D<Event>>
optionsAddModelOptions

Returns

IModel<any>

Implementation of

IScene.addModel

Defined in

webgi/src/core/threejs/RootScene.ts:192


addWidget

addWidget(model, options?): void

Add a widget (non-physical/interactive) object to the scene. like gizmos, ui components etc.

Parameters

NameType
modelIWidget<any>
optionsAnyOptions

Returns

void

Implementation of

IScene.addWidget

Defined in

webgi/src/core/threejs/RootScene.ts:204


addSceneObject

addSceneObject<T>(imported, options?): T

Add any processed scene object to the scene.

Type parameters

NameType
Textends ISceneObject<any> = ISceneObject<any>

Parameters

NameType
importedT
options?AddObjectOptions & AddModelOptions

Returns

T

Implementation of

IScene.addSceneObject

Defined in

webgi/src/core/threejs/RootScene.ts:223


removeSceneModels

removeSceneModels(): void

Returns

void

Defined in

webgi/src/core/threejs/RootScene.ts:282


disposeSceneModels

disposeSceneModels(): void

Returns

void

Defined in

webgi/src/core/threejs/RootScene.ts:287


add

add(...object): RootScene<TCamera>

deprecated Use addSceneObject

Parameters

NameType
...objectObject3D<Event>[]

Returns

RootScene<TCamera>

Overrides

Scene.add

Defined in

webgi/src/core/threejs/RootScene.ts:311


setEnvironment

setEnvironment(asset): void

Set the scene environment map, this will be processed with PMREM automatically later.

Parameters

NameType
assetundefined | null | ITexture<any>

Returns

void

Implementation of

IScene.setEnvironment

Defined in

webgi/src/core/threejs/RootScene.ts:322


getEnvironment

getEnvironment(): ITexture<Texture>

Get the current scene environment map

Returns

ITexture<Texture>

Implementation of

IScene.getEnvironment

Defined in

webgi/src/core/threejs/RootScene.ts:351


setBackground

setBackground(asset): void

warn Use {@see ViewerApp.setBackground}

Parameters

NameType
assetnull | string | number | ITexture<any> | Vector4 | Color

Returns

void

Implementation of

IScene.setBackground

Defined in

webgi/src/core/threejs/RootScene.ts:358


getBackground

getBackground(): null | ITexture<any> | Vector4 | Color

warn Use {@see ViewerApp.getBackground}

Returns

null | ITexture<any> | Vector4 | Color

Implementation of

IScene.getBackground

Defined in

webgi/src/core/threejs/RootScene.ts:383


setDirty

setDirty(options?): RootScene<TCamera>

Mark the scene dirty, and force render in the next frame.

Parameters

NameTypeDescription
options?{ sceneUpdate?: boolean } & AnyOptionsset sceneUpdate to true to to mark that any object transformations have changed. It might trigger effects like frame fade depening on plugins.

Returns

RootScene<TCamera>

Implementation of

IScene.setDirty

Defined in

webgi/src/core/threejs/RootScene.ts:396


updateScene

updateScene(options?): RootScene<TCamera>

Equivalent to setDirty({sceneUpdate: true}), dispatches 'sceneUpdate' event with the specified options.

Parameters

NameType
options?AnyOptions

Returns

RootScene<TCamera>

Defined in

webgi/src/core/threejs/RootScene.ts:406


dispose

dispose(): void

Dispose the scene and clear all resources.

warn Not implemented yet.

Returns

void

Implementation of

IScene.dispose

Defined in

webgi/src/core/threejs/RootScene.ts:435


findObjectsByName

findObjectsByName(name, parent?): Object3D<Event> & IModel<Object3D<Event>>[][]

Find objects by name exact match in the complete hierarchy.

Parameters

NameTypeDescription
namestringname
parent?Object3D<Event>optional root node to start search from

Returns

Object3D<Event> & IModel<Object3D<Event>>[][]

Array of found objects

Implementation of

IScene.findObjectsByName

Defined in

webgi/src/core/threejs/RootScene.ts:448


addLight

addLight(light, options?): void

Add a processed light to the scene.

Parameters

NameType
lightILight<any>
optionsAddObjectOptions

Returns

void

Implementation of

IScene.addLight

Defined in

webgi/src/core/threejs/RootScene.ts:461


getBounds

getBounds(precise?, ignoreInvisible?): Box3B

Returns the bounding box of the scene model root.

Parameters

NameTypeDefault value
precisebooleanfalse
ignoreInvisiblebooleantrue

Returns

Box3B

Implementation of

IScene.getBounds

Defined in

webgi/src/core/threejs/RootScene.ts:487


refreshActiveCameraNearFar

refreshActiveCameraNearFar(): void

Refreshes the scene active camera near far values, based on the scene bounding box. This is called automatically every time the camera is updated.

Returns

void

Defined in

webgi/src/core/threejs/RootScene.ts:497


updateShaderProperties

updateShaderProperties(material): RootScene<TCamera>

Parameters

NameType
materialObject
material.definesRecord<string, undefined | string | number>
material.uniformsObject

Returns

RootScene<TCamera>

Implementation of

IScene.updateShaderProperties

Defined in

webgi/src/core/threejs/RootScene.ts:518


toJSON

toJSON(meta?): any

Serialize the scene properties

Parameters

NameType
meta?any

Returns

any

Overrides

Scene.toJSON

Defined in

webgi/src/core/threejs/RootScene.ts:529


fromJSON

fromJSON(json, meta?): RootScene<TCamera>

Deserialize the scene properties

Parameters

NameTypeDescription
jsonanyobject from toJSON
meta?any

Returns

RootScene<TCamera>

Defined in

webgi/src/core/threejs/RootScene.ts:541


addEventListener

addEventListener<T>(type, listener): void

Adds a listener to an event type.

Type parameters

NameType
Textends TSceneEvents

Parameters

NameType
typeT
listener(e: IEvent<T>) => void

Returns

void

Implementation of

IScene.addEventListener

Overrides

Scene.addEventListener

Defined in

webgi/src/core/threejs/RootScene.ts:553


removeEventListener

removeEventListener<T>(type, listener): void

Removes a listener from an event type.

Type parameters

NameType
Textends TSceneEvents

Parameters

NameType
typeT
listener(e: IEvent<T>) => void

Returns

void

Implementation of

IScene.removeEventListener

Overrides

Scene.removeEventListener

Defined in

webgi/src/core/threejs/RootScene.ts:558


_addModel

Protected _addModel(model, options?): void

Parameters

NameType
modelIModel<any>
optionsAddObjectOptions & AddModelOptions

Returns

void

Defined in

webgi/src/core/threejs/RootScene.ts:213

Accessors

activeCamera

get activeCamera(): TCamera

The current active camera in the scene.

Returns

TCamera

Implementation of

IScene.activeCamera

Defined in

webgi/src/core/threejs/RootScene.ts:113

set activeCamera(camera): void

The current active camera in the scene.

Parameters

NameType
cameraundefined | TCamera

Returns

void

Implementation of

IScene.activeCamera

Defined in

webgi/src/core/threejs/RootScene.ts:117


modelObject

get modelObject(): Scene

Get the threejs scene object

Returns

Scene

Implementation of

IScene.modelObject

Defined in

webgi/src/core/threejs/RootScene.ts:145

Constructors

constructor

new RootScene<TCamera>(camera)

Create a scene instance. This is done automatically in the ViewerApp and must not be created separately.

Type parameters

NameType
TCameraextends CameraController<TCamera> = CameraController

Parameters

NameType
cameraTCamera

Overrides

Scene.constructor

Defined in

webgi/src/core/threejs/RootScene.ts:153