freealise commited on
Commit
4ff4abd
·
verified ·
1 Parent(s): ac0ccb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -13
app.py CHANGED
@@ -673,22 +673,27 @@ async(c, o, p, d, n, m)=>{
673
  {
674
  resolution: 16,
675
  size: 512,
676
- autoPlay: false
677
  }, BABYLON.Engine.LastCreatedScene
678
  );
679
- /*
680
  var q = BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-2]._children;
681
  for (i = 0; i < q.length; i++) {
682
  let mesh = q[i];
683
  mesh.dispose(false, true);
684
  }
685
  BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].scaling.z = -1;
686
- BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.emissiveTexture = videoDome.videoTexture;
687
- BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.emissiveTexture.hasAlpha = true;
688
- BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.useAlphaFromEmissiveTexture = true;
 
 
689
  BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].alphaIndex = 1;
690
  BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].visibility = 0.9999;
691
- */
 
 
 
 
692
 
693
  window.md = false;
694
  window.r_old = 1.0;
@@ -935,14 +940,14 @@ window.snapshot = snapshot;
935
  uvScale,
936
  forceUpdate
937
  ) {
938
- if (!mesh.isVerticesDataPresent(BABYLON.VertexBuffer.PositionKind) || !mesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind) || !mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
939
- //alert("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing");
940
- let positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
941
- let normals = [];
942
- BABYLON.VertexData.ComputeNormals(positions, mesh.getIndices(), normals, {useRightHandedSystem: true});
943
- mesh.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals);
944
- //return mesh;
945
  }
 
 
 
 
946
 
947
  const positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind, true, true);
948
  const normals = mesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
@@ -981,6 +986,13 @@ window.snapshot = snapshot;
981
  }
982
 
983
  mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, positions);
 
 
 
 
 
 
 
984
  return mesh;
985
  }
986
  window.applyDisplacementMapFromBuffer = applyDisplacementMapFromBuffer;
 
673
  {
674
  resolution: 16,
675
  size: 512,
676
+ autoPlay: true
677
  }, BABYLON.Engine.LastCreatedScene
678
  );
 
679
  var q = BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-2]._children;
680
  for (i = 0; i < q.length; i++) {
681
  let mesh = q[i];
682
  mesh.dispose(false, true);
683
  }
684
  BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].scaling.z = -1;
685
+ BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.diffuseTexture.hasAlpha = true;
686
+ BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.useAlphaFromDiffuseTexture = true;
687
+ //BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.emissiveTexture = videoDome.videoTexture;
688
+ //BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.emissiveTexture.hasAlpha = true;
689
+ //BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.useAlphaFromEmissiveTexture = true;
690
  BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].alphaIndex = 1;
691
  BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].visibility = 0.9999;
692
+
693
+ window.lat = coords[0].lat;
694
+ window.lng = coords[0].lng;
695
+ window.heading = coords[0].heading;
696
+ window.pitch = coords[0].pitch;
697
 
698
  window.md = false;
699
  window.r_old = 1.0;
 
940
  uvScale,
941
  forceUpdate
942
  ) {
943
+ if (!mesh.isVerticesDataPresent(BABYLON.VertexBuffer.PositionKind) || !mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
944
+ alert("Cannot call applyDisplacementMap: Given mesh is not complete. Position or UV are missing");
945
+ return mesh;
 
 
 
 
946
  }
947
+ let positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
948
+ let normals = [];
949
+ BABYLON.VertexData.ComputeNormals(positions, mesh.getIndices(), normals, {useRightHandedSystem: true});
950
+ mesh.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals);
951
 
952
  const positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind, true, true);
953
  const normals = mesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
 
986
  }
987
 
988
  mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, positions);
989
+
990
+ mesh.rotationQuaternion = null;
991
+ mesh.position.z = lat;
992
+ mesh.position.x = lng;
993
+ mesh.rotation.y = heading / 180 * Math.PI;
994
+ mesh.rotation.z = -pitch / 180 * Math.PI;
995
+
996
  return mesh;
997
  }
998
  window.applyDisplacementMapFromBuffer = applyDisplacementMapFromBuffer;