Skip to main content

WebGL API

NovoRender.Scene

Scene document

Remarks

A scene represents the document entity of NovoRender, corresponding to something akin to a top level CAD assembly. It provides information for both rendering 3D geometry and querying for object metadata. In order to fascilitate complex datasets on small client devices, scenes load most data on demand and caches a relevant, but still potentially substantial subset in system and GPU memory. Weaker devices may struggle to host multiple scenes in memory at once, so make sure to remove any references to unused scenes and related objects for effective garbage collection when loading new scenes.

Properties​

boundingSphere​

• Readonly boundingSphere: BoundingSphere

The bounding sphere of the scene in world space.

Remarks

This property is useful for e.g. initial camera positioning based on approximate scene size and center.


dateCreated​

• Readonly dateCreated: Date

Date of scene creation


dateLastSaved​

• Readonly dateLastSaved: Date

Date of when scene was last saved


description​

• Optional description: string

Scene description.


dynamicObjects​

• Readonly dynamicObjects: IterableIterator<DynamicObject>

List of dynamic objects currently in scene.

Remarks

To add a new dynamic object, see createDynamicObject. To remove a dynamic object, see dispose.


id​

• id: string

Scene Id

Remarks

For new scenes, this will contain a random string/guid.


location​

• Optional location: GeoLocation

Geological location of scene.

Remarks

This location is used for calculating correct lighting/sun position for a given time and date. In future, it may also be used for google earth-like background settings and map icons etc. For static structures in particular, providing an accurate location is thus recommended.


objectHighlighter​

• Readonly objectHighlighter: ObjectHighlighter

An object that allows sets of objects to be highlighted using different color transforms.


subtrees​

• Optional Readonly subtrees: ("terrain" | "triangles" | "lines" | "points" | "documents")[]

Scene subtrees types

Remark

Available types


timezone​

• Optional timezone: number

Local timezone expressed in hours from GMT.

Remarks

Information for calculating correct lighting/sun position using local time rather than UTC.


title​

• title: string

Scene title


variants​

• Optional Readonly variants: ("deviation" | "intensity")[]

Methods​

computeSunPosition​

â–¸ computeSunPosition(time): Object

Compute sun position.

Parameters​

NameTypeDescription
timeDateDesired date and time of day in universal time (UTC).

Returns​

Object

The sun position, which can then be used in the render settings to visualize the light conditions for a given site on the given time.

NameType
azimuthnumber
inclinationnumber

Remarks

The computation will take into account seasonal changes as well as time. The timezone may be useful to provide the correct UTC time in the physical area described by the scene but is not used by this method directly.

â–¸ computeSunPosition(time): Object

Compute sun position.

Parameters​

NameTypeDescription
timeDateDesired date and time of day in universal time (UTC).

Returns​

Object

The sun position, which can then be used in the render settings to visualize the light conditions for a given site on the given time.

NameType
azimuthnumber
inclinationnumber

Remarks

The computation will take into account seasonal changes as well as time. The timezone may be useful to provide the correct UTC time in the physical area described by the scene but is not used by this method directly.


createDynamicObject​

â–¸ createDynamicObject(asset): DynamicObject

Create a new dynamic object.

Parameters​

NameTypeDescription
assetDynamicAssetThe geometry asset to use for this object.

Returns​

DynamicObject

A new dynamic object, whose state is initially invisible by default.

â–¸ createDynamicObject(asset): DynamicObject

Create a new dynamic object.

Parameters​

NameTypeDescription
assetDynamicAssetThe geometry asset to use for this object.

Returns​

DynamicObject

A new dynamic object, whose state is initially invisible by default.


descendants​

â–¸ descendants(object, signal): Promise<number[]>

Returns all descendants

Parameters​

NameType
objectHierarcicalObjectReference
signalAbortSignal

Returns​

Promise<number[]>

â–¸ descendants(object, signal): Promise<number[]>

Returns all descendants

Parameters​

NameType
objectHierarcicalObjectReference
signalAbortSignal

Returns​

Promise<number[]>


getObjectReference​

â–¸ getObjectReference(id): ObjectReference

Return a queryable object reference.

Parameters​

NameTypeDescription
idnumberObject Id

Returns​

ObjectReference

â–¸ getObjectReference(id): ObjectReference

Return a queryable object reference.

Parameters​

NameTypeDescription
idnumberObject Id

Returns​

ObjectReference


â–¸ search(filter, signal?): AsyncIterableIterator<HierarcicalObjectReference>

Search for objects.

Parameters​

NameTypeDescription
filterSearchOptionsSearchOptions filtering options.
signal?AbortSignalAbort request signal.

Returns​

AsyncIterableIterator<HierarcicalObjectReference>

Async iterator of HierarcicalObjectReference

Remarks

Scenes contains objects with associated properties. Loading scenes with millions of objects direcly into memory may be slow or even impossible on memory constrained devices. This function lets you selectively load object properties based on some criteria. An example of this is if you want to make a virtual tree view that only load child nodes on demand when the user expands a folder to make your UI scale to very large scenes.

const children = scene.search({ parentPath: "rootfolder/subfolder", descentDepth: 1});
for await (const child of children) {
// TODO: append child's properties to UI
}

â–¸ search(filter, signal?): AsyncIterableIterator<HierarcicalObjectReference>

Search for objects.

Parameters​

NameTypeDescription
filterSearchOptionsSearchOptions filtering options.
signal?AbortSignalAbort request signal.

Returns​

AsyncIterableIterator<HierarcicalObjectReference>

Async iterator of HierarcicalObjectReference

Remarks

Scenes contains objects with associated properties. Loading scenes with millions of objects direcly into memory may be slow or even impossible on memory constrained devices. This function lets you selectively load object properties based on some criteria. An example of this is if you want to make a virtual tree view that only load child nodes on demand when the user expands a folder to make your UI scale to very large scenes.

const children = scene.search({ parentPath: "rootfolder/subfolder", descentDepth: 1});
for await (const child of children) {
// TODO: append child's properties to UI
}