Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Computer Graphics with WebGL / Project / Project.html
diff options
context:
space:
mode:
Commit6dd51a351bebd3347c1c4d9d8caf4d7b2f2a4338 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-08-25 13:39:13 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-08-25 13:39:13 +0300
Filesb408c20abe1d23b92075f1c22c898246f40d3c2b /Year 2/Computer Graphics with WebGL/Project/Project.html
uni-projects-6dd51a351bebd3347c1c4d9d8caf4d7b2f2a4338.tar
uni-projects-6dd51a351bebd3347c1c4d9d8caf4d7b2f2a4338.tar.gz
uni-projects-6dd51a351bebd3347c1c4d9d8caf4d7b2f2a4338.zip
Parent10889181959cada7e397ac377cb6d43dd977cf62 (diff)
[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.html11
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);
}