From d7b3c48843fd08eb4527a36388f7594a1b7aede0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Podgor=C5=A1ek?= Date: Wed, 28 Apr 2021 17:29:56 +0200 Subject: [PATCH] Odstranjen vmesnik za spremembe --- control.html | 107 ----------------------------------- control.js | 154 --------------------------------------------------- 2 files changed, 261 deletions(-) delete mode 100644 control.html delete mode 100644 control.js diff --git a/control.html b/control.html deleted file mode 100644 index 32b386c..0000000 --- a/control.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - cancerainbow control - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- vidni kot (FOV) - -
-
- visina objekta - -
-
- sirina objekta - -
-
- limit objektov - -
-
- rotacija X - -
-
- rotacija Y - -
-
- rotacija Z - -
-
- barva - -
-
- kamera - -
-
- - - - diff --git a/control.js b/control.js deleted file mode 100644 index 71ac507..0000000 --- a/control.js +++ /dev/null @@ -1,154 +0,0 @@ -// Interaktivnost - -var socket = new WebSocket(location.origin.replace(/https?/, 'ws')); - -function throttle (cb, limit) { - var w = false; - return function () { - if (!w) { - cb.apply(this, arguments); - w = true; - setTimeout(function () { - w = false; - }, limit); - } - } -} - -inputi = { - "fov": { - val: 120, - min: 30, - max: 179 - }, - "sirina": { - val: 2, - min: 1, - max: 6, - step: 0.1 - }, - "visina": { - val: 2, - min: 1, - max: 6, - step: 0.1 - }, - "obj_limit": { - val: 1000, - min: 1, - max: 10000 - }, - "rotx": { - val: 0, - min: -0.1, - max: 0.1, - step: 0.001 - }, - "roty": { - val: 0, - min: -0.1, - max: 0.1, - step: 0.001 - }, - "rotz": { - val: 0, - min: -0.1, - max: 0.1, - step: 0.001 - }, - "barva_mod": { - val: 0.001, - min: 0.001, - max: 0.18, - step: 0.001 - }, - "cam_rot_offset": { - val: 0, - min: -10, - max: 10, - step: 0.1 - } -}; - -Object.keys(inputi).map(function (name) { - var valEl = document.getElementById(name + "Val"); - if (!valEl) { return; } - - var ctlEl = document.getElementById(name + "Ctl"); - var params = inputi[name]; - - var step = params.step; - if (!step) step = 1; - noUiSlider.create(ctlEl, { - start: [params.val], - range: { - min: [params.min], - max: [params.max] - }, - step: step - }); - - ctlEl.noUiSlider.on('slide', throttle(function(val) { - console.log("update!"); - var value = val[0]; - valEl.innerHTML = value; - socket.send(['adjust', name, value].join(':')); - }, 125)); - - valEl.innerHTML = ctlEl.noUiSlider.get(); -}); - - -callbacks = { - fov: function(val) { - if (typeof camera === 'undefined') return; - FOV = val; - camera.fov = val; - camera.updateProjectionMatrix(); - }, - sirina: function(val) { - width = parseFloat(val); - }, - visina: function (val) { - height = parseFloat(val); - }, - rotx: function(val) { - rotacijaX = parseFloat(val); - }, - roty: function(val) { - rotacijaY = parseFloat(val); - }, - rotz: function(val) { - rotacijaZ = parseFloat(val); - }, - obj_limit: function(val) { - obj_limit = parseInt(val); - }, - default: function(name, val) { - window[name] = parseFloat(val); - } -}; - -socket.onmessage = function (msg) { - var parts = msg.data.split(":"); - var cmd = parts[0]; - - switch (cmd) { - case 'adjust': - var name = parts[1]; - var val = parts[2]; - - if (name in callbacks) { - callbacks[name].call(this, val); - } else { - callbacks["default"].call(this, name, val); - } - - var valEl = document.getElementById(name + "Val"); - if (!valEl) { return; } - var ctlEl = document.getElementById(name + "Ctl"); - - ctlEl.noUiSlider.set(val, false); - valEl.innerHTML = ctlEl.noUiSlider.get(); - } -};