freealise commited on
Commit
63e206e
·
verified ·
1 Parent(s): 63b1cb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -703,14 +703,14 @@ async(c, o, p, d, n, m, s)=>{
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.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);
@@ -1290,8 +1290,8 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1290
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
1291
 
1292
  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)\";
1293
- '/> <span>0.8</span></span><br/>
1294
- <span><label for='pan' style='width:8em'>Pan</label><input id='pan' type='range' style='width:128px;height:1em;' value='0' min='-128' max='128' step='0.001' oninput='
1295
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1296
  var evt = document.createEvent(\"Event\");
1297
  evt.initEvent(\"click\", true, false);
@@ -1299,12 +1299,10 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1299
  }
1300
  parallax = this.value;
1301
  rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
1302
- alert(rdir);
1303
- BABYLON.Engine.LastCreatedScene.activeCamera.position.x = parallax * rdir.x;
1304
- BABYLON.Engine.LastCreatedScene.activeCamera.position.z = parallax * rdir.z;
1305
- alert(BABYLON.Engine.LastCreatedScene.activeCamera.position);
1306
  this.parentNode.childNodes[2].innerText = parallax;
1307
- '/> <span>0.0</span></span><br/>
1308
  <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='
1309
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1310
  var evt = document.createEvent(\"Event\");
@@ -1313,7 +1311,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1313
  }
1314
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = this.value;
1315
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast;
1316
- '/> <span>1.0</span></span><br/>
1317
  <span><label for='exposure' style='width:8em'>Exposure</label><input id='exposure' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
1318
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1319
  var evt = document.createEvent(\"Event\");
@@ -1322,7 +1320,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
1322
  }
1323
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
1324
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
1325
- '/> <span>1.0</span></span><br/>
1326
  <a href='#' onclick='snapshot();'>Screenshot</a>
1327
  <a href='#' onclick='record_video();'>Record</a>
1328
  <a href='#' onclick='stop_recording();'>Stop rec.</a>
 
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.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].position.x = parallax * rdir.x;
713
+ BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].position.z = parallax * rdir.z;
714
 
715
  x = parseInt(evt.clientX - evt.target.getBoundingClientRect().x);
716
  y = parseInt(evt.clientY - evt.target.getBoundingClientRect().y);
 
1290
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
1291
 
1292
  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)\";
1293
+ '/><span>0.8</span></span><br/>
1294
+ <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='
1295
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1296
  var evt = document.createEvent(\"Event\");
1297
  evt.initEvent(\"click\", true, false);
 
1299
  }
1300
  parallax = this.value;
1301
  rdir = BABYLON.Engine.LastCreatedScene.activeCamera.getDirection(xdir);
1302
+ BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].position.x = parallax * rdir.x;
1303
+ BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].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) {
1308
  var evt = document.createEvent(\"Event\");
 
1311
  }
1312
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = this.value;
1313
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast;
1314
+ '/><span>1.0</span></span><br/>
1315
  <span><label for='exposure' style='width:8em'>Exposure</label><input id='exposure' type='range' style='width:128px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
1316
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1317
  var evt = document.createEvent(\"Event\");
 
1320
  }
1321
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
1322
  this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
1323
+ '/><span>1.0</span></span><br/>
1324
  <a href='#' onclick='snapshot();'>Screenshot</a>
1325
  <a href='#' onclick='record_video();'>Record</a>
1326
  <a href='#' onclick='stop_recording();'>Stop rec.</a>