magic-pixels
    Preparing search index...

    Class WebGL2Renderer

    WebGL2 renderer. Owns every GPU resource: programs (one per distinct pair of shader sources, shared by the materials using them), vertex array objects and buffers (one set per geometry) and textures. Scene objects stay plain data and can be shared between meshes freely. Materials need a glsl shader source pair.

    Shaders can declare the built-in uniforms modelMatrix, viewMatrix, projectionMatrix, modelViewMatrix (mat4) and normalMatrix (mat3); they are set per mesh from the scene graph and the camera, unless the material defines a uniform of the same name. The same goes for the lights of the frame, in view space with colours premultiplied by intensity: ambientLightColor (vec3), directionalLightDirections[] and directionalLightColors[] (vec3 arrays) with directionalLightCount (int), and pointLightPositions[], pointLightColors[] (vec3 arrays), pointLightRanges[] (float array) with pointLightCount. The array lengths are the shader's choice; lights beyond them are dropped. See LightUniforms.

    Implements

    Index
    autoClear: boolean = true

    clear color and depth at the start of every render (default true)

    canvas: HTMLCanvasElement
    gl: WebGL2RenderingContext
    pixelRatio: number = 1