Represents the rendering context`.

Implements

  • WebGLContextProvider

Constructors

Properties

activeView: View

The View we are currently rendering.

backfaces: boolean

Whether backfaces are currently enabled during the current frame.

bindTexture: number

Statistic that counts how many times gl.bindTexture() has been called so far within the current frame.

debugging: boolean

Whether debugging is enabled.

frontface: boolean

The vertex winding order for what we currently consider to be a backface during current frame: true == "cw", false == "ccw".

gl: WebGL2RenderingContext

The WebGL rendering context.

iblBRDFLUT: WebGLTexture = null
iblIrradianceCubemap: WebGLTexture = null

IBL Layer-2 prefiltered samplers — populated by the IBL prefilter pipeline before the BRDF passes run. The smooth-shaded technique variants bind these for the split-sum specular IBL approximation:

  • iblIrradianceCubemap: cosine-convolved cubemap for diffuse IBL
  • iblPrefilteredCubemap: GGX-prefiltered cubemap with mip chain
  • iblBRDFLUT: shared 2D (NdotV, roughness) → (scale, bias) LUT

iblMaxSpecularMipLevel is the highest valid mip on the prefiltered cubemap, used to scale roughness into the lod range.

All four are null outside the BRDF binding window — the renderer sets them in RenderManager._renderScene and clears them in reset.

iblMaxSpecularMipLevel: number = 0
iblPrefilteredCubemap: WebGLTexture = null
iblViewToWorldRot: Float32Array<any> = ...

View-to-world rotation (3×3, transposed view matrix's upper-left) uploaded as a mat3 so the BRDF shader can transform view-space normals/reflection vectors into world space for cubemap sampling. Populated alongside the cubemaps. Float32 column-major.

lastProgramId: number

ID of the last WebGLProgram that was bound during the current frame. Used to avoid redundant program binds.

lastRenderPass: number

Render pass of the last _bind call. Used together with lastProgramId to detect when pass-dependent uniforms (e.g. silhouetteColor) need re-uploading even though the same program is still bound.

lineWidth: number

The current line width.

memoryConfigs: MemoryConfigs

The memory configuration for the WebGLRenderer.

pbrEnabled: boolean

Whether to render a quality representation for triangle surfaces.

When false, we'll render them with a fast vertex-shaded Gouraud-shaded representation, which is great for zillions of objects.

When true, we'll render them at a better visual quality, using smooth, per-fragment shading and a more realistic lighting model.

pickClipPos: FloatArrayParam

TODO

pickInvisible: boolean

Whether the WebGLRenderer is currently picking invisible objects.

pickProjMatrix: FloatArrayParam

The 4x4 orthographic projection transform matrix the WebGLRenderer is currently using when rendering a ray-pick.

pickViewMatrix: FloatArrayParam

The 4x4 viewing transform matrix the WebGLRenderer is currently using when rendering a ray-pick.

This sets the viewpoint to look along the ray, when picking with a ray.

pickZFar: number

Distance to the far clipping plane when rendering depth fragments for GPU-accelerated 3D picking.

pickZNear: number

Distance to the near clipping plane when rendering depth fragments for GPU-accelerated 3D picking.

rayPicking: boolean

Whether we are currently picking with a ray.

renderInspector: RenderInspector

The RenderInspector for logging draw calls.

saoOcclusionTexture: WebGLAbstractTexture

The occlusion rendering texture.

sceneRenderHeight: number
sceneRenderWidth: number

Width of the FBO the scene is currently being rendered into. Equal to drawingBufferWidth when Tonemap.renderScale is 1; larger when supersampling is on. Post-process passes (tonemap, FXAA) use drawingBufferWidth — they sample this bigger scene texture down to canvas size on the way out.

shadowCascadeCount: number

Number of shadow cascades active this frame, in [1, MAX_SHADOW_CASCADES].

shadowCascadeSplits: Float32Array<any>

View-space |z| boundaries between cascades. Entry i is the far edge of cascade i (equivalently the near edge of cascade i+1). Only the first shadowCascadeCount - 1 entries are meaningful.

shadowLightDirView: Float32Array<any>

Light direction in camera-view space (xyz). Populated alongside shadowLightViewProjMatrices and used by shadow-aware draw techniques for slope-scaled bias computation.

shadowLightViewProjMatrices: Float32Array<any>

Concatenated array of up to MAX_SHADOW_CASCADES mat4s (16 floats each) — shadowLightViewProjMatrices.subarray(i*16, (i+1)*16) is the camera-view-space → cascade-i light-clip matrix.

shadowLightViewProjMatrix: Float32Array<any>

Light view-projection matrix for the cascade currently being rendered, used by the shadow-depth technique which only ever processes one cascade per draw pass. Set by ShadowPipeline before each cascade's depth dispatch; ignored by shadow-aware color techniques (they read the array form, shadowLightViewProjMatrices).

shadowMapTextures: WebGLAbstractTexture[]

One shadow-map depth texture per cascade (indices 0..shadowCascadeCount-1 are populated). Unused slots alias to cascade 0's texture so every sampler in shadow-aware shaders has a valid binding. Null array entries indicate shadows aren't in effect this frame.

snapBufferSize: FloatArrayParam

Snap framebuffer size in pixels — the snap shaders use the ratio (drawingBufferSize / snapBufferSize) to convert a canvas-pixel offset into the matching offset on the small snap FBO, so the cursor's surroundings land flush against its edges.

snapClipPos: FloatArrayParam

Cursor position in clip space (range [-1, 1] on each axis), set by the SnapManager before binding a snap technique. The snap pass uses this to centre its viewport-remap helper on the cursor — same shape as pickClipPos but kept separate so pick and snap can run side by side without clobbering each other.

textureUnit: number

The next available texture unit to bind a texture to.

viewer: Viewer

The Viewer.

webglCanvasElement: HTMLCanvasElement

The HTML canvas element used for WebGL rendering.

Accessors

Methods