diff --git a/html/001-platform-provenance.js b/html/001-platform-provenance.js index a4b9645..e4e6555 100644 --- a/html/001-platform-provenance.js +++ b/html/001-platform-provenance.js @@ -2,7 +2,7 @@ import { main } from "./lib/platform.js"; import { Shader } from "./lib/shader.js"; import { BasicPlane } from "./lib/basic-plane.js"; -main((gl, core) => { +main({ fov: 20 }, (gl, core) => { const shader = new Shader(gl, core) .attach( gl.VERTEX_SHADER, diff --git a/html/lib/platform.js b/html/lib/platform.js index 29843b3..e42085f 100644 --- a/html/lib/platform.js +++ b/html/lib/platform.js @@ -1,6 +1,6 @@ export const clear = (gl) => {}; -export const main = (next) => { +export const main = (config = { fov: 45 }, next = () => {}) => { const canvas = document.querySelector("canvas"); canvas.width = window.innerWidth; @@ -17,14 +17,14 @@ export const main = (next) => { return; } - const core = renderingCore(gl); + const core = renderingCore(gl, config); core.clear(); next(gl, core); }; -const renderingCore = (gl) => { - const fieldOfView = (10 * Math.PI) / 180; // in radians +const renderingCore = (gl, config = {}) => { + const fieldOfView = (config.fov * Math.PI) / 180; // in radians const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight; const zNear = 0.1; const zFar = 100.0;