From 46ee648fff31004221d307d0af9cabc0c4250a4c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 27 Aug 2023 12:01:37 +0300 Subject: [WGL/P] Minor formatting and naming changes --- .../Computer Graphics with WebGL/Project/Project.html | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'Year 2/Computer Graphics with WebGL/Project/Project.html') diff --git a/Year 2/Computer Graphics with WebGL/Project/Project.html b/Year 2/Computer Graphics with WebGL/Project/Project.html index 4c88553..6133dba 100644 --- a/Year 2/Computer Graphics with WebGL/Project/Project.html +++ b/Year 2/Computer Graphics with WebGL/Project/Project.html @@ -70,7 +70,7 @@ h2 { function start() { - canvas = document.getElementById("picasso"); + canvas = document.getElementById('picasso'); canvas.addEventListener('webglcontextlost',function(event){event.preventDefault();},false); canvas.addEventListener('webglcontextrestored',function(){init();},false); @@ -83,7 +83,7 @@ h2 { function init() { - gl = getContext("picasso"); + gl = getContext('picasso'); glprog = getProgram(vShader,fShader); getVariables(); @@ -104,7 +104,7 @@ h2 { skybox = new Skybox(10000, [0,0,0], undefined); stars = [ - new Star([1100,0,1000], 10), + new Star([1200,0,1000], 10), // new Star([1000,0,900], 30), // new Star([950,0,1100], 40), ]; @@ -132,24 +132,16 @@ h2 { { gl.clear(gl.COLOR_BUFFER_BIT+gl.DEPTH_BUFFER_BIT); - lookUpdate(); + updateCamera(); gl.uniform3fv(uEye, pos); stars[0].moveTo(vecSum(stars[0].sphere.center, [-0.5,0,0])); + skybox.draw(); stars.forEach((s) => s.draw()); requestAnimationFrame(drawFrame); } - document.addEventListener('keypress', (e) => { - if (e.key == 'u') { - console.log(w); - console.log(w*gl.canvas.height / gl.canvas.width); - console.log(forward.toCartesian()); - console.log(left.toCartesian()); - console.log(up.toCartesian()); - } - }); -- cgit v1.3.1-23-gd82d