update default fov
This commit is contained in:
parent
4ff9d3934c
commit
1da90f397b
2 changed files with 5 additions and 5 deletions
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue