Update app.py
Browse files
app.py
CHANGED
|
@@ -702,11 +702,17 @@ async(c, o, p, d, n, m, s)=>{
|
|
| 702 |
window.buffer = null;
|
| 703 |
window.ctx = null;
|
| 704 |
window.video = document.getElementById("depth_video").getElementsByTagName("video")[0];
|
| 705 |
-
window.parallax =
|
|
|
|
|
|
|
| 706 |
|
| 707 |
document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function(evt) {
|
| 708 |
if (md === true) {
|
| 709 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 710 |
x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
|
| 711 |
y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
|
| 712 |
|
|
@@ -787,11 +793,6 @@ async(c, o, p, d, n, m, s)=>{
|
|
| 787 |
document.getElementById("model").appendChild(document.getElementById("model3D"));
|
| 788 |
toggleDisplay("model");
|
| 789 |
}
|
| 790 |
-
var code = document.getElementsByTagName('script');
|
| 791 |
-
for (var i=0; i<code.length; i++) {
|
| 792 |
-
var cd = code[i].innerText;
|
| 793 |
-
if (cd.length>1) {alert(cd);}
|
| 794 |
-
}
|
| 795 |
|
| 796 |
clearInterval(intv);
|
| 797 |
}
|
|
@@ -1298,7 +1299,10 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
| 1298 |
document.getElementById(\"reset_cam\").dispatchEvent(evt);
|
| 1299 |
}
|
| 1300 |
parallax.x = this.value;
|
| 1301 |
-
|
|
|
|
|
|
|
|
|
|
| 1302 |
this.parentNode.childNodes[2].innerText = parallax.x;
|
| 1303 |
'/> <span>0.0</span><br/>
|
| 1304 |
<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='
|
|
|
|
| 702 |
window.buffer = null;
|
| 703 |
window.ctx = null;
|
| 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.target.x = parallax * rdir.x;
|
| 713 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.target.y = parallax * rdir.y;
|
| 714 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.target.z = parallax * rdir.z;
|
| 715 |
+
|
| 716 |
x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
|
| 717 |
y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
|
| 718 |
|
|
|
|
| 793 |
document.getElementById("model").appendChild(document.getElementById("model3D"));
|
| 794 |
toggleDisplay("model");
|
| 795 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 796 |
|
| 797 |
clearInterval(intv);
|
| 798 |
}
|
|
|
|
| 1299 |
document.getElementById(\"reset_cam\").dispatchEvent(evt);
|
| 1300 |
}
|
| 1301 |
parallax.x = this.value;
|
| 1302 |
+
rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
|
| 1303 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.target.x = parallax * rdir.x;
|
| 1304 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.target.y = parallax * rdir.y;
|
| 1305 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.target.z = parallax * rdir.z;
|
| 1306 |
this.parentNode.childNodes[2].innerText = parallax.x;
|
| 1307 |
'/> <span>0.0</span><br/>
|
| 1308 |
<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='
|