Update app.py
Browse files
app.py
CHANGED
|
@@ -613,8 +613,8 @@ async(c, o, p, d, n, m, s)=>{
|
|
| 613 |
//zoom
|
| 614 |
BABYLON.Engine.LastCreatedScene.activeCamera.pinchDeltaPercentage = 1/256;
|
| 615 |
BABYLON.Engine.LastCreatedScene.activeCamera.wheelDeltaPercentage = 1/256;
|
| 616 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.upperRadiusLimit = 1.57
|
| 617 |
-
BABYLON.Engine.LastCreatedScene.activeCamera.lowerRadiusLimit = 0.
|
| 618 |
//BABYLON.Engine.LastCreatedScene.activeCamera.attachControl(document.getElementById("model3D").getElementsByTagName("canvas")[0], false);
|
| 619 |
|
| 620 |
BABYLON.Engine.LastCreatedScene.activeCamera.fov = document.getElementById("zoom").value;
|
|
@@ -704,19 +704,19 @@ async(c, o, p, d, n, m, s)=>{
|
|
| 704 |
window.ctx = null;
|
| 705 |
window.video = document.getElementById("depth_video").getElementsByTagName("video")[0];
|
| 706 |
window.parallax = 0;
|
| 707 |
-
window.xdir = new BABYLON.Vector3(
|
| 708 |
-
window.rdir = new BABYLON.Vector3(
|
| 709 |
|
| 710 |
document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function(evt) {
|
| 711 |
if (md === true) {
|
| 712 |
rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
|
| 713 |
-
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-
|
| 714 |
-
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-
|
| 715 |
|
| 716 |
x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
|
| 717 |
y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
|
| 718 |
|
| 719 |
-
if (rd === true
|
| 720 |
if (Math.abs(BABYLON.Engine.LastCreatedScene.activeCamera.radius) > (1.57-0.157)*16) {
|
| 721 |
BABYLON.Engine.LastCreatedScene.activeCamera.radius = (1.57-0.157)*16;
|
| 722 |
} else {
|
|
@@ -1313,8 +1313,8 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
| 1313 |
}
|
| 1314 |
parallax = this.value;
|
| 1315 |
rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
|
| 1316 |
-
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-
|
| 1317 |
-
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-
|
| 1318 |
this.parentNode.childNodes[2].innerText = parallax;
|
| 1319 |
'/><span>0.0</span></span><br/>
|
| 1320 |
<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='
|
|
|
|
| 613 |
//zoom
|
| 614 |
BABYLON.Engine.LastCreatedScene.activeCamera.pinchDeltaPercentage = 1/256;
|
| 615 |
BABYLON.Engine.LastCreatedScene.activeCamera.wheelDeltaPercentage = 1/256;
|
| 616 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.upperRadiusLimit = (1.57-0.157)*16;
|
| 617 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.lowerRadiusLimit = 0.0;
|
| 618 |
//BABYLON.Engine.LastCreatedScene.activeCamera.attachControl(document.getElementById("model3D").getElementsByTagName("canvas")[0], false);
|
| 619 |
|
| 620 |
BABYLON.Engine.LastCreatedScene.activeCamera.fov = document.getElementById("zoom").value;
|
|
|
|
| 704 |
window.ctx = null;
|
| 705 |
window.video = document.getElementById("depth_video").getElementsByTagName("video")[0];
|
| 706 |
window.parallax = 0;
|
| 707 |
+
window.xdir = new BABYLON.Vector3(1, 0, 0);
|
| 708 |
+
window.rdir = new BABYLON.Vector3(1, 0, 0);
|
| 709 |
|
| 710 |
document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function(evt) {
|
| 711 |
if (md === true) {
|
| 712 |
rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
|
| 713 |
+
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-2].position.x = parallax * rdir.x;
|
| 714 |
+
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-2].position.z = parallax * rdir.z;
|
| 715 |
|
| 716 |
x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
|
| 717 |
y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
|
| 718 |
|
| 719 |
+
if (rd === true) {
|
| 720 |
if (Math.abs(BABYLON.Engine.LastCreatedScene.activeCamera.radius) > (1.57-0.157)*16) {
|
| 721 |
BABYLON.Engine.LastCreatedScene.activeCamera.radius = (1.57-0.157)*16;
|
| 722 |
} else {
|
|
|
|
| 1313 |
}
|
| 1314 |
parallax = this.value;
|
| 1315 |
rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
|
| 1316 |
+
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-2].position.x = parallax * rdir.x;
|
| 1317 |
+
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-2].position.z = parallax * rdir.z;
|
| 1318 |
this.parentNode.childNodes[2].innerText = parallax;
|
| 1319 |
'/><span>0.0</span></span><br/>
|
| 1320 |
<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='
|