execute method

  1. @override
void execute(
  1. RenderingContext gl,
  2. Camera camera, {
  3. Matrix4? projectionMatrix,
  4. Matrix4? viewMatrix,
})
override

Draws the skydome using the provided viewport and camera parameters.

Implementation

@override
void execute(RenderingContext gl, Camera camera,
    {Matrix4? projectionMatrix, Matrix4? viewMatrix,}) {
  if (_program == null || _tex == null) return;

  gl
    ..useProgram(_program)
    ..disable(WebGL.BLEND)
    ..disable(WebGL.DEPTH_TEST)
    ..activeTexture(WebGL.TEXTURE0)
    ..bindTexture(WebGL.TEXTURE_2D, _tex)
    ..uniform1i(_uBg!, 0)
    ..uniform2f(
      _uViewport!,
      camera.width.toDouble(),
      camera.height.toDouble(),
    )
    ..uniform2f(_uFocal!, camera.focalXForShader(), camera.focalYForShader())
    ..uniformMatrix3fv(_uInvViewRot!, false, camera.invViewRotation3x3())
    ..uniformMatrix3fv(_uBgRot!, false, _bgRot)
    ..drawArrays(WebGL.TRIANGLES, 0, 3);
}