Update app.py
Browse files
app.py
CHANGED
@@ -704,17 +704,13 @@ async(c, o, p, d, n, m, s)=>{
|
|
704 |
window.video = document.getElementById("depth_video").getElementsByTagName("video")[0];
|
705 |
window.parallax = 0;
|
706 |
window.xdir = new BABYLON.Vector3(1, 0, 0);
|
707 |
-
window.zdir = new BABYLON.Vector3(0, 0, 1);
|
708 |
window.rdir = new BABYLON.Vector3(0, 0, 0);
|
709 |
-
window.fdir = new BABYLON.Vector3(0, 0, 0);
|
710 |
|
711 |
document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function(evt) {
|
712 |
if (md === true) {
|
713 |
rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
|
714 |
-
|
715 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.
|
716 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.target.y = parallax * rdir.y + fdir.y;
|
717 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.target.z = parallax * rdir.z + fdir.z;
|
718 |
|
719 |
x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
|
720 |
y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
|
@@ -1301,13 +1297,11 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
1301 |
evt.initEvent(\"click\", true, false);
|
1302 |
document.getElementById(\"reset_cam\").dispatchEvent(evt);
|
1303 |
}
|
1304 |
-
parallax
|
1305 |
rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
|
1306 |
-
|
1307 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.
|
1308 |
-
|
1309 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.target.z = parallax * rdir.z + fdir.z;
|
1310 |
-
this.parentNode.childNodes[2].innerText = parallax.x;
|
1311 |
'/> <span>0.0</span></span><br/>
|
1312 |
<span><label for='contrast' style='width:8em'>Contrast</label><input id='contrast' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
|
1313 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
|
|
704 |
window.video = document.getElementById("depth_video").getElementsByTagName("video")[0];
|
705 |
window.parallax = 0;
|
706 |
window.xdir = new BABYLON.Vector3(1, 0, 0);
|
|
|
707 |
window.rdir = new BABYLON.Vector3(0, 0, 0);
|
|
|
708 |
|
709 |
document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function(evt) {
|
710 |
if (md === true) {
|
711 |
rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
|
712 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.position.x = parallax * rdir.x;
|
713 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.position.z = parallax * rdir.z;
|
|
|
|
|
714 |
|
715 |
x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
|
716 |
y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
|
|
|
1297 |
evt.initEvent(\"click\", true, false);
|
1298 |
document.getElementById(\"reset_cam\").dispatchEvent(evt);
|
1299 |
}
|
1300 |
+
parallax = this.value;
|
1301 |
rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
|
1302 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.position.x = parallax * rdir.x;
|
1303 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.position.z = parallax * rdir.z;
|
1304 |
+
this.parentNode.childNodes[2].innerText = parallax;
|
|
|
|
|
1305 |
'/> <span>0.0</span></span><br/>
|
1306 |
<span><label for='contrast' style='width:8em'>Contrast</label><input id='contrast' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
|
1307 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|