From d31ecfbf0e16069163e82ee33f815174de2391f6 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 27 Aug 2023 16:24:25 +0300 Subject: [WGL/P] Added coordinates in the top left corner --- Year 2/Computer Graphics with WebGL/Project/spaceship.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Year 2/Computer Graphics with WebGL/Project/spaceship.js') diff --git a/Year 2/Computer Graphics with WebGL/Project/spaceship.js b/Year 2/Computer Graphics with WebGL/Project/spaceship.js index 5b98229..a50f2fc 100644 --- a/Year 2/Computer Graphics with WebGL/Project/spaceship.js +++ b/Year 2/Computer Graphics with WebGL/Project/spaceship.js @@ -150,8 +150,13 @@ function mouseInit() { /* * On every draw */ +coordsElem = undefined; + function updateCamera() { for (var i = 0; i < pressedKeys.length; i++) if (pressedKeys[i]) keyAction[i](); lookAt(pos, vecSum(pos, forward.toCartesian()), up.toCartesian()); + if (coordsElem) { + coordsElem.innerText = 'X: '+pos[0]+' Y: '+pos[1]+' Z: '+pos[2]; + } } -- cgit v1.3.1-26-gb76a