瀏覽代碼

groundmeshes are now serialized correctly
added mesh.markVerticesDataAsUpdatable

David Catuhe 8 年之前
父節點
當前提交
0e1cbdb0ab

文件差異過大導致無法顯示
+ 25 - 25
dist/preview release/babylon.core.js


文件差異過大導致無法顯示
+ 3567 - 3566
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 34 - 34
dist/preview release/babylon.js


文件差異過大導致無法顯示
+ 36 - 20
dist/preview release/babylon.max.js


文件差異過大導致無法顯示
+ 3567 - 3566
dist/preview release/babylon.module.d.ts


文件差異過大導致無法顯示
+ 33 - 33
dist/preview release/babylon.noworker.js


+ 3 - 1
dist/preview release/what's new.md

@@ -28,7 +28,9 @@
 - Added `Quaternion.RotationQuaternionFromAxis()` and `Quaternion.RotationQuaternionFromAxisToRef()` ([jerome](https://github.com/jbousquie), thanks to [abow](https://github.com/abow))   
 - Added `Curve3.CreateCatmullRomSpline()` ([jerome](https://github.com/jbousquie) and [BitOfGold](https://github.com/BitOfGold))  
 - Added the optional parameter`colorFilter` to `CreateGroundFromHeightMap()` ([jerome](https://github.com/jbousquie))  
-- Improved the internal code of `Vector3.RotationFromAxisToRef()` ([jerome](https://github.com/jbousquie), thanks to [abow](https://github.com/abow))   
+- Improved the internal code of `Vector3.RotationFromAxisToRef()` ([jerome](https://github.com/jbousquie), thanks to [abow](https://github.com/abow))  
+- GroundMeshes are now serialized correctly ([deltakosh](https://github.com/deltakosh))
+- Added `mesh.markVerticesDataAsUpdatable()` to allow a specific vertexbuffer to become updatable ([deltakosh](https://github.com/deltakosh)) 
 
  
 ### Bug fixes

+ 15 - 1
src/Mesh/babylon.mesh.ts

@@ -707,6 +707,14 @@
             return this;
         }
 
+        public markVerticesDataAsUpdatable(kind: string, updatable = true) {
+            if (this.getVertexBuffer(kind).isUpdatable() === updatable) {
+                return;
+            }
+
+            this.setVerticesData(kind, this.getVerticesData(kind), updatable);
+        }
+
         /**
          * Sets the mesh VertexBuffer.  
          * Returns the Mesh.  
@@ -1844,7 +1852,13 @@
          * The parameter `rootUrl` is a string, it's the root URL to prefix the `delayLoadingFile` property with
          */
         public static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh {
-            var mesh = new Mesh(parsedMesh.name, scene);
+            var mesh : Mesh;
+
+            if (parsedMesh.type && parsedMesh.type === "GroundMesh") {
+                mesh = new GroundMesh(parsedMesh.name, scene);
+            } else {
+                mesh = new Mesh(parsedMesh.name, scene);
+            }
             mesh.id = parsedMesh.id;
 
             Tags.AddTagsTo(mesh, parsedMesh.tags);

+ 1 - 0
src/Tools/babylon.sceneSerializer.ts

@@ -45,6 +45,7 @@
 
         serializationObject.name = mesh.name;
         serializationObject.id = mesh.id;
+        serializationObject.type = mesh.getClassName();
 
         if (Tags.HasTags(mesh)) {
             serializationObject.tags = Tags.GetTags(mesh);