draw method
Draws the skydome using the provided viewport and camera parameters.
width,height: current viewport size in logical pixels.fx,fy: focal lengths in pixels.invViewRot3x3: camera inverse view rotation (3x3 matrix).
Implementation
void draw(
int width,
int height,
double fx,
double fy,
Float32List invViewRot3x3,
) {
if (!_ready || _prog == null || _tex == null) return;
_gl
..useProgram(_prog)
..disable(WebGL.BLEND)
..disable(WebGL.DEPTH_TEST)
..activeTexture(WebGL.TEXTURE0)
..bindTexture(WebGL.TEXTURE_2D, _tex)
..uniform1i(_uBg!, 0)
..uniform2f(_uViewport!, width.toDouble(), height.toDouble())
..uniform2f(_uFocal!, fx, fy)
..uniformMatrix3fv(_uInvViewRot!, false, invViewRot3x3)
..uniformMatrix3fv(_uBgRot!, false, _bgRot)
..drawArrays(WebGL.TRIANGLES, 0, 3);
}