Skip to main content

Class: XRBlocksEnvironmentPort

Defined in: xrblocks-environment/src/environment-port.ts:75

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.

Extends

Constructors

Constructor

new XRBlocksEnvironmentPort(
scene: Scene,
context: XRBlocksEnvironmentContext,
options?: ThreeEnvironmentPortOptions
): XRBlocksEnvironmentPort;

Defined in: xrblocks-environment/src/environment-port.ts:83

Parameters

ParameterType
sceneScene
contextXRBlocksEnvironmentContext
optionsThreeEnvironmentPortOptions

Returns

XRBlocksEnvironmentPort

Overrides

ThreeEnvironmentPort.constructor

Accessors

root

Get Signature

get root(): Group;

Defined in: threejs-environment/src/environment-port.ts:167

The group holding everything this port created. Read-only in practice.

Returns

Group

Inherited from

ThreeEnvironmentPort.root

Methods

applyAmbient()

applyAmbient(light: AmbientLightSpec | null): void;

Defined in: threejs-environment/src/environment-port.ts:248

Parameters

ParameterType
lightAmbientLightSpec | null

Returns

void

Inherited from

ThreeEnvironmentPort.applyAmbient


applyFog()

applyFog(fog: FogSpec | null): void;

Defined in: threejs-environment/src/environment-port.ts:224

Parameters

ParameterType
fogFogSpec | null

Returns

void

Inherited from

ThreeEnvironmentPort.applyFog


applyIbl()

applyIbl(ibl: IblSpec | null): void;

Defined in: threejs-environment/src/environment-port.ts:308

The environment map: what shiny things reflect, and what lights everything the key light does not.

Three kinds, three routes. A gradient is the same generated equirect the sky uses, regenerated in place across a transition. An image is loaded once and swapped in when it lands. A room is three.js's own RoomEnvironment, which has to be prefiltered by a renderer this port does not have - so it is used when the app supplied a prefilter, and approximated with a neutral ramp when it did not.

Parameters

ParameterType
iblIblSpec | null

Returns

void

Inherited from

ThreeEnvironmentPort.applyIbl


applyKeyLight()

applyKeyLight(light: KeyLightSpec | null): void;

Defined in: threejs-environment/src/environment-port.ts:266

Parameters

ParameterType
lightKeyLightSpec | null

Returns

void

Inherited from

ThreeEnvironmentPort.applyKeyLight


applyLightEstimation()

applyLightEstimation(estimation:
| ResolvedLightEstimation
| null): void;

Defined in: xrblocks-environment/src/environment-port.ts:177

Light estimation, read out of the XR Blocks lighting manager.

XR Blocks does the WebXR half itself - it owns the XREstimatedLight and updates its own directional light and probe every frame. This port reads that and turns it into specs, so the estimate lands in the same document everything else in this package goes through.

Parameters

ParameterType
estimation| ResolvedLightEstimation | null

Returns

void

Overrides

ThreeEnvironmentPort.applyLightEstimation


applyOcclusion()

applyOcclusion(spec: OcclusionSpec | null): void;

Defined in: xrblocks-environment/src/environment-port.ts:109

Occlusion, through the XR Blocks depth manager.

XR Blocks builds its occlusion pass during init, so this can start and stop depth and choose how the depth texture is blurred, and it cannot conjure an occlusion pass that was never built. When it was not, the report says exactly which option to set.

Parameters

ParameterType
specOcclusionSpec | null

Returns

void

Overrides

ThreeEnvironmentPort.applyOcclusion


applySky()

applySky(sky: SkySpec | null): void;

Defined in: threejs-environment/src/environment-port.ts:171

Parameters

ParameterType
skySkySpec | null

Returns

void

Inherited from

ThreeEnvironmentPort.applySky


dispose()

dispose(): void;

Defined in: xrblocks-environment/src/environment-port.ts:219

Release anything the port created. Optional.

Returns

void

Overrides

ThreeEnvironmentPort.dispose


getSensingState()

getSensingState(feature: string): string | undefined;

Defined in: xrblocks-environment/src/environment-port.ts:281

Parameters

ParameterType
featurestring

Returns

string | undefined


observe()

observe(host: EnvironmentPortHost): () => void;

Defined in: xrblocks-environment/src/environment-port.ts:92

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

ParameterType
hostEnvironmentPortHost

Returns

() => void

Overrides

ThreeEnvironmentPort.observe


update()

update(): void;

Defined in: xrblocks-environment/src/environment-port.ts:214

Poll both managers. Called by the director's update.

Returns

void

Overrides

ThreeEnvironmentPort.update