Small World Engine API Reference - v0.78.00
    Preparing search index...

    Class WebGL1Renderer

    WebGL 1.0 implementation of the renderer.

    Hierarchy (View Summary)

    Index
    _activeRenderTarget: RenderTarget | RenderTargetCube | null = null
    _bloomPassGL: BloomPassGL | undefined = undefined
    _clearColor: Color = ...

    The clear color of the renderer.

    _frameFar: number = 1000
    _frameNear: number = 0.1

    This frame's camera near/far and raw projection matrix, stashed here so flushPostProcess() (called later, from a pass with no camera parameters of its own) can hand them to HBAO for reconstructing view-space position from the opaque depth buffer. _frameProjMatrix is also handed to WebGLRenderPass.execute() as an explicit parameter every frame (see below) for WebGLClusterCullPass, rather than being a public field passes reach for directly.

    _frameProjMatrix: Float32Array<ArrayBufferLike> | undefined = undefined
    _hdrFbo: WebGLFramebuffer | undefined = undefined
    _hdrRenderBuffer: WebGLRenderbuffer | undefined = undefined
    _hdrTexture: WebGLTexture | undefined = undefined
    _lightData: LightDataInterface = ...

    Cached light data to avoid GC pressure.

    _passes: WebGLRenderPass[] = []
    _postPassGL: PostProcessPassGL | undefined = undefined
    _quality: QualityConfig = ...

    Global quality settings.

    _texCache: Map<Texture, WebGLTexture> = ...

    Shared by WebGL1Renderer/WebGL2Renderer's _getWebGLTexture() -- also written to from their render-target and disposal code paths.

    Per-instance bundle of DeviceCaps/ShaderRegistry/AssetManager -- see RendererContext.

    defaultCubeTexture: WebGLTexture
    defaultNormalMap: WebGLTexture
    defaultSpecularMap: WebGLTexture
    defaultTexture: WebGLTexture
    gl: WebGLRenderingContext
    onContextLost?: (info: { message?: string; reason?: string }) => void

    Optional callback triggered when the GPU context is lost.

    postProcessing: PostProcessingGroup = ...

    The global post processing volume/group.

    type: RendererType = RendererType.WEB_GL1

    The type of the renderer.

    • get isContextLost(): boolean

      Whether the underlying GPU context has been lost.

      Returns boolean

    • get isOffscreenRenderTarget(): boolean

      True while the current render() call is targeting an offscreen RenderTarget/ RenderTargetCube (a DynamicReflectionProbe face or a PlanarReflectionNode), rather than the main camera's canvas. WebGLShadowPass uses this to skip re-rendering the directional-light cascade atlas for these secondary, differently-angled cameras -- the atlas is fit to the main camera once per frame and shared by every pass; rebuilding it from a probe's much wider, differently-positioned view clobbered it with geometry culled to that probe's frustum, which could leave nearby dynamic objects (e.g. an orbiting moon) unlit/black in the reflection.

      Returns boolean

    • get webglContext(): WebGLRenderingContext

      Satisfies Renderer interface

      Returns WebGLRenderingContext

    • Common early-exit checks _getWebGLTexture() needs regardless of WebGL1 vs. WebGL2 (whose upload paths otherwise differ -- WebGL2 additionally handles TextureArray via texImage3D). Returns the texture to use if any of these apply, or undefined if the caller should fall through to its own upload logic. A RenderTarget has no .image -- its GL texture already exists from being rendered into (populated in each renderer's own render-target bind path), so it's looked up in the cache instead of uploaded, mirroring the WebGPU renderer's identical RenderTarget handling.

      Parameters

      Returns WebGLTexture | undefined

    • Applies the previous frame's Hierarchical-Z occlusion culling results (if ready) by setting occlusionCulled on the tested objects. Called once per frame, before FrustumCuller.cull(). WebGPU-only (see docs/adr/0008-hzb-occlusion-culling-webgpu-only.md); a no-op on WebGL1/WebGL2 and whenever occlusion culling isn't enabled.

      Parameters

      Returns void

    • Renders a scene.

      Parameters

      • scene: Scene
      • vp: Float32Array
      • camPos: Vector3D = Vector3D.ZERO
      • OptionalvMat: Float32Array<ArrayBufferLike>
      • Optionalnear: number
      • Optionalfar: number
      • OptionalprojMatrix: Float32Array<ArrayBufferLike>

      Returns void