David Catuhe 7 年之前
父节点
当前提交
29a85b04f9

文件差异内容过多而无法显示
+ 8807 - 8762
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 38 - 38
dist/preview release/babylon.js


文件差异内容过多而无法显示
+ 146 - 21
dist/preview release/babylon.max.js


文件差异内容过多而无法显示
+ 38 - 38
dist/preview release/babylon.worker.js


文件差异内容过多而无法显示
+ 7755 - 7649
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


文件差异内容过多而无法显示
+ 48 - 48
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 128 - 32
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -1171,6 +1171,18 @@ var __extends = (this && this.__extends) || (function () {
             return this;
         };
         /**
+         * Sets a Color4 on a uniform variable
+         * @param uniformName defines the name of the variable
+         * @param color4 defines the value to be set
+         * @returns this effect.
+         */
+        Effect.prototype.setDirectColor4 = function (uniformName, color4) {
+            if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {
+                this._engine.setDirectColor4(this.getUniform(uniformName), color4);
+            }
+            return this;
+        };
+        /**
          * Resets the cache of effects.
          */
         Effect.ResetCache = function () {
@@ -10855,6 +10867,36 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Engine, "TEXTUREFORMAT_R32F", {
+            /**
+             * R32F
+             */
+            get: function () {
+                return Engine._TEXTUREFORMAT_R32F;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Engine, "TEXTUREFORMAT_RG32F", {
+            /**
+             * RG32F
+             */
+            get: function () {
+                return Engine._TEXTUREFORMAT_RG32F;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Engine, "TEXTUREFORMAT_RGB32F", {
+            /**
+             * RGB32F
+             */
+            get: function () {
+                return Engine._TEXTUREFORMAT_RGB32F;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Engine, "TEXTUREFORMAT_LUMINANCE_ALPHA", {
             get: function () {
                 return Engine._TEXTUREFORMAT_LUMINANCE_ALPHA;
@@ -12536,6 +12578,16 @@ var BABYLON;
                 return;
             this._gl.uniform4f(uniform, color3.r, color3.g, color3.b, alpha);
         };
+        /**
+         * Sets a Color4 on a uniform variable
+         * @param uniform defines the uniform location
+         * @param color4 defines the value to be set
+         */
+        Engine.prototype.setDirectColor4 = function (uniform, color4) {
+            if (!uniform)
+                return;
+            this._gl.uniform4f(uniform, color4.r, color4.g, color4.b, color4.a);
+        };
         // States
         Engine.prototype.setState = function (culling, zOffset, force, reverseSide) {
             if (zOffset === void 0) { zOffset = 0; }
@@ -12919,11 +12971,18 @@ var BABYLON;
                     internalFormat = this._gl.LUMINANCE_ALPHA;
                     break;
                 case Engine.TEXTUREFORMAT_RGB:
+                case Engine.TEXTUREFORMAT_RGB32F:
                     internalFormat = this._gl.RGB;
                     break;
                 case Engine.TEXTUREFORMAT_RGBA:
                     internalFormat = this._gl.RGBA;
                     break;
+                case Engine.TEXTUREFORMAT_R32F:
+                    internalFormat = this._gl.RED;
+                    break;
+                case Engine.TEXTUREFORMAT_RG32F:
+                    internalFormat = this._gl.RG;
+                    break;
             }
             return internalFormat;
         };
@@ -12933,8 +12992,8 @@ var BABYLON;
             if (!texture) {
                 return;
             }
+            var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format);
             var internalFormat = this._getInternalFormat(format);
-            var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
             var textureType = this._getWebGLTextureType(type);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);
             this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
@@ -14693,11 +14752,22 @@ var BABYLON;
             return this._gl.UNSIGNED_BYTE;
         };
         ;
-        Engine.prototype._getRGBABufferInternalSizedFormat = function (type) {
+        /** @ignore */
+        Engine.prototype._getRGBABufferInternalSizedFormat = function (type, format) {
             if (this._webGLVersion === 1) {
                 return this._gl.RGBA;
             }
             if (type === Engine.TEXTURETYPE_FLOAT) {
+                if (format) {
+                    switch (format) {
+                        case Engine.TEXTUREFORMAT_R32F:
+                            return this._gl.R32F;
+                        case Engine.TEXTUREFORMAT_RG32F:
+                            return this._gl.RG32F;
+                        case Engine.TEXTUREFORMAT_RGB32F:
+                            return this._gl.RGB32F;
+                    }
+                }
                 return this._gl.RGBA32F;
             }
             else if (type === Engine.TEXTURETYPE_HALF_FLOAT) {
@@ -14968,6 +15038,9 @@ var BABYLON;
         Engine._TEXTUREFORMAT_LUMINANCE_ALPHA = 2;
         Engine._TEXTUREFORMAT_RGB = 4;
         Engine._TEXTUREFORMAT_RGBA = 5;
+        Engine._TEXTUREFORMAT_R32F = 6;
+        Engine._TEXTUREFORMAT_RG32F = 7;
+        Engine._TEXTUREFORMAT_RGB32F = 8;
         Engine._TEXTURETYPE_UNSIGNED_INT = 0;
         Engine._TEXTURETYPE_FLOAT = 1;
         Engine._TEXTURETYPE_HALF_FLOAT = 2;
@@ -24403,10 +24476,10 @@ var BABYLON;
             var max = new BABYLON.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
             for (var index = 0; index < this.meshes.length; index++) {
                 var mesh = this.meshes[index];
+                mesh.computeWorldMatrix(true);
                 if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {
                     continue;
                 }
-                mesh.computeWorldMatrix(true);
                 var boundingInfo = mesh.getBoundingInfo();
                 var minBox = boundingInfo.boundingBox.minimumWorld;
                 var maxBox = boundingInfo.boundingBox.maximumWorld;
@@ -25291,12 +25364,19 @@ var BABYLON;
             if (!postponeInternalCreation) {
                 this.create();
             }
-            this._instanced = instanced;
-            this._instanceDivisor = instanced ? 1 : 0;
         }
-        Buffer.prototype.createVertexBuffer = function (kind, offset, size, stride) {
+        /**
+         * Create a new {BABYLON.VertexBuffer} based on the current buffer
+         * @param kind defines the vertex buffer kind (position, normal, etc.)
+         * @param offset defines offset in the buffer (0 by default)
+         * @param size defines the size in floats of attributes (position is 3 for instance)
+         * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)
+         * @param instanced defines if the vertex buffer contains indexed data
+         * @returns the new vertex buffer
+         */
+        Buffer.prototype.createVertexBuffer = function (kind, offset, size, stride, instanced) {
             // a lot of these parameters are ignored as they are overriden by the buffer
-            return new BABYLON.VertexBuffer(this._engine, this, kind, this._updatable, true, stride ? stride : this._strideSize, this._instanced, offset, size);
+            return new BABYLON.VertexBuffer(this._engine, this, kind, this._updatable, true, stride ? stride : this._strideSize, instanced, offset, size);
         };
         // Properties
         Buffer.prototype.isUpdatable = function () {
@@ -25311,25 +25391,20 @@ var BABYLON;
         Buffer.prototype.getStrideSize = function () {
             return this._strideSize;
         };
-        Buffer.prototype.getIsInstanced = function () {
-            return this._instanced;
-        };
-        Object.defineProperty(Buffer.prototype, "instanceDivisor", {
-            get: function () {
-                return this._instanceDivisor;
-            },
-            set: function (value) {
-                this._instanceDivisor = value;
-                if (value == 0) {
-                    this._instanced = false;
-                }
-                else {
-                    this._instanced = true;
-                }
-            },
-            enumerable: true,
-            configurable: true
-        });
+        // public getIsInstanced(): boolean {
+        //     return this._instanced;
+        // }
+        // public get instanceDivisor(): number {
+        //     return this._instanceDivisor;
+        // }
+        // public set instanceDivisor(value: number) {
+        //     this._instanceDivisor = value;
+        //     if (value == 0) {
+        //         this._instanced = false;
+        //     } else {
+        //         this._instanced = true;
+        //     }
+        // }
         // Methods
         Buffer.prototype.create = function (data) {
             if (data === void 0) { data = null; }
@@ -25389,9 +25464,6 @@ var BABYLON;
 (function (BABYLON) {
     var VertexBuffer = /** @class */ (function () {
         function VertexBuffer(engine, data, kind, updatable, postponeInternalCreation, stride, instanced, offset, size) {
-            if (!stride) {
-                stride = VertexBuffer.DeduceStride(kind);
-            }
             if (data instanceof BABYLON.Buffer) {
                 if (!stride) {
                     stride = data.getStrideSize();
@@ -25400,14 +25472,38 @@ var BABYLON;
                 this._ownsBuffer = false;
             }
             else {
+                if (!stride) {
+                    stride = VertexBuffer.DeduceStride(kind);
+                }
                 this._buffer = new BABYLON.Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced);
                 this._ownsBuffer = true;
             }
             this._stride = stride;
+            this._instanced = instanced !== undefined ? instanced : false;
+            this._instanceDivisor = instanced ? 1 : 0;
             this._offset = offset ? offset : 0;
             this._size = size ? size : stride;
             this._kind = kind;
         }
+        Object.defineProperty(VertexBuffer.prototype, "instanceDivisor", {
+            /**
+             * Gets or sets the instance divisor when in instanced mode
+             */
+            get: function () {
+                return this._instanceDivisor;
+            },
+            set: function (value) {
+                this._instanceDivisor = value;
+                if (value == 0) {
+                    this._instanced = false;
+                }
+                else {
+                    this._instanced = true;
+                }
+            },
+            enumerable: true,
+            configurable: true
+        });
         VertexBuffer.prototype._rebuild = function () {
             if (!this._buffer) {
                 return;
@@ -25461,13 +25557,13 @@ var BABYLON;
          * Boolean : is the WebGLBuffer of the VertexBuffer instanced now ?
          */
         VertexBuffer.prototype.getIsInstanced = function () {
-            return this._buffer.getIsInstanced();
+            return this._instanced;
         };
         /**
          * Returns the instancing divisor, zero for non-instanced (integer).
          */
         VertexBuffer.prototype.getInstanceDivisor = function () {
-            return this._buffer.instanceDivisor;
+            return this._instanceDivisor;
         };
         // Methods
         /**
@@ -50339,7 +50435,7 @@ var BABYLON;
              */
             this.emitter = null;
             /**
-             * The density of particles, the rate of particle flow
+             * The maximum number of particles to emit per frame
              */
             this.emitRate = 10;
             /**

+ 128 - 32
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -1157,6 +1157,18 @@ var BABYLON;
             return this;
         };
         /**
+         * Sets a Color4 on a uniform variable
+         * @param uniformName defines the name of the variable
+         * @param color4 defines the value to be set
+         * @returns this effect.
+         */
+        Effect.prototype.setDirectColor4 = function (uniformName, color4) {
+            if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {
+                this._engine.setDirectColor4(this.getUniform(uniformName), color4);
+            }
+            return this;
+        };
+        /**
          * Resets the cache of effects.
          */
         Effect.ResetCache = function () {
@@ -10841,6 +10853,36 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Engine, "TEXTUREFORMAT_R32F", {
+            /**
+             * R32F
+             */
+            get: function () {
+                return Engine._TEXTUREFORMAT_R32F;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Engine, "TEXTUREFORMAT_RG32F", {
+            /**
+             * RG32F
+             */
+            get: function () {
+                return Engine._TEXTUREFORMAT_RG32F;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Engine, "TEXTUREFORMAT_RGB32F", {
+            /**
+             * RGB32F
+             */
+            get: function () {
+                return Engine._TEXTUREFORMAT_RGB32F;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Engine, "TEXTUREFORMAT_LUMINANCE_ALPHA", {
             get: function () {
                 return Engine._TEXTUREFORMAT_LUMINANCE_ALPHA;
@@ -12522,6 +12564,16 @@ var BABYLON;
                 return;
             this._gl.uniform4f(uniform, color3.r, color3.g, color3.b, alpha);
         };
+        /**
+         * Sets a Color4 on a uniform variable
+         * @param uniform defines the uniform location
+         * @param color4 defines the value to be set
+         */
+        Engine.prototype.setDirectColor4 = function (uniform, color4) {
+            if (!uniform)
+                return;
+            this._gl.uniform4f(uniform, color4.r, color4.g, color4.b, color4.a);
+        };
         // States
         Engine.prototype.setState = function (culling, zOffset, force, reverseSide) {
             if (zOffset === void 0) { zOffset = 0; }
@@ -12905,11 +12957,18 @@ var BABYLON;
                     internalFormat = this._gl.LUMINANCE_ALPHA;
                     break;
                 case Engine.TEXTUREFORMAT_RGB:
+                case Engine.TEXTUREFORMAT_RGB32F:
                     internalFormat = this._gl.RGB;
                     break;
                 case Engine.TEXTUREFORMAT_RGBA:
                     internalFormat = this._gl.RGBA;
                     break;
+                case Engine.TEXTUREFORMAT_R32F:
+                    internalFormat = this._gl.RED;
+                    break;
+                case Engine.TEXTUREFORMAT_RG32F:
+                    internalFormat = this._gl.RG;
+                    break;
             }
             return internalFormat;
         };
@@ -12919,8 +12978,8 @@ var BABYLON;
             if (!texture) {
                 return;
             }
+            var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format);
             var internalFormat = this._getInternalFormat(format);
-            var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
             var textureType = this._getWebGLTextureType(type);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);
             this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
@@ -14679,11 +14738,22 @@ var BABYLON;
             return this._gl.UNSIGNED_BYTE;
         };
         ;
-        Engine.prototype._getRGBABufferInternalSizedFormat = function (type) {
+        /** @ignore */
+        Engine.prototype._getRGBABufferInternalSizedFormat = function (type, format) {
             if (this._webGLVersion === 1) {
                 return this._gl.RGBA;
             }
             if (type === Engine.TEXTURETYPE_FLOAT) {
+                if (format) {
+                    switch (format) {
+                        case Engine.TEXTUREFORMAT_R32F:
+                            return this._gl.R32F;
+                        case Engine.TEXTUREFORMAT_RG32F:
+                            return this._gl.RG32F;
+                        case Engine.TEXTUREFORMAT_RGB32F:
+                            return this._gl.RGB32F;
+                    }
+                }
                 return this._gl.RGBA32F;
             }
             else if (type === Engine.TEXTURETYPE_HALF_FLOAT) {
@@ -14954,6 +15024,9 @@ var BABYLON;
         Engine._TEXTUREFORMAT_LUMINANCE_ALPHA = 2;
         Engine._TEXTUREFORMAT_RGB = 4;
         Engine._TEXTUREFORMAT_RGBA = 5;
+        Engine._TEXTUREFORMAT_R32F = 6;
+        Engine._TEXTUREFORMAT_RG32F = 7;
+        Engine._TEXTUREFORMAT_RGB32F = 8;
         Engine._TEXTURETYPE_UNSIGNED_INT = 0;
         Engine._TEXTURETYPE_FLOAT = 1;
         Engine._TEXTURETYPE_HALF_FLOAT = 2;
@@ -24389,10 +24462,10 @@ var BABYLON;
             var max = new BABYLON.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
             for (var index = 0; index < this.meshes.length; index++) {
                 var mesh = this.meshes[index];
+                mesh.computeWorldMatrix(true);
                 if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {
                     continue;
                 }
-                mesh.computeWorldMatrix(true);
                 var boundingInfo = mesh.getBoundingInfo();
                 var minBox = boundingInfo.boundingBox.minimumWorld;
                 var maxBox = boundingInfo.boundingBox.maximumWorld;
@@ -25277,12 +25350,19 @@ var BABYLON;
             if (!postponeInternalCreation) {
                 this.create();
             }
-            this._instanced = instanced;
-            this._instanceDivisor = instanced ? 1 : 0;
         }
-        Buffer.prototype.createVertexBuffer = function (kind, offset, size, stride) {
+        /**
+         * Create a new {BABYLON.VertexBuffer} based on the current buffer
+         * @param kind defines the vertex buffer kind (position, normal, etc.)
+         * @param offset defines offset in the buffer (0 by default)
+         * @param size defines the size in floats of attributes (position is 3 for instance)
+         * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)
+         * @param instanced defines if the vertex buffer contains indexed data
+         * @returns the new vertex buffer
+         */
+        Buffer.prototype.createVertexBuffer = function (kind, offset, size, stride, instanced) {
             // a lot of these parameters are ignored as they are overriden by the buffer
-            return new BABYLON.VertexBuffer(this._engine, this, kind, this._updatable, true, stride ? stride : this._strideSize, this._instanced, offset, size);
+            return new BABYLON.VertexBuffer(this._engine, this, kind, this._updatable, true, stride ? stride : this._strideSize, instanced, offset, size);
         };
         // Properties
         Buffer.prototype.isUpdatable = function () {
@@ -25297,25 +25377,20 @@ var BABYLON;
         Buffer.prototype.getStrideSize = function () {
             return this._strideSize;
         };
-        Buffer.prototype.getIsInstanced = function () {
-            return this._instanced;
-        };
-        Object.defineProperty(Buffer.prototype, "instanceDivisor", {
-            get: function () {
-                return this._instanceDivisor;
-            },
-            set: function (value) {
-                this._instanceDivisor = value;
-                if (value == 0) {
-                    this._instanced = false;
-                }
-                else {
-                    this._instanced = true;
-                }
-            },
-            enumerable: true,
-            configurable: true
-        });
+        // public getIsInstanced(): boolean {
+        //     return this._instanced;
+        // }
+        // public get instanceDivisor(): number {
+        //     return this._instanceDivisor;
+        // }
+        // public set instanceDivisor(value: number) {
+        //     this._instanceDivisor = value;
+        //     if (value == 0) {
+        //         this._instanced = false;
+        //     } else {
+        //         this._instanced = true;
+        //     }
+        // }
         // Methods
         Buffer.prototype.create = function (data) {
             if (data === void 0) { data = null; }
@@ -25375,9 +25450,6 @@ var BABYLON;
 (function (BABYLON) {
     var VertexBuffer = /** @class */ (function () {
         function VertexBuffer(engine, data, kind, updatable, postponeInternalCreation, stride, instanced, offset, size) {
-            if (!stride) {
-                stride = VertexBuffer.DeduceStride(kind);
-            }
             if (data instanceof BABYLON.Buffer) {
                 if (!stride) {
                     stride = data.getStrideSize();
@@ -25386,14 +25458,38 @@ var BABYLON;
                 this._ownsBuffer = false;
             }
             else {
+                if (!stride) {
+                    stride = VertexBuffer.DeduceStride(kind);
+                }
                 this._buffer = new BABYLON.Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced);
                 this._ownsBuffer = true;
             }
             this._stride = stride;
+            this._instanced = instanced !== undefined ? instanced : false;
+            this._instanceDivisor = instanced ? 1 : 0;
             this._offset = offset ? offset : 0;
             this._size = size ? size : stride;
             this._kind = kind;
         }
+        Object.defineProperty(VertexBuffer.prototype, "instanceDivisor", {
+            /**
+             * Gets or sets the instance divisor when in instanced mode
+             */
+            get: function () {
+                return this._instanceDivisor;
+            },
+            set: function (value) {
+                this._instanceDivisor = value;
+                if (value == 0) {
+                    this._instanced = false;
+                }
+                else {
+                    this._instanced = true;
+                }
+            },
+            enumerable: true,
+            configurable: true
+        });
         VertexBuffer.prototype._rebuild = function () {
             if (!this._buffer) {
                 return;
@@ -25447,13 +25543,13 @@ var BABYLON;
          * Boolean : is the WebGLBuffer of the VertexBuffer instanced now ?
          */
         VertexBuffer.prototype.getIsInstanced = function () {
-            return this._buffer.getIsInstanced();
+            return this._instanced;
         };
         /**
          * Returns the instancing divisor, zero for non-instanced (integer).
          */
         VertexBuffer.prototype.getInstanceDivisor = function () {
-            return this._buffer.instanceDivisor;
+            return this._instanceDivisor;
         };
         // Methods
         /**
@@ -50325,7 +50421,7 @@ var BABYLON;
              */
             this.emitter = null;
             /**
-             * The density of particles, the rate of particle flow
+             * The maximum number of particles to emit per frame
              */
             this.emitRate = 10;
             /**

文件差异内容过多而无法显示
+ 146 - 21
dist/preview release/es6.js


文件差异内容过多而无法显示
+ 55 - 55
dist/preview release/viewer/babylon.viewer.js