freealise commited on
Commit
ac0ccb0
·
verified ·
1 Parent(s): 0b2c9a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -936,8 +936,12 @@ window.snapshot = snapshot;
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 "+!mesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind));
940
- return mesh;
 
 
 
 
941
  }
942
 
943
  const positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind, true, true);
 
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);