Sebastien Vandenberghe преди 7 години
родител
ревизия
aa7dd66f66

Файловите разлики са ограничени, защото са твърде много
+ 4940 - 4940
Playground/babylon.d.txt


Файловите разлики са ограничени, защото са твърде много
+ 4941 - 4941
dist/preview release/babylon.d.ts


Файловите разлики са ограничени, защото са твърде много
+ 37 - 37
dist/preview release/babylon.js


+ 36 - 6
dist/preview release/babylon.max.js

@@ -14067,11 +14067,16 @@ var BABYLON;
             if (defines === void 0) { defines = ""; }
             var attributesNamesOrOptions = BABYLON.ParticleSystem._GetAttributeNamesOrOptions();
             var effectCreationOption = BABYLON.ParticleSystem._GetEffectCreationOptions();
-            defines += "\n#define BILLBOARD\n";
+            if (defines.indexOf(" BILLBOARD") === -1) {
+                defines += "\n#define BILLBOARD\n";
+            }
+            if (samplers.indexOf("diffuseSampler") === -1) {
+                samplers.push("diffuseSampler");
+            }
             return this.createEffect({
                 vertex: "particles",
                 fragmentElement: fragmentName
-            }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), ["diffuseSampler"].concat(samplers), defines, fallbacks, onCompiled, onError);
+            }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), samplers, defines, fallbacks, onCompiled, onError);
         };
         /**
          * Directly creates a webGL program
@@ -36956,6 +36961,7 @@ var BABYLON;
          * @returns the VertexData
          */
         VertexData.prototype.transform = function (matrix) {
+            var flip = matrix.m[0] * matrix.m[5] * matrix.m[10] < 0;
             var transformed = BABYLON.Vector3.Zero();
             var index;
             if (this.positions) {
@@ -36990,6 +36996,13 @@ var BABYLON;
                     this.tangents[index + 3] = tangentTransformed.w;
                 }
             }
+            if (flip && this.indices) {
+                for (index = 0; index < this.indices.length; index += 3) {
+                    var tmp = this.indices[index + 1];
+                    this.indices[index + 1] = this.indices[index + 2];
+                    this.indices[index + 2] = tmp;
+                }
+            }
             return this;
         };
         /**
@@ -54136,9 +54149,19 @@ var BABYLON;
                 result = BABYLON.Vector3.Cross(p1p2, p3p2);
             }
             if (useWorldCoordinates) {
-                result = BABYLON.Vector3.TransformNormal(result, this.pickedMesh.getWorldMatrix());
+                var wm = this.pickedMesh.getWorldMatrix();
+                if (this.pickedMesh.nonUniformScaling) {
+                    BABYLON.Tmp.Matrix[0].copyFrom(wm);
+                    wm = BABYLON.Tmp.Matrix[0];
+                    wm.setTranslationFromFloats(0, 0, 0);
+                    wm.invert();
+                    wm.transposeToRef(BABYLON.Tmp.Matrix[1]);
+                    wm = BABYLON.Tmp.Matrix[1];
+                }
+                result = BABYLON.Vector3.TransformNormal(result, wm);
             }
-            return BABYLON.Vector3.Normalize(result);
+            result.normalize();
+            return result;
         };
         /**
          * Gets the texture coordinates of where the pick occured
@@ -56342,6 +56365,9 @@ var BABYLON;
                 var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
                 custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
             }
+            else if (this._customEffect) {
+                custom = this._customEffect;
+            }
             var result = new ParticleSystem(name, this._capacity, this._scene, custom);
             result.customShader = program;
             BABYLON.Tools.DeepCopy(this, result, ["particles", "customShader"]);
@@ -56519,8 +56545,8 @@ var BABYLON;
                 }
             }
             // Emitter
+            var emitterType;
             if (parsedParticleSystem.particleEmitterType) {
-                var emitterType = void 0;
                 switch (parsedParticleSystem.particleEmitterType.type) {
                     case "SphereEmitter":
                         emitterType = new BABYLON.SphereParticleEmitter();
@@ -56537,8 +56563,12 @@ var BABYLON;
                         break;
                 }
                 emitterType.parse(parsedParticleSystem.particleEmitterType);
-                particleSystem.particleEmitterType = emitterType;
             }
+            else {
+                emitterType = new BABYLON.BoxParticleEmitter();
+                emitterType.parse(parsedParticleSystem);
+            }
+            particleSystem.particleEmitterType = emitterType;
         };
         /**
          * Parses a JSON object to create a particle system.

+ 36 - 6
dist/preview release/babylon.no-module.max.js

@@ -14034,11 +14034,16 @@ var BABYLON;
             if (defines === void 0) { defines = ""; }
             var attributesNamesOrOptions = BABYLON.ParticleSystem._GetAttributeNamesOrOptions();
             var effectCreationOption = BABYLON.ParticleSystem._GetEffectCreationOptions();
-            defines += "\n#define BILLBOARD\n";
+            if (defines.indexOf(" BILLBOARD") === -1) {
+                defines += "\n#define BILLBOARD\n";
+            }
+            if (samplers.indexOf("diffuseSampler") === -1) {
+                samplers.push("diffuseSampler");
+            }
             return this.createEffect({
                 vertex: "particles",
                 fragmentElement: fragmentName
-            }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), ["diffuseSampler"].concat(samplers), defines, fallbacks, onCompiled, onError);
+            }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), samplers, defines, fallbacks, onCompiled, onError);
         };
         /**
          * Directly creates a webGL program
@@ -36923,6 +36928,7 @@ var BABYLON;
          * @returns the VertexData
          */
         VertexData.prototype.transform = function (matrix) {
+            var flip = matrix.m[0] * matrix.m[5] * matrix.m[10] < 0;
             var transformed = BABYLON.Vector3.Zero();
             var index;
             if (this.positions) {
@@ -36957,6 +36963,13 @@ var BABYLON;
                     this.tangents[index + 3] = tangentTransformed.w;
                 }
             }
+            if (flip && this.indices) {
+                for (index = 0; index < this.indices.length; index += 3) {
+                    var tmp = this.indices[index + 1];
+                    this.indices[index + 1] = this.indices[index + 2];
+                    this.indices[index + 2] = tmp;
+                }
+            }
             return this;
         };
         /**
@@ -54103,9 +54116,19 @@ var BABYLON;
                 result = BABYLON.Vector3.Cross(p1p2, p3p2);
             }
             if (useWorldCoordinates) {
-                result = BABYLON.Vector3.TransformNormal(result, this.pickedMesh.getWorldMatrix());
+                var wm = this.pickedMesh.getWorldMatrix();
+                if (this.pickedMesh.nonUniformScaling) {
+                    BABYLON.Tmp.Matrix[0].copyFrom(wm);
+                    wm = BABYLON.Tmp.Matrix[0];
+                    wm.setTranslationFromFloats(0, 0, 0);
+                    wm.invert();
+                    wm.transposeToRef(BABYLON.Tmp.Matrix[1]);
+                    wm = BABYLON.Tmp.Matrix[1];
+                }
+                result = BABYLON.Vector3.TransformNormal(result, wm);
             }
-            return BABYLON.Vector3.Normalize(result);
+            result.normalize();
+            return result;
         };
         /**
          * Gets the texture coordinates of where the pick occured
@@ -56309,6 +56332,9 @@ var BABYLON;
                 var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
                 custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
             }
+            else if (this._customEffect) {
+                custom = this._customEffect;
+            }
             var result = new ParticleSystem(name, this._capacity, this._scene, custom);
             result.customShader = program;
             BABYLON.Tools.DeepCopy(this, result, ["particles", "customShader"]);
@@ -56486,8 +56512,8 @@ var BABYLON;
                 }
             }
             // Emitter
+            var emitterType;
             if (parsedParticleSystem.particleEmitterType) {
-                var emitterType = void 0;
                 switch (parsedParticleSystem.particleEmitterType.type) {
                     case "SphereEmitter":
                         emitterType = new BABYLON.SphereParticleEmitter();
@@ -56504,8 +56530,12 @@ var BABYLON;
                         break;
                 }
                 emitterType.parse(parsedParticleSystem.particleEmitterType);
-                particleSystem.particleEmitterType = emitterType;
             }
+            else {
+                emitterType = new BABYLON.BoxParticleEmitter();
+                emitterType.parse(parsedParticleSystem);
+            }
+            particleSystem.particleEmitterType = emitterType;
         };
         /**
          * Parses a JSON object to create a particle system.

Файловите разлики са ограничени, защото са твърде много
+ 37 - 37
dist/preview release/babylon.worker.js


+ 36 - 6
dist/preview release/es6.js

@@ -14034,11 +14034,16 @@ var BABYLON;
             if (defines === void 0) { defines = ""; }
             var attributesNamesOrOptions = BABYLON.ParticleSystem._GetAttributeNamesOrOptions();
             var effectCreationOption = BABYLON.ParticleSystem._GetEffectCreationOptions();
-            defines += "\n#define BILLBOARD\n";
+            if (defines.indexOf(" BILLBOARD") === -1) {
+                defines += "\n#define BILLBOARD\n";
+            }
+            if (samplers.indexOf("diffuseSampler") === -1) {
+                samplers.push("diffuseSampler");
+            }
             return this.createEffect({
                 vertex: "particles",
                 fragmentElement: fragmentName
-            }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), ["diffuseSampler"].concat(samplers), defines, fallbacks, onCompiled, onError);
+            }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), samplers, defines, fallbacks, onCompiled, onError);
         };
         /**
          * Directly creates a webGL program
@@ -36923,6 +36928,7 @@ var BABYLON;
          * @returns the VertexData
          */
         VertexData.prototype.transform = function (matrix) {
+            var flip = matrix.m[0] * matrix.m[5] * matrix.m[10] < 0;
             var transformed = BABYLON.Vector3.Zero();
             var index;
             if (this.positions) {
@@ -36957,6 +36963,13 @@ var BABYLON;
                     this.tangents[index + 3] = tangentTransformed.w;
                 }
             }
+            if (flip && this.indices) {
+                for (index = 0; index < this.indices.length; index += 3) {
+                    var tmp = this.indices[index + 1];
+                    this.indices[index + 1] = this.indices[index + 2];
+                    this.indices[index + 2] = tmp;
+                }
+            }
             return this;
         };
         /**
@@ -54103,9 +54116,19 @@ var BABYLON;
                 result = BABYLON.Vector3.Cross(p1p2, p3p2);
             }
             if (useWorldCoordinates) {
-                result = BABYLON.Vector3.TransformNormal(result, this.pickedMesh.getWorldMatrix());
+                var wm = this.pickedMesh.getWorldMatrix();
+                if (this.pickedMesh.nonUniformScaling) {
+                    BABYLON.Tmp.Matrix[0].copyFrom(wm);
+                    wm = BABYLON.Tmp.Matrix[0];
+                    wm.setTranslationFromFloats(0, 0, 0);
+                    wm.invert();
+                    wm.transposeToRef(BABYLON.Tmp.Matrix[1]);
+                    wm = BABYLON.Tmp.Matrix[1];
+                }
+                result = BABYLON.Vector3.TransformNormal(result, wm);
             }
-            return BABYLON.Vector3.Normalize(result);
+            result.normalize();
+            return result;
         };
         /**
          * Gets the texture coordinates of where the pick occured
@@ -56309,6 +56332,9 @@ var BABYLON;
                 var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
                 custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
             }
+            else if (this._customEffect) {
+                custom = this._customEffect;
+            }
             var result = new ParticleSystem(name, this._capacity, this._scene, custom);
             result.customShader = program;
             BABYLON.Tools.DeepCopy(this, result, ["particles", "customShader"]);
@@ -56486,8 +56512,8 @@ var BABYLON;
                 }
             }
             // Emitter
+            var emitterType;
             if (parsedParticleSystem.particleEmitterType) {
-                var emitterType = void 0;
                 switch (parsedParticleSystem.particleEmitterType.type) {
                     case "SphereEmitter":
                         emitterType = new BABYLON.SphereParticleEmitter();
@@ -56504,8 +56530,12 @@ var BABYLON;
                         break;
                 }
                 emitterType.parse(parsedParticleSystem.particleEmitterType);
-                particleSystem.particleEmitterType = emitterType;
             }
+            else {
+                emitterType = new BABYLON.BoxParticleEmitter();
+                emitterType.parse(parsedParticleSystem);
+            }
+            particleSystem.particleEmitterType = emitterType;
         };
         /**
          * Parses a JSON object to create a particle system.

Файловите разлики са ограничени, защото са твърде много
+ 50 - 50
dist/preview release/viewer/babylon.viewer.js


Файловите разлики са ограничени, защото са твърде много
+ 106 - 54
dist/preview release/viewer/babylon.viewer.max.js