diff options
[WGL/P] Implemented very roughly simple ray marching, without support for anything
1 files changed, 9 insertions, 2 deletions
| -rw-r--r-- | Year 2/Computer Graphics with WebGL/Project/Project.html | 11 |
diff --git a/Year 2/Computer Graphics with WebGL/Project/Project.html b/Year 2/Computer Graphics with WebGL/Project/Project.html index 9852ab8..23e3759 100644 --- a/Year 2/Computer Graphics with WebGL/Project/Project.html +++ b/Year 2/Computer Graphics with WebGL/Project/Project.html @@ -61,6 +61,7 @@ h2 { <script src="spaceship.js"></script>
<script src="skybox.js"></script>
+ <script src="blackhole.js"></script>
<script>
/*
* WebGL
@@ -99,10 +100,11 @@ h2 { skybox = new Skybox(10000, [0.1,0.1,0.1], undefined);
planets = [new Sphere([1000,0,1000], 50),
new Sphere([1000,0,-1000], 50),
- new Sphere([700,0,1000], 40),
+ new Sphere([950,0,1100], 40),
new Sphere([0,0,0], 100),
new Sphere([1000, 0, -30], 20)];
- planets.forEach((p) => p.color = [0.956,0.5,0.215]);
+
+ blackHole = new BlackHole([1000,0,900], 30);
resizeglcanvas();
}
@@ -124,8 +126,13 @@ h2 { gl.clear(gl.COLOR_BUFFER_BIT+gl.DEPTH_BUFFER_BIT);
lookUpdate();
+ gl.uniform3f(uEye, pos[0], pos[1], pos[2]);
+ gl.uniform3f(uEyeForward, forward.toCartesian()[0], forward.toCartesian()[1], forward.toCartesian()[2]);
+ gl.vertexAttrib4fv(aSphere, [pos[0], pos[1], pos[2], 0]);
+
skybox.draw();
planets.forEach((p) => p.draw());
+ blackHole.draw();
requestAnimationFrame(drawFrame);
}
|
