diff options
[WGL/P] Minor formatting and naming changes
1 files changed, 5 insertions, 13 deletions
| -rw-r--r-- | Year 2/Computer Graphics with WebGL/Project/Project.html | 18 |
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());
- }
- });
</script>
</head>
|
