فهرست منبع

Merge pull request #5643 from Eole211/patch-1

Avoid geometry copy error
David Catuhe 6 سال پیش
والد
کامیت
ecbc0b8ca7
1فایلهای تغییر یافته به همراه13 افزوده شده و 11 حذف شده
  1. 13 11
      src/Mesh/babylon.geometry.ts

+ 13 - 11
src/Mesh/babylon.geometry.ts

@@ -918,18 +918,20 @@ module BABYLON {
             for (kind in this._vertexBuffers) {
                 // using slice() to make a copy of the array and not just reference it
                 var data = this.getVerticesData(kind);
+                
+                if (data) {
+                    if (data instanceof Float32Array) {
+                        vertexData.set(new Float32Array(<Float32Array>data), kind);
+                    } else {
+                        vertexData.set((<number[]>data).slice(0), kind);
+                    }
+                    if (!stopChecking) {
+                        let vb = this.getVertexBuffer(kind);
 
-                if (data instanceof Float32Array) {
-                    vertexData.set(new Float32Array(<Float32Array>data), kind);
-                } else {
-                    vertexData.set((<number[]>data).slice(0), kind);
-                }
-                if (!stopChecking) {
-                    let vb = this.getVertexBuffer(kind);
-
-                    if (vb) {
-                        updatable = vb.isUpdatable();
-                        stopChecking = !updatable;
+                        if (vb) {
+                            updatable = vb.isUpdatable();
+                            stopChecking = !updatable;
+                        }
                     }
                 }
             }