Explorar el Código

Displacement Map sanity check.

Making sure the vertex buffer is updatable - otherwise calling this function will actually do nothing.
Raanan Weber hace 10 años
padre
commit
46f3022fdd
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/Mesh/babylon.mesh.ts

+ 4 - 2
src/Mesh/babylon.mesh.ts

@@ -1013,8 +1013,10 @@
         public applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void {
             if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)
                 || !this.isVerticesDataPresent(VertexBuffer.NormalKind)
-                || !this.isVerticesDataPresent(VertexBuffer.UVKind)) {
-                Tools.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing");
+                || !this.isVerticesDataPresent(VertexBuffer.UVKind)
+                || !this.getVertexBuffer(VertexBuffer.PositionKind).isUpdatable()
+                || !this.getVertexBuffer(VertexBuffer.NormalKind).isUpdatable()) {
+                Tools.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing or not updatable");
                 return;
             }