freealise commited on
Commit
e09db60
1 Parent(s): a9ca6aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -606,6 +606,22 @@ async(p, d, n)=>{
606
  if (document.getElementById("iframe3D")===null || typeof document.getElementById("iframe3D")==="undefined") {
607
  if (BABYLON && BABYLON.Engine.LastCreatedScene) {
608
  BABYLON.Engine.LastCreatedScene.onAfterRenderObservable.add(function() { //onDataLoadedObservable
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
 
610
  var bg = JSON.parse(document.getElementById("bgcolor").getElementsByTagName("textarea")[0].value);
611
  BABYLON.Engine.LastCreatedScene.getEngine().setHardwareScalingLevel(1.0);
 
606
  if (document.getElementById("iframe3D")===null || typeof document.getElementById("iframe3D")==="undefined") {
607
  if (BABYLON && BABYLON.Engine.LastCreatedScene) {
608
  BABYLON.Engine.LastCreatedScene.onAfterRenderObservable.add(function() { //onDataLoadedObservable
609
+
610
+ var then = new Date().getTime();
611
+ var now, delta;
612
+ const interval = 1000 / 25;
613
+ const tolerance = 0.1;
614
+ try {
615
+ BABYLON.Engine.LastCreatedScene.getEngine().stopRenderLoop();
616
+ BABYLON.Engine.LastCreatedScene.getEngine().runRenderLoop(function() {
617
+ now = new Date().getTime();
618
+ delta = now - then;
619
+ then = now - (delta % interval);
620
+ if (delta >= interval - tolerance) {
621
+ BABYLON.Engine.LastCreatedScene.render();
622
+ }
623
+ });
624
+ } catch(e) {alert(e);}
625
 
626
  var bg = JSON.parse(document.getElementById("bgcolor").getElementsByTagName("textarea")[0].value);
627
  BABYLON.Engine.LastCreatedScene.getEngine().setHardwareScalingLevel(1.0);