Skip to main content

Class: EnvironmentDirector

Defined in: environment-director.ts:131

Constructors​

Constructor​

new EnvironmentDirector(port: EnvironmentPort, options?: EnvironmentDirectorOptions): EnvironmentDirector;

Defined in: environment-director.ts:159

Parameters​

ParameterType
portEnvironmentPort
optionsEnvironmentDirectorOptions

Returns​

EnvironmentDirector

Accessors​

applied​

Get Signature​

get applied(): ResolvedEnvironment;

Defined in: environment-director.ts:222

What the port actually holds - current with passthrough applied.

Returns​

ResolvedEnvironment


blendMode​

Get Signature​

get blendMode():
| EnvironmentBlendMode
| null;

Defined in: environment-director.ts:239

How the host composites, when it told us. null means nobody said - which is not the same as "opaque", and an app that dims the world differently per mode should treat it as "assume the safe one".

Returns​

| EnvironmentBlendMode | null


current​

Get Signature​

get current(): ResolvedEnvironment;

Defined in: environment-director.ts:217

What the app asked for. Mid-transition, the interpolated value.

Returns​

ResolvedEnvironment


estimatedLighting​

Get Signature​

get estimatedLighting(): EstimatedLighting | null;

Defined in: environment-director.ts:254

The last measurement an adapter reported. null when there is none.

Returns​

EstimatedLighting | null


lightEstimation​

Get Signature​

get lightEstimation():
| ResolvedLightEstimation
| null;

Defined in: environment-director.ts:249

The estimation the app asked for, every default filled in.

Returns​

| ResolvedLightEstimation | null


occlusion​

Get Signature​

get occlusion(): OcclusionSpec | null;

Defined in: environment-director.ts:244

What the app asked for. null when occlusion was never turned on.

Returns​

OcclusionSpec | null


passthrough​

Get Signature​

get passthrough(): boolean;

Defined in: environment-director.ts:230

Returns​

boolean


transitioning​

Get Signature​

get transitioning(): boolean;

Defined in: environment-director.ts:226

Returns​

boolean

Methods​

apply()​

apply(specOrName: string | EnvironmentSpec): void;

Defined in: environment-director.ts:262

Snap to a spec (or preset name). Cancels any transition in flight, so a hard cut always wins over a fade that is still running.

Parameters​

ParameterType
specOrNamestring | EnvironmentSpec

Returns​

void


define()​

define(name: string, spec: EnvironmentSpec): void;

Defined in: environment-director.ts:202

Register (or replace) a named preset.

Parameters​

ParameterType
namestring
specEnvironmentSpec

Returns​

void


dispose()​

dispose(): void;

Defined in: environment-director.ts:408

Drop the transition, the listeners, and the port's resources.

Returns​

void


finish()​

finish(): void;

Defined in: environment-director.ts:311

Jump to the end of an in-flight transition. A no-op when there is none.

Returns​

void


getSensing()​

getSensing(feature:
| "occlusion"
| "lightEstimation"
| "depthTexture"
| "planes"
| "meshes"
| "anchors"
| "hitTest"): SensingReport;

Defined in: environment-director.ts:387

The last thing an adapter said about a feature. Never undefined.

Parameters​

ParameterType
feature| "occlusion" | "lightEstimation" | "depthTexture" | "planes" | "meshes" | "anchors" | "hitTest"

Returns​

SensingReport


onChange()​

onChange(listener: EnvironmentListener): () => void;

Defined in: environment-director.ts:400

Subscribe to changes. Returns the unsubscribe.

Parameters​

ParameterType
listenerEnvironmentListener

Returns​

() => void


onSensing()​

onSensing(listener: SensingListener): () => void;

Defined in: environment-director.ts:392

Subscribe to sensing reports. Returns the unsubscribe.

Parameters​

ParameterType
listenerSensingListener

Returns​

() => void


preset()​

preset(name: string): EnvironmentSpec | undefined;

Defined in: environment-director.ts:207

Look a preset up. undefined when it was never defined.

Parameters​

ParameterType
namestring

Returns​

EnvironmentSpec | undefined


presetNames()​

presetNames(): readonly string[];

Defined in: environment-director.ts:212

The names currently defined, in insertion order.

Returns​

readonly string[]


setLightEstimation()​

setLightEstimation(estimation:
| boolean
| LightEstimationSpec
| null): void;

Defined in: environment-director.ts:367

Let the host's measurement of the real room take over the light slots.

true takes the defaults (ambient, key and ibl, no shadows), a spec picks slots, and false or null hands the slots back to whatever the app asked for. Nothing is remembered on the way out because nothing was overwritten on the way in: the estimate is a layer, not an edit.

Parameters​

ParameterType
estimation| boolean | LightEstimationSpec | null

Returns​

void


setOcclusion()​

setOcclusion(spec: OcclusionSpec | null): void;

Defined in: environment-director.ts:346

Ask for real-world depth occlusion, or null to stop.

The port hears about it only while passthrough is on, because occluding virtual content with a room nobody can see is just deleting content. The spec is REMEMBERED across passthrough changes, so an app can set it once at startup and let entering and leaving AR do the right thing.

Parameters​

ParameterType
specOcclusionSpec | null

Returns​

void


setPassthrough()​

setPassthrough(active:
| boolean
| EnvironmentBlendMode): void;

Defined in: environment-director.ts:326

Tell the director whether the real world is showing. Push this from whatever already knows - on the Reality Collective stack that is the service framework's capability service - rather than reading a session here: a session is the platform layer's to own, not the environment's.

Parameters​

ParameterType
active| boolean | EnvironmentBlendMode

Returns​

void


transition()​

transition(specOrName: string | EnvironmentSpec, options?: TransitionOptions): void;

Defined in: environment-director.ts:274

Ease to a spec (or preset name) over durationMs. A non-positive duration is an apply. Starting a transition while one is running eases from WHERE IT IS NOW, so interrupting a dusk halfway does not jump.

Parameters​

ParameterType
specOrNamestring | EnvironmentSpec
optionsTransitionOptions

Returns​

void


update()​

update(deltaMs: number): void;

Defined in: environment-director.ts:302

Advance an in-flight transition, and let a polling port do its poll.

A port that senses is ticked on EVERY call, transition or not: depth arriving is not correlated with a fade being in progress.

Parameters​

ParameterType
deltaMsnumber

Returns​

void