Class: RootScene<TCamera>
Core-API.RootScene
Type parameters
Name | Type |
---|---|
TCamera | extends CameraController = CameraController |
Hierarchy
Scene
↳
RootScene
Implements
IScene
<Scene
,TCamera
>
Properties
isRootScene
• isRootScene: boolean
= true
Defined in
webgi/src/core/threejs/RootScene.ts:44
assetType
• assetType: "model"
Implementation of
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:54
modelRoot
• Readonly
modelRoot: IModel
<Group
> & Group
The root object where all imported objects are added.
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:64
defaultCamera
• Readonly
defaultCamera: TCamera
The default camera in the scene
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:70
envMapIntensity
• envMapIntensity: number
= 1
The intensity for the environment light.
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:76
fixedEnvMapDirection
• fixedEnvMapDirection: boolean
= false
Fixed direction environment reflections irrespective of camera position.
Defined in
webgi/src/core/threejs/RootScene.ts:81
backgroundIntensity
• backgroundIntensity: number
= 1
Overrides
Scene.backgroundIntensity
Defined in
webgi/src/core/threejs/RootScene.ts:84
environment
• environment: null
| Texture
= null
Overrides
Scene.environment
Defined in
webgi/src/core/threejs/RootScene.ts:339
textureSlots
• textureSlots: Record
<string
, Texture
> = {}
Extra textures/envmaps that can be used by objects/materials/plugins and will be serialized.
These can be set per material in material.userData.envMapSlotKey
Defined in
webgi/src/core/threejs/RootScene.ts:346
background
• background: null
| Color
| Texture
| "environment"
= null
Overrides
Scene.background
Defined in
webgi/src/core/threejs/RootScene.ts:373
backgroundColor
• backgroundColor: null
| Color
= null
Overrides
Scene.backgroundColor
Defined in
webgi/src/core/threejs/RootScene.ts:376
Accessors
activeCamera
• get
activeCamera(): TCamera
The current active camera in the scene.
Returns
TCamera
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:144
• set
activeCamera(camera
): void
The current active camera in the scene.
Parameters
Name | Type |
---|---|
camera | undefined | TCamera |
Returns
void
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:148
renderCamera
• get
renderCamera(): ICamera
<ICameraOptions
, any
, any
>
Returns
ICamera
<ICameraOptions
, any
, any
>
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:174
• set
renderCamera(camera
): void
Parameters
Name | Type |
---|---|
camera | ICamera <ICameraOptions , any , any > |
Returns
void
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:177
modelObject
• get
modelObject(): Scene
<Event
, string
>
Get the threejs scene object
Returns
Scene
<Event
, string
>
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:187
minNearDistance
• get
minNearDistance(): number
Minimum Camera near plane
deprecated
- use camera.userData.minNearPlane instead
Returns
number
Defined in
webgi/src/core/threejs/RootScene.ts:695
• set
minNearDistance(value
): void
Minimum Camera near plane
deprecated
- use camera.userData.minNearPlane instead
Parameters
Name | Type |
---|---|
value | number |
Returns
void
Defined in
webgi/src/core/threejs/RootScene.ts:703
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
Name | Type |
---|---|
TCamera | extends CameraController <TCamera > = CameraController |
Parameters
Name | Type |
---|---|
camera | TCamera |
Overrides
Scene.constructor
Defined in
webgi/src/core/threejs/RootScene.ts:195
Methods
addModel
▸ addModel(model
, options?
): IModel
<any
>
Add a processed model to the scene.
Parameters
Name | Type |
---|---|
model | IModel <Object3D <Event , string >> |
options | AddModelOptions |
Returns
IModel
<any
>
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:236
addWidget
▸ addWidget(model
, options?
): void
Add a widget (non-physical/interactive) object to the scene. like gizmos, ui components etc.
Parameters
Name | Type |
---|---|
model | IWidget <any > |
options | AnyOptions |
Returns
void
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:248
addSceneObject
▸ addSceneObject<T
>(imported
, options?
): T
Add any processed scene object to the scene.
Type parameters
Name | Type |
---|---|
T | extends ISceneObject <any > = ISceneObject <any > |
Parameters
Name | Type |
---|---|
imported | T |
options? | AddObjectOptions & AddModelOptions & { allImported? : any } |
Returns
T
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:267
removeSceneModels
▸ removeSceneModels(): void
Returns
void
Defined in
webgi/src/core/threejs/RootScene.ts:326
disposeSceneModels
▸ disposeSceneModels(): void
Returns
void
Defined in
webgi/src/core/threejs/RootScene.ts:331
add
▸ add(...object
): RootScene
<TCamera
>
deprecated
Use addSceneObject
Parameters
Name | Type |
---|---|
...object | Object3D <Event , string >[] |
Returns
RootScene
<TCamera
>
Overrides
Scene.add
Defined in
webgi/src/core/threejs/RootScene.ts:381
setEnvironment
▸ setEnvironment(asset
): void
Set the scene environment map, this will be processed with PMREM automatically later.
deprecated
set the environment directly.
Parameters
Name | Type |
---|---|
asset | undefined | null | ITexture <any > |
Returns
void
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:393
getEnvironment
▸ getEnvironment(): ITexture
<Texture
>
Get the current scene environment map
deprecated
get the environment directly.
Returns
ITexture
<Texture
>
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:419
setBackground
▸ setBackground(asset
): void
Set the scene background. To set a color use {@see setBackgroundColor} instead.
Parameters
Name | Type |
---|---|
asset | null | string | number | ITexture <any > | Color |
Returns
void
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:426
setBackgroundColor
▸ setBackgroundColor(color
): void
Sets the backgroundColor property from a string, number or Color, and updates the scene.
Parameters
Name | Type |
---|---|
color | null | string | number | Color |
Returns
void
Defined in
webgi/src/core/threejs/RootScene.ts:448
getBackground
▸ getBackground(): null
| ITexture
<any
> | Color
| Vector4
deprecated
get the background directly.
Returns
null
| ITexture
<any
> | Color
| Vector4
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:455
setDirty
▸ setDirty(options?
): RootScene
<TCamera
>
Mark the scene dirty, and force render in the next frame.
Parameters
Name | Type | Description |
---|---|---|
options? | { sceneUpdate? : boolean } & AnyOptions | set 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
Defined in
webgi/src/core/threejs/RootScene.ts:468
updateScene
▸ updateScene(options?
): RootScene
<TCamera
>
Equivalent to setDirty({sceneUpdate: true}), dispatches 'sceneUpdate' event with the specified options.
Parameters
Name | Type |
---|---|
options? | AnyOptions |
Returns
RootScene
<TCamera
>
Defined in
webgi/src/core/threejs/RootScene.ts:478
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:536
findObjectsByName
▸ findObjectsByName(name
, parent?
): Object3D
<Event
, string
> & IModel
<Object3D
<Event
, string
>>[]
Find objects by name exact match in the complete hierarchy.
Parameters
Name | Type | Description |
---|---|---|
name | string | name |
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
Defined in
webgi/src/core/threejs/RootScene.ts:550
addLight
▸ addLight(light
, options?
): void
Add a processed light to the scene.
Parameters
Name | Type |
---|---|
light | ILight <any > |
options | AddObjectOptions |
Returns
void
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:563
getBounds
▸ getBounds(precise?
, ignoreInvisible?
, ignoreWidgets?
, ignoreObject?
): Box3B
Returns the bounding box of the scene. this includes the ground
Parameters
Name | Type | Default value |
---|---|---|
precise | boolean | false |
ignoreInvisible | boolean | true |
ignoreWidgets | boolean | true |
ignoreObject? | (obj : Object3D <Event , string >) => boolean | undefined |
Returns
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:591
getModelBounds
▸ getModelBounds(precise?
, ignoreInvisible?
, ignoreWidgets?
, ignoreObject?
): Box3B
Returns the bounding box of the scene model root.
Parameters
Name | Type | Default value |
---|---|---|
precise | boolean | false |
ignoreInvisible | boolean | true |
ignoreWidgets | boolean | true |
ignoreObject? | (obj : Object3D <Event , string >) => boolean | undefined |
Returns
Defined in
webgi/src/core/threejs/RootScene.ts:608
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:623
updateShaderProperties
▸ updateShaderProperties(material
): RootScene
<TCamera
>
Parameters
Name | Type |
---|---|
material | Object |
material.defines | Record <string , undefined | string | number > |
material.uniforms | Object |
Returns
RootScene
<TCamera
>
Implementation of
Defined in
webgi/src/core/threejs/RootScene.ts:647
toJSON
▸ toJSON(meta?
): any
Serialize the scene properties
Parameters
Name | Type |
---|---|
meta? | any |
Returns
any
Overrides
Scene.toJSON
Defined in
webgi/src/core/threejs/RootScene.ts:658
fromJSON
▸ fromJSON(json
, meta?
): RootScene
<TCamera
>
Deserialize the scene properties
Parameters
Name | Type | Description |
---|---|---|
json | any | object from toJSON |
meta? | any |
Returns
RootScene
<TCamera
>
Defined in
webgi/src/core/threejs/RootScene.ts:670
addEventListener
▸ addEventListener<T
>(type
, listener
): void
Type parameters
Name | Type |
---|---|
T | extends TSceneEvents |
Parameters
Name | Type |
---|---|
type | T |
listener | (e : IEvent <T >) => void |
Returns
void
Implementation of
IScene.addEventListener
Overrides
Scene.addEventListener
Defined in
webgi/src/core/threejs/RootScene.ts:682
removeEventListener
▸ removeEventListener<T
>(type
, listener
): void
Type parameters
Name | Type |
---|---|
T | extends TSceneEvents |
Parameters
Name | Type |
---|---|
type | T |
listener | (e : IEvent <T >) => void |
Returns
void
Implementation of
IScene.removeEventListener
Overrides
Scene.removeEventListener
Defined in
webgi/src/core/threejs/RootScene.ts:687
_addModel
▸ Protected
_addModel(model
, options?
): void
Parameters
Name | Type |
---|---|
model | IModel <any > |
options | AddObjectOptions & AddModelOptions |
Returns
void