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:44


assetType

assetType: "model"

Implementation of

IScene.assetType

Defined in

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


boxHelper

Readonly boxHelper: Box3Helper

For visualizing the scene bounds. API incomplete.

Defined in

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


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:63


defaultCamera

Readonly defaultCamera: TCamera

The default camera in the scene

Implementation of

IScene.defaultCamera

Defined in

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


envMapIntensity

envMapIntensity: number = 1

The intensity for the environment light.

Implementation of

IScene.envMapIntensity

Defined in

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


fixedEnvMapDirection

fixedEnvMapDirection: boolean = false

Fixed direction environment reflections irrespective of camera position.

Defined in

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


backgroundIntensity

backgroundIntensity: number = 1

Overrides

Scene.backgroundIntensity

Defined in

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


environment

environment: null | Texture = null

Overrides

Scene.environment

Defined in

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


background

background: null | Color | Texture | "environment" = null

Overrides

Scene.background

Defined in

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


backgroundColor

backgroundColor: null | Color = null

Overrides

Scene.backgroundColor

Defined in

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

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:143

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:147


renderCamera

get renderCamera(): ICamera<ICameraOptions, any, any>

Returns

ICamera<ICameraOptions, any, any>

Implementation of

IScene.renderCamera

Defined in

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

set renderCamera(camera): void

Parameters

NameType
cameraICamera<ICameraOptions, any, any>

Returns

void

Implementation of

IScene.renderCamera

Defined in

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


modelObject

get modelObject(): Scene<Event, string>

Get the threejs scene object

Returns

Scene<Event, string>

Implementation of

IScene.modelObject

Defined in

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


minNearDistance

get minNearDistance(): number

Minimum Camera near plane

deprecated - use camera.userData.minNearPlane instead

Returns

number

Defined in

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

set minNearDistance(value): void

Minimum Camera near plane

deprecated - use camera.userData.minNearPlane instead

Parameters

NameType
valuenumber

Returns

void

Defined in

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

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:193

Methods

addModel

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

Add a processed model to the scene.

Parameters

NameType
modelIModel<Object3D<Event, string>>
optionsAddModelOptions

Returns

IModel<any>

Implementation of

IScene.addModel

Defined in

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


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:245


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 & { allImported?: any }

Returns

T

Implementation of

IScene.addSceneObject

Defined in

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


removeSceneModels

removeSceneModels(): void

Returns

void

Defined in

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


disposeSceneModels

disposeSceneModels(): void

Returns

void

Defined in

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


add

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

deprecated Use addSceneObject

Parameters

NameType
...objectObject3D<Event, string>[]

Returns

RootScene<TCamera>

Overrides

Scene.add

Defined in

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


setEnvironment

setEnvironment(asset): void

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

deprecated set the environment directly.

Parameters

NameType
assetundefined | null | ITexture<any>

Returns

void

Implementation of

IScene.setEnvironment

Defined in

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


getEnvironment

getEnvironment(): ITexture<Texture>

Get the current scene environment map

deprecated get the environment directly.

Returns

ITexture<Texture>

Implementation of

IScene.getEnvironment

Defined in

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


setBackground

setBackground(asset): void

Set the scene background. To set a color use {@see setBackgroundColor} instead.

Parameters

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

Returns

void

Implementation of

IScene.setBackground

Defined in

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


setBackgroundColor

setBackgroundColor(color): void

Sets the backgroundColor property from a string, number or Color, and updates the scene.

Parameters

NameType
colornull | string | number | Color

Returns

void

Defined in

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


getBackground

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

deprecated get the background directly.

Returns

null | ITexture<any> | Color | Vector4

Implementation of

IScene.getBackground

Defined in

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


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 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:450


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:460


dispose

dispose(): void

Dispose the scene and clear all resources.

warn Not fully implemented yet, just clears the scene.

Returns

void

Implementation of

IScene.dispose

Defined in

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


findObjectsByName

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

Find objects by name exact match in the complete hierarchy.

Parameters

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

Returns

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

Array of found objects

Implementation of

IScene.findObjectsByName

Defined in

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


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:518


getBounds

getBounds(precise?, ignoreInvisible?, ignoreWidgets?, ignoreObject?): Box3B

Returns the bounding box of the scene model root.

Parameters

NameTypeDefault value
precisebooleanfalse
ignoreInvisiblebooleantrue
ignoreWidgetsbooleantrue
ignoreObject?(obj: Object3D<Event, string>) => booleanundefined

Returns

Box3B

Implementation of

IScene.getBounds

Defined in

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


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:559


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:583


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:594


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:606


addEventListener

addEventListener<T>(type, listener): void

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:618


removeEventListener

removeEventListener<T>(type, listener): void

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:623


_addModel

Protected _addModel(model, options?): void

Parameters

NameType
modelIModel<any>
optionsAddObjectOptions & AddModelOptions

Returns

void

Defined in

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