freealise commited on
Commit
a413aa4
·
verified ·
1 Parent(s): e660fbb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -19
app.py CHANGED
@@ -705,7 +705,7 @@ async(c, o, p, d, n, m, s)=>{
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
  window.videoDomeMesh = BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1];
710
 
711
  document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function(evt) {
@@ -714,24 +714,24 @@ async(c, o, p, d, n, m, s)=>{
714
  videoDomeMesh.position.x = parallax * rdir.x;
715
  videoDomeMesh.position.z = parallax * rdir.z;
716
 
 
 
 
 
 
717
  x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
718
  y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
719
 
720
- if (rd === true) {
721
- if (Math.abs(BABYLON.Engine.LastCreatedScene.activeCamera.radius) > (1.57-0.157)*16) {
722
- BABYLON.Engine.LastCreatedScene.activeCamera.radius = (1.57-0.157)*16;
723
- } else {
724
- BABYLON.Engine.LastCreatedScene.activeCamera.fov = BABYLON.Engine.LastCreatedScene.activeCamera.radius/16 + 0.157;
725
- }
726
- document.getElementById('zoom').value = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
727
- document.getElementById('zoom').parentNode.childNodes[2].innerText = document.getElementById('zoom').value;
728
-
729
- xold=x;
730
- yold=y;
731
  }
732
- try {
733
- compass.style.transform = "rotateX(" + (BABYLON.Engine.LastCreatedScene.activeCamera.beta-Math.PI/2) + "rad) rotateZ(" + BABYLON.Engine.LastCreatedScene.activeCamera.alpha + "rad)";
734
- } catch(e) {alert(e);}
 
 
735
  }
736
  });
737
  document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointerdown', function() {
@@ -1055,7 +1055,7 @@ window.play = play;
1055
  //mesh.position.z = coords[counter].lat;
1056
  //mesh.position.x = coords[counter].lng;
1057
  mesh.rotation.y = coords[counter].heading / 180 * Math.PI;
1058
- mesh.rotation.z = -coords[counter].pitch / 180 * Math.PI;
1059
 
1060
  return mesh;
1061
  }
@@ -1306,7 +1306,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1306
 
1307
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
1308
  '/><span>0.8</span></span><br/>
1309
- <span><label for='pan' style='width:8em'>Pan</label><input id='pan' type='range' style='width:128px;height:1em;' value='0' min='-64' max='64' step='0.001' oninput='
1310
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1311
  var evt = document.createEvent(\"Event\");
1312
  evt.initEvent(\"click\", true, false);
@@ -1314,10 +1314,9 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1314
  }
1315
  parallax = this.value;
1316
  rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
1317
- this.parentNode.childNodes[2].innerText = JSON.stringify(videoDomeMesh.position);
1318
  videoDomeMesh.position.x = parallax * rdir.x;
1319
  videoDomeMesh.position.z = parallax * rdir.z;
1320
- //this.parentNode.childNodes[2].innerText = parallax;
1321
  '/><span>0.0</span></span><br/>
1322
  <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='
1323
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
 
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(0, 0, 0);
709
  window.videoDomeMesh = BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1];
710
 
711
  document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function(evt) {
 
714
  videoDomeMesh.position.x = parallax * rdir.x;
715
  videoDomeMesh.position.z = parallax * rdir.z;
716
 
717
+ try {
718
+ compass.style.transform = "rotateX(" + (BABYLON.Engine.LastCreatedScene.activeCamera.beta-Math.PI/2) + "rad) rotateZ(" + BABYLON.Engine.LastCreatedScene.activeCamera.alpha + "rad)";
719
+ } catch(e) {alert(e);}
720
+ }
721
+ if (rd === true) {
722
  x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
723
  y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
724
 
725
+ if (Math.abs(BABYLON.Engine.LastCreatedScene.activeCamera.radius) > (1.57-0.157)*16) {
726
+ BABYLON.Engine.LastCreatedScene.activeCamera.radius = (1.57-0.157)*16;
727
+ } else {
728
+ BABYLON.Engine.LastCreatedScene.activeCamera.fov = BABYLON.Engine.LastCreatedScene.activeCamera.radius/16 + 0.157;
 
 
 
 
 
 
 
729
  }
730
+ document.getElementById('zoom').value = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
731
+ document.getElementById('zoom').parentNode.childNodes[2].innerText = document.getElementById('zoom').value;
732
+
733
+ xold=x;
734
+ yold=y;
735
  }
736
  });
737
  document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointerdown', function() {
 
1055
  //mesh.position.z = coords[counter].lat;
1056
  //mesh.position.x = coords[counter].lng;
1057
  mesh.rotation.y = coords[counter].heading / 180 * Math.PI;
1058
+ mesh.rotation.z = coords[counter].pitch / 180 * Math.PI;
1059
 
1060
  return mesh;
1061
  }
 
1306
 
1307
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
1308
  '/><span>0.8</span></span><br/>
1309
+ <span><label for='pan' style='width:8em'>Pan</label><input id='pan' type='range' style='width:128px;height:1em;' value='0' min='-16' max='16' step='0.001' oninput='
1310
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1311
  var evt = document.createEvent(\"Event\");
1312
  evt.initEvent(\"click\", true, false);
 
1314
  }
1315
  parallax = this.value;
1316
  rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
 
1317
  videoDomeMesh.position.x = parallax * rdir.x;
1318
  videoDomeMesh.position.z = parallax * rdir.z;
1319
+ this.parentNode.childNodes[2].innerText = parallax;
1320
  '/><span>0.0</span></span><br/>
1321
  <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='
1322
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {