ProjectorManager

Source: ProjectorManager.ts:28

Default texture unit where the depth array sampler is bound.


Constructor

new ProjectorManager(renderer): ProjectorManager

Instance Methods

_rebindFramebufferToLayer()

Rebinds projector.depthCamera.framebuffer COLOR_ATTACHMENT0 from its own TEXTURE_2D to (this._depthArrayTexture, projector._slot) so renders go directly into the array layer without any per-frame copy. The original TEXTURE_2D stays referenced inside framebuffer.textures[0] so framebuffer.destroy() can free it normally — we never overwrite that slot with the shared array texture.

_restoreFramebufferAttachment()

Restores projector.depthCamera.framebuffer COLOR_ATTACHMENT0 back to its original TEXTURE_2D so subsequent depth renders no longer touch the freed array layer.

bindForward()

Binds forward/WOIT projectors to the given shader program. Uses top-K projectors by priority for current draw call.

Returns

  • Actual projector count uploaded (0..MAX_FORWARD_PROJECTORS).

bindDeferred(projectorIndex)

Binds exactly one projector for deferred frustum-geometry draw call.

Parameters

  • projectorIndex (default: 0) — Active projector index in priority-sorted array.

Returns

  • 1 if projector was bound, 0 if index is out of range.

_ensureDepthArrayTexture()

Lazily allocates the manager-owned TEXTURE_2D_ARRAY at the size of the first projector to be added. Returns false if a size mismatch is detected.

Instance Fields

activeCount

Total active projectors count (used by consumers to choose _proj / _noproj programs).

depthArrayTexture

Manager-owned TEXTURE_2D_ARRAY containing depth maps for all projectors.

active

Snapshot of currently active projectors (sorted by priority desc).