Interface: EnvironmentPort
Defined in: packages/webxr-environment/src/ports.ts:31
Applies an environment to a scene.
Every method takes the whole slot, or null to remove it. The director
calls a method ONLY when that slot's value actually changed, so an adapter
may treat each call as "this is new, act on it" and does not need to diff.
That matters on IWSDK, where applying a change means setting _needsUpdate
and re-running a system.
Methods
applyAmbient()
applyAmbient(light: AmbientLightSpec | null): void;
Defined in: packages/webxr-environment/src/ports.ts:34
Parameters
| Parameter | Type |
|---|---|
light | AmbientLightSpec | null |
Returns
void
applyFog()
applyFog(fog: FogSpec | null): void;
Defined in: packages/webxr-environment/src/ports.ts:33
Parameters
| Parameter | Type |
|---|---|
fog | FogSpec | null |
Returns
void
applyIbl()
applyIbl(ibl: IblSpec | null): void;
Defined in: packages/webxr-environment/src/ports.ts:41
The environment map. Required like the other four, because a slot the director flushes and a port may quietly not have is a slot that goes missing on one engine and nowhere else.
Parameters
| Parameter | Type |
|---|---|
ibl | IblSpec | null |
Returns
void
applyKeyLight()
applyKeyLight(light: KeyLightSpec | null): void;
Defined in: packages/webxr-environment/src/ports.ts:35
Parameters
| Parameter | Type |
|---|---|
light | KeyLightSpec | null |
Returns
void
applyLightEstimation()?
optional applyLightEstimation(estimation: ResolvedLightEstimation | null): void;
Defined in: packages/webxr-environment/src/ports.ts:62
Start or stop light estimation, with every default already resolved.
A port that implements this reports what happens through observe:
pending once the runtime accepted the request, active with each
estimate, unavailable when the session did not grant it. A port that
does not implement it should report unsupported from observe, so the
absence is visible instead of silent.
Parameters
| Parameter | Type |
|---|---|
estimation | ResolvedLightEstimation | null |
Returns
void
applyOcclusion()?
optional applyOcclusion(spec: OcclusionSpec | null): void;
Defined in: packages/webxr-environment/src/ports.ts:51
Turn real-world depth occlusion on, or off with null.
OPTIONAL, because a host without depth is a host that has nothing to implement here - and because the director only calls it while passthrough is on, a port that never sees it is not necessarily a port on a device without depth. Report through observe rather than throwing.
Parameters
| Parameter | Type |
|---|---|
spec | OcclusionSpec | null |
Returns
void
applySky()
applySky(sky: SkySpec | null): void;
Defined in: packages/webxr-environment/src/ports.ts:32
Parameters
| Parameter | Type |
|---|---|
sky | SkySpec | null |
Returns
void
dispose()?
optional dispose(): void;
Defined in: packages/webxr-environment/src/ports.ts:86
Release anything the port created. Optional.
Returns
void
observe()?
optional observe(host: EnvironmentPortHost): void | (() => void);
Defined in: packages/webxr-environment/src/ports.ts:71
Hand the port the object it talks back through.
Called once, at construction, before anything is applied. The returned
function is called on dispose. This is the ONLY inbound path: see
sensing.ts for why there is one and why it carries what it does.
Parameters
| Parameter | Type |
|---|---|
host | EnvironmentPortHost |
Returns
void | (() => void)
update()?
optional update(deltaMs: number): void;
Defined in: packages/webxr-environment/src/ports.ts:83
Called from EnvironmentDirector.update, before any transition advances.
Only a port that has to POLL its host needs this, and both of the ones
that do are sensor-backed: three.js reports depth sensing through a
renderer flag that flips some frames after the session starts, and a light
estimate has to be read out of the current XRFrame or not at all.
Neither host pushes those, so without a tick they would need a loop of
their own - which is the thing this package refuses to own.
Parameters
| Parameter | Type |
|---|---|
deltaMs | number |
Returns
void