Browse Source

Associated with #3432

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

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


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


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


+ 26 - 3
dist/preview release/babylon.max.js

@@ -8681,7 +8681,7 @@ var BABYLON;
         });
         Object.defineProperty(Engine, "Version", {
             get: function () {
-                return "3.2.0-alpha0";
+                return "3.2.0-alpha1";
             },
             enumerable: true,
             configurable: true
@@ -10201,6 +10201,11 @@ var BABYLON;
                 return;
             this._gl.uniformMatrix2fv(uniform, false, matrix);
         };
+        Engine.prototype.setInt = function (uniform, value) {
+            if (!uniform)
+                return;
+            this._gl.uniform1i(uniform, value);
+        };
         Engine.prototype.setFloat = function (uniform, value) {
             if (!uniform)
                 return;
@@ -21811,7 +21816,7 @@ var BABYLON;
                     camera = freeCamera;
                 }
                 camera.minZ = radius * 0.01;
-                camera.maxZ = radius * 100;
+                camera.maxZ = radius * 1000;
                 camera.speed = radius * 0.2;
                 this.activeCamera = camera;
                 var canvas = this.getEngine().getRenderingCanvas();
@@ -27313,6 +27318,14 @@ var BABYLON;
         Effect.prototype.bindUniformBlock = function (blockName, index) {
             this._engine.bindUniformBlock(this._program, blockName, index);
         };
+        Effect.prototype.setInt = function (uniformName, value) {
+            var cache = this._valueCache[uniformName];
+            if (cache !== undefined && cache === value)
+                return this;
+            this._valueCache[uniformName] = value;
+            this._engine.setInt(this.getUniform(uniformName), value);
+            return this;
+        };
         Effect.prototype.setIntArray = function (uniformName, array) {
             this._valueCache[uniformName] = null;
             this._engine.setIntArray(this.getUniform(uniformName), array);
@@ -48306,6 +48319,7 @@ var BABYLON;
             _this._textures = {};
             _this._textureArrays = {};
             _this._floats = {};
+            _this._ints = {};
             _this._floatsArrays = {};
             _this._colors3 = {};
             _this._colors3Arrays = {};
@@ -48364,6 +48378,11 @@ var BABYLON;
             this._floats[name] = value;
             return this;
         };
+        ShaderMaterial.prototype.setInt = function (name, value) {
+            this._checkUniform(name);
+            this._ints[name] = value;
+            return this;
+        };
         ShaderMaterial.prototype.setFloats = function (name, value) {
             this._checkUniform(name);
             this._floatsArrays[name] = value;
@@ -48553,10 +48572,14 @@ var BABYLON;
                     this._effect.setTextureArray(name, this._textureArrays[name]);
                 }
                 // Float    
+                for (name in this._ints) {
+                    this._effect.setIntArray(name, this._ints[name]);
+                }
+                // Float    
                 for (name in this._floats) {
                     this._effect.setFloat(name, this._floats[name]);
                 }
-                // Float s   
+                // Floats   
                 for (name in this._floatsArrays) {
                     this._effect.setArray(name, this._floatsArrays[name]);
                 }

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


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


+ 26 - 3
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -8681,7 +8681,7 @@ var BABYLON;
         });
         Object.defineProperty(Engine, "Version", {
             get: function () {
-                return "3.2.0-alpha0";
+                return "3.2.0-alpha1";
             },
             enumerable: true,
             configurable: true
@@ -10201,6 +10201,11 @@ var BABYLON;
                 return;
             this._gl.uniformMatrix2fv(uniform, false, matrix);
         };
+        Engine.prototype.setInt = function (uniform, value) {
+            if (!uniform)
+                return;
+            this._gl.uniform1i(uniform, value);
+        };
         Engine.prototype.setFloat = function (uniform, value) {
             if (!uniform)
                 return;
@@ -21811,7 +21816,7 @@ var BABYLON;
                     camera = freeCamera;
                 }
                 camera.minZ = radius * 0.01;
-                camera.maxZ = radius * 100;
+                camera.maxZ = radius * 1000;
                 camera.speed = radius * 0.2;
                 this.activeCamera = camera;
                 var canvas = this.getEngine().getRenderingCanvas();
@@ -27313,6 +27318,14 @@ var BABYLON;
         Effect.prototype.bindUniformBlock = function (blockName, index) {
             this._engine.bindUniformBlock(this._program, blockName, index);
         };
+        Effect.prototype.setInt = function (uniformName, value) {
+            var cache = this._valueCache[uniformName];
+            if (cache !== undefined && cache === value)
+                return this;
+            this._valueCache[uniformName] = value;
+            this._engine.setInt(this.getUniform(uniformName), value);
+            return this;
+        };
         Effect.prototype.setIntArray = function (uniformName, array) {
             this._valueCache[uniformName] = null;
             this._engine.setIntArray(this.getUniform(uniformName), array);
@@ -48152,6 +48165,7 @@ var BABYLON;
             _this._textures = {};
             _this._textureArrays = {};
             _this._floats = {};
+            _this._ints = {};
             _this._floatsArrays = {};
             _this._colors3 = {};
             _this._colors3Arrays = {};
@@ -48210,6 +48224,11 @@ var BABYLON;
             this._floats[name] = value;
             return this;
         };
+        ShaderMaterial.prototype.setInt = function (name, value) {
+            this._checkUniform(name);
+            this._ints[name] = value;
+            return this;
+        };
         ShaderMaterial.prototype.setFloats = function (name, value) {
             this._checkUniform(name);
             this._floatsArrays[name] = value;
@@ -48399,10 +48418,14 @@ var BABYLON;
                     this._effect.setTextureArray(name, this._textureArrays[name]);
                 }
                 // Float    
+                for (name in this._ints) {
+                    this._effect.setIntArray(name, this._ints[name]);
+                }
+                // Float    
                 for (name in this._floats) {
                     this._effect.setFloat(name, this._floats[name]);
                 }
-                // Float s   
+                // Floats   
                 for (name in this._floatsArrays) {
                     this._effect.setArray(name, this._floatsArrays[name]);
                 }

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


+ 8 - 1
src/Engine/babylon.engine.ts

@@ -566,7 +566,7 @@
         }
 
         public static get Version(): string {
-            return "3.2.0-alpha0";
+            return "3.2.0-alpha1";
         }
 
         // Updatable statics so stick with vars here
@@ -2778,6 +2778,13 @@
             this._gl.uniformMatrix2fv(uniform, false, matrix);
         }
 
+        public setInt(uniform: Nullable<WebGLUniformLocation>, value: number): void {
+            if (!uniform)
+                return;
+
+            this._gl.uniform1i(uniform, value);
+        }
+
         public setFloat(uniform: Nullable<WebGLUniformLocation>, value: number): void {
             if (!uniform)
                 return;

+ 12 - 0
src/Materials/babylon.effect.ts

@@ -769,6 +769,18 @@
             this._engine.bindUniformBlock(this._program, blockName, index);
         }
 
+        public setInt(uniformName: string, value: number): Effect {
+            var cache = this._valueCache[uniformName];
+            if (cache !== undefined && cache === value)
+                return this;
+
+            this._valueCache[uniformName] = value;
+
+            this._engine.setInt(this.getUniform(uniformName), value);
+
+            return this;
+        }
+
         public setIntArray(uniformName: string, array: Int32Array): Effect {
             this._valueCache[uniformName] = null;
             this._engine.setIntArray(this.getUniform(uniformName), array);

+ 14 - 1
src/Materials/babylon.shaderMaterial.ts

@@ -5,6 +5,7 @@
         private _textures: { [name: string]: Texture } = {};
         private _textureArrays: { [name: string]: Texture[] } = {};
         private _floats: { [name: string]: number } = {};
+        private _ints: { [name: string]: number } = {};
         private _floatsArrays: { [name: string]: number[] } = {};
         private _colors3: { [name: string]: Color3 } = {};
         private _colors3Arrays: { [name: string]: number[] } = {};
@@ -81,6 +82,13 @@
             return this;
         }
 
+        public setInt(name: string, value: number): ShaderMaterial {
+            this._checkUniform(name);
+            this._ints[name] = value;
+
+            return this;
+        }
+
         public setFloats(name: string, value: number[]): ShaderMaterial {
             this._checkUniform(name);
             this._floatsArrays[name] = value;
@@ -323,11 +331,16 @@
                 }
 
                 // Float    
+                for (name in this._ints) {
+                    this._effect.setIntArray(name, this._ints[name]);
+                }
+
+                // Float    
                 for (name in this._floats) {
                     this._effect.setFloat(name, this._floats[name]);
                 }
 
-                // Float s   
+                // Floats   
                 for (name in this._floatsArrays) {
                     this._effect.setArray(name, this._floatsArrays[name]);
                 }