Browse Source

add support for doNotSerialize for skeletons
Fix instances

David Catuhe 7 năm trước cách đây
mục cha
commit
a5a925a07c

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13937 - 13933
Playground/babylon.d.txt


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13358 - 13354
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 2
dist/preview release/babylon.js


+ 8 - 1
dist/preview release/babylon.max.js

@@ -71222,6 +71222,10 @@ var BABYLON;
             this._identity = BABYLON.Matrix.Identity();
             this._ranges = {};
             this._lastAbsoluteTransformsUpdateId = -1;
+            /**
+             * Specifies if the skeleton should be serialized.
+             */
+            this.doNotSerialize = false;
             // Events
             /**
              * An event triggered before computing the skeleton's matrices
@@ -85797,7 +85801,10 @@ var BABYLON;
             // Skeletons
             serializationObject.skeletons = [];
             for (index = 0; index < scene.skeletons.length; index++) {
-                serializationObject.skeletons.push(scene.skeletons[index].serialize());
+                var skeleton = scene.skeletons[index];
+                if (!skeleton.doNotSerialize) {
+                    serializationObject.skeletons.push(skeleton.serialize());
+                }
             }
             // Transform nodes
             serializationObject.transformNodes = [];

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 2
dist/preview release/babylon.worker.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 8678 - 8674
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 2
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 8 - 1
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -70798,6 +70798,10 @@ var BABYLON;
             this._identity = BABYLON.Matrix.Identity();
             this._ranges = {};
             this._lastAbsoluteTransformsUpdateId = -1;
+            /**
+             * Specifies if the skeleton should be serialized.
+             */
+            this.doNotSerialize = false;
             // Events
             /**
              * An event triggered before computing the skeleton's matrices
@@ -85373,7 +85377,10 @@ var BABYLON;
             // Skeletons
             serializationObject.skeletons = [];
             for (index = 0; index < scene.skeletons.length; index++) {
-                serializationObject.skeletons.push(scene.skeletons[index].serialize());
+                var skeleton = scene.skeletons[index];
+                if (!skeleton.doNotSerialize) {
+                    serializationObject.skeletons.push(skeleton.serialize());
+                }
             }
             // Transform nodes
             serializationObject.transformNodes = [];

+ 8 - 1
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -70784,6 +70784,10 @@ var BABYLON;
             this._identity = BABYLON.Matrix.Identity();
             this._ranges = {};
             this._lastAbsoluteTransformsUpdateId = -1;
+            /**
+             * Specifies if the skeleton should be serialized.
+             */
+            this.doNotSerialize = false;
             // Events
             /**
              * An event triggered before computing the skeleton's matrices
@@ -85359,7 +85363,10 @@ var BABYLON;
             // Skeletons
             serializationObject.skeletons = [];
             for (index = 0; index < scene.skeletons.length; index++) {
-                serializationObject.skeletons.push(scene.skeletons[index].serialize());
+                var skeleton = scene.skeletons[index];
+                if (!skeleton.doNotSerialize) {
+                    serializationObject.skeletons.push(skeleton.serialize());
+                }
             }
             // Transform nodes
             serializationObject.transformNodes = [];

+ 8 - 1
dist/preview release/es6.js

@@ -71208,6 +71208,10 @@ var BABYLON;
             this._identity = BABYLON.Matrix.Identity();
             this._ranges = {};
             this._lastAbsoluteTransformsUpdateId = -1;
+            /**
+             * Specifies if the skeleton should be serialized.
+             */
+            this.doNotSerialize = false;
             // Events
             /**
              * An event triggered before computing the skeleton's matrices
@@ -85783,7 +85787,10 @@ var BABYLON;
             // Skeletons
             serializationObject.skeletons = [];
             for (index = 0; index < scene.skeletons.length; index++) {
-                serializationObject.skeletons.push(scene.skeletons[index].serialize());
+                var skeleton = scene.skeletons[index];
+                if (!skeleton.doNotSerialize) {
+                    serializationObject.skeletons.push(skeleton.serialize());
+                }
             }
             // Transform nodes
             serializationObject.transformNodes = [];

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 9 - 9
dist/preview release/viewer/babylon.viewer.js


+ 5 - 0
src/Bones/babylon.skeleton.ts

@@ -18,6 +18,11 @@
 
         private _lastAbsoluteTransformsUpdateId = -1;
 
+        /**
+         * Specifies if the skeleton should be serialized.
+         */
+        public doNotSerialize = false;        
+
         // Events
         /**
          * An event triggered before computing the skeleton's matrices

+ 3 - 1
src/Mesh/babylon.buffer.ts

@@ -5,6 +5,7 @@
         private _data: Nullable<FloatArray>;
         private _updatable: boolean;
         private _strideSize: number;
+        private _instanced: boolean;
 
         constructor(engine: any, data: FloatArray, updatable: boolean, stride: number, postponeInternalCreation?: boolean, instanced: boolean = false) {
             if (engine instanceof Mesh) { // old versions of BABYLON.VertexBuffer accepted 'mesh' instead of 'engine'
@@ -15,6 +16,7 @@
             }
 
             this._updatable = updatable;
+            this._instanced = instanced;
 
             this._data = data;
 
@@ -36,7 +38,7 @@
          */
         public createVertexBuffer(kind: string, offset: number, size: number, stride?: number, instanced?: boolean): VertexBuffer {
             // a lot of these parameters are ignored as they are overriden by the buffer
-            return new VertexBuffer(this._engine, this, kind, this._updatable, true, stride ? stride : this._strideSize, instanced, offset, size);
+            return new VertexBuffer(this._engine, this, kind, this._updatable, true, stride ? stride : this._strideSize, instanced === undefined ? this._instanced : instanced, offset, size);
         }
 
         // Properties

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

@@ -217,7 +217,10 @@
             // Skeletons
             serializationObject.skeletons = [];
             for (index = 0; index < scene.skeletons.length; index++) {
-                serializationObject.skeletons.push(scene.skeletons[index].serialize());
+                let skeleton = scene.skeletons[index];
+                if (!skeleton.doNotSerialize) {
+                    serializationObject.skeletons.push(skeleton.serialize());
+                }
             }
 
             // Transform nodes