Class: EnvironmentDirector
Defined in: packages/webxr-environment/src/environment-director.ts:131
Constructors
Constructor
new EnvironmentDirector(port: EnvironmentPort, options?: EnvironmentDirectorOptions): EnvironmentDirector;
Defined in: packages/webxr-environment/src/environment-director.ts:159
Parameters
| Parameter | Type |
|---|---|
port | EnvironmentPort |
options | EnvironmentDirectorOptions |
Returns
EnvironmentDirector
Accessors
applied
Get Signature
get applied(): ResolvedEnvironment;
Defined in: packages/webxr-environment/src/environment-director.ts:222
What the port actually holds - current with passthrough applied.
Returns
blendMode
Get Signature
get blendMode():
| EnvironmentBlendMode
| null;
Defined in: packages/webxr-environment/src/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: packages/webxr-environment/src/environment-director.ts:217
What the app asked for. Mid-transition, the interpolated value.
Returns
estimatedLighting
Get Signature
get estimatedLighting(): EstimatedLighting | null;
Defined in: packages/webxr-environment/src/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: packages/webxr-environment/src/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: packages/webxr-environment/src/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: packages/webxr-environment/src/environment-director.ts:230
Returns
boolean
transitioning
Get Signature
get transitioning(): boolean;
Defined in: packages/webxr-environment/src/environment-director.ts:226
Returns
boolean
Methods
apply()
apply(specOrName: string | EnvironmentSpec): void;
Defined in: packages/webxr-environment/src/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
| Parameter | Type |
|---|---|
specOrName | string | EnvironmentSpec |
Returns
void
define()
define(name: string, spec: EnvironmentSpec): void;
Defined in: packages/webxr-environment/src/environment-director.ts:202
Register (or replace) a named preset.
Parameters
| Parameter | Type |
|---|---|
name | string |
spec | EnvironmentSpec |
Returns
void
dispose()
dispose(): void;
Defined in: packages/webxr-environment/src/environment-director.ts:408
Drop the transition, the listeners, and the port's resources.
Returns
void
finish()
finish(): void;
Defined in: packages/webxr-environment/src/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: packages/webxr-environment/src/environment-director.ts:387
The last thing an adapter said about a feature. Never undefined.
Parameters
| Parameter | Type |
|---|---|
feature | | "occlusion" | "lightEstimation" | "depthTexture" | "planes" | "meshes" | "anchors" | "hitTest" |
Returns
onChange()
onChange(listener: EnvironmentListener): () => void;
Defined in: packages/webxr-environment/src/environment-director.ts:400
Subscribe to changes. Returns the unsubscribe.
Parameters
| Parameter | Type |
|---|---|
listener | EnvironmentListener |
Returns
() => void
onSensing()
onSensing(listener: SensingListener): () => void;
Defined in: packages/webxr-environment/src/environment-director.ts:392
Subscribe to sensing reports. Returns the unsubscribe.
Parameters
| Parameter | Type |
|---|---|
listener | SensingListener |
Returns
() => void
preset()
preset(name: string): EnvironmentSpec | undefined;
Defined in: packages/webxr-environment/src/environment-director.ts:207
Look a preset up. undefined when it was never defined.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
EnvironmentSpec | undefined
presetNames()
presetNames(): readonly string[];
Defined in: packages/webxr-environment/src/environment-director.ts:212
The names currently defined, in insertion order.
Returns
readonly string[]
setLightEstimation()
setLightEstimation(estimation:
| boolean
| LightEstimationSpec
| null): void;
Defined in: packages/webxr-environment/src/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
| Parameter | Type |
|---|---|
estimation | | boolean | LightEstimationSpec | null |
Returns
void
setOcclusion()
setOcclusion(spec: OcclusionSpec | null): void;
Defined in: packages/webxr-environment/src/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
| Parameter | Type |
|---|---|
spec | OcclusionSpec | null |
Returns
void
setPassthrough()
setPassthrough(active:
| boolean
| EnvironmentBlendMode): void;
Defined in: packages/webxr-environment/src/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
| Parameter | Type |
|---|---|
active | | boolean | EnvironmentBlendMode |
Returns
void
transition()
transition(specOrName: string | EnvironmentSpec, options?: TransitionOptions): void;
Defined in: packages/webxr-environment/src/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
| Parameter | Type |
|---|---|
specOrName | string | EnvironmentSpec |
options | TransitionOptions |
Returns
void
update()
update(deltaMs: number): void;
Defined in: packages/webxr-environment/src/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
| Parameter | Type |
|---|---|
deltaMs | number |
Returns
void