freealise commited on
Commit
ba45271
1 Parent(s): 9badc2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -360,11 +360,13 @@ with gr.Blocks(css=css) as demo:
360
  var tg = new BABYLON.Vector3(BABYLON.Engine.LastCreatedScene.activeCamera.position.x, BABYLON.Engine.LastCreatedScene.activeCamera.position.y, BABYLON.Engine.LastCreatedScene.activeCamera.position.z);
361
  BABYLON.Engine.LastCreatedScene.activeCamera.radius = 0;
362
 
 
363
  BABYLON.Engine.LastCreatedScene.getNodes()[1].position = BABYLON.Engine.LastCreatedScene.activeCamera.position;
364
  var pivotTranslate = BABYLON.Engine.LastCreatedScene.getNodes()[1].position.subtract(tg);
365
  BABYLON.Engine.LastCreatedScene.getNodes()[1].setPivotMatrix(BABYLON.Matrix.Translation(pivotTranslate.x, pivotTranslate.y, pivotTranslate.z));
366
-
367
- BABYLON.Engine.LastCreatedScene.getNodes()[1].rotation.y = this.value;
 
368
  this.parentNode.childNodes[2].innerText = this.value;
369
  } catch(e) {alert(e);}
370
  '/><span>0.0</span>""")
@@ -407,7 +409,7 @@ with gr.Blocks(css=css) as demo:
407
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.screenshot = false;
408
  try {
409
  BABYLON.Tools.CreateScreenshotUsingRenderTarget(BABYLON.Engine.LastCreatedScene.getEngine(), BABYLON.Engine.LastCreatedScene.activeCamera,
410
- { width: 1024 }, (durl) => {
411
  document.getElementById(\"img_out\").onload = function() {
412
  var svgd = `<svg id=\"svg_out\" viewBox=\"0 0 ` + document.getElementById(\"img_out\").width + ` ` + document.getElementById(\"img_out\").height + `\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">
413
  <defs>
 
360
  var tg = new BABYLON.Vector3(BABYLON.Engine.LastCreatedScene.activeCamera.position.x, BABYLON.Engine.LastCreatedScene.activeCamera.position.y, BABYLON.Engine.LastCreatedScene.activeCamera.position.z);
361
  BABYLON.Engine.LastCreatedScene.activeCamera.radius = 0;
362
 
363
+ BABYLON.Engine.LastCreatedScene.activeCamera.metadata.axis = new BABYLON.Vector3(0,1,0);
364
  BABYLON.Engine.LastCreatedScene.getNodes()[1].position = BABYLON.Engine.LastCreatedScene.activeCamera.position;
365
  var pivotTranslate = BABYLON.Engine.LastCreatedScene.getNodes()[1].position.subtract(tg);
366
  BABYLON.Engine.LastCreatedScene.getNodes()[1].setPivotMatrix(BABYLON.Matrix.Translation(pivotTranslate.x, pivotTranslate.y, pivotTranslate.z));
367
+
368
+ BABYLON.Engine.LastCreatedScene.getNodes()[1].rotate(BABYLON.Engine.LastCreatedScene.activeCamera.metadata.axis, -parseFloat(this.parentNode.childNodes[2].innerText), BABYLON.Space.LOCAL);
369
+ BABYLON.Engine.LastCreatedScene.getNodes()[1].rotate(BABYLON.Engine.LastCreatedScene.activeCamera.metadata.axis, this.value, BABYLON.Space.LOCAL);
370
  this.parentNode.childNodes[2].innerText = this.value;
371
  } catch(e) {alert(e);}
372
  '/><span>0.0</span>""")
 
409
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.screenshot = false;
410
  try {
411
  BABYLON.Tools.CreateScreenshotUsingRenderTarget(BABYLON.Engine.LastCreatedScene.getEngine(), BABYLON.Engine.LastCreatedScene.activeCamera,
412
+ { precision: 1.0 }, (durl) => {
413
  document.getElementById(\"img_out\").onload = function() {
414
  var svgd = `<svg id=\"svg_out\" viewBox=\"0 0 ` + document.getElementById(\"img_out\").width + ` ` + document.getElementById(\"img_out\").height + `\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">
415
  <defs>