Browse Source

New Smoke effect

David Catuhe 7 years ago
parent
commit
09ebc45315

+ 161 - 0
assets/particles/systems/smoke.json

@@ -0,0 +1,161 @@
+{
+    "systems":
+    [
+        {
+            "name": "default system",
+            "id": "default system",
+            "capacity": 500,
+            "emitter":
+            [
+                0,
+                0,
+                0
+            ],
+            "particleEmitterType":
+            {
+                "type": "ConeParticleEmitter",
+                "radius": 0.1,
+                "angle": 0.6,
+                "directionRandomizer": 0
+            },
+            "textureName": "smoke/Smoke_SpriteSheet_8x8.png",
+            "animations": [],
+            "startDelay": 0,
+            "renderingGroupId": 0,
+            "isBillboardBased": true,
+            "minAngularSpeed": 0,
+            "maxAngularSpeed": 0,
+            "minSize": 3,
+            "maxSize": 5,
+            "minScaleX": 1,
+            "maxScaleX": 1,
+            "minScaleY": 1,
+            "maxScaleY": 1,
+            "minEmitPower": 1.2,
+            "maxEmitPower": 1.4,
+            "minLifeTime": 10,
+            "maxLifeTime": 11,
+            "emitRate": 30,
+            "gravity":
+            [
+                0.1,
+                0,
+                0.05
+            ],
+            "noiseStrength":
+            [
+                0.2,
+                0,
+                0.15
+            ],
+            "color1":
+            [
+                1,
+                1,
+                1,
+                1
+            ],
+            "color2":
+            [
+                1,
+                1,
+                1,
+                1
+            ],
+            "colorDead":
+            [
+                1,
+                1,
+                1,
+                0
+            ],
+            "updateSpeed": 0.016666666666666666,
+            "targetStopDuration": 0,
+            "blendMode": 1,
+            "preWarmCycles": 0,
+            "preWarmStepOffset": 1,
+            "minInitialRotation": -0.7,
+            "maxInitialRotation": 0.7,
+            "startSpriteCellID": 0,
+            "endSpriteCellID": 63,
+            "spriteCellChangeSpeed": 2.5,
+            "spriteCellWidth": 128,
+            "spriteCellHeight": 128,
+            "spriteRandomStartCell": true,
+            "colorGradients":
+            [
+                {
+                    "gradient": 0,
+                    "color1":
+                    [
+                        0.5,
+                        0.5,
+                        0.5,
+                        0
+                    ]
+                },
+                {
+                    "gradient": 0.3,
+                    "color1":
+                    [
+                        0.3,
+                        0.3,
+                        0.3,
+                        0.5
+                    ]
+                },
+                {
+                    "gradient": 0.7,
+                    "color1":
+                    [
+                        0.2,
+                        0.2,
+                        0.2,
+                        0.3
+                    ]
+                },
+                {
+                    "gradient": 1,
+                    "color1":
+                    [
+                        0.1,
+                        0.1,
+                        0.1,
+                        0
+                    ]
+                }
+            ],
+            "sizeGradients":
+            [
+                {
+                    "gradient": 0,
+                    "factor1": 1
+                },
+                {
+                    "gradient": 1,
+                    "factor1": 6
+                }
+            ],
+            "noiseTexture":
+            {
+                "customType": "BABYLON.NoiseProceduralTexture",
+                "brightness": 0.5,
+                "octaves": 4,
+                "persistence": 0.2,
+                "animationSpeedFactor": 5,
+                "size": 256,
+                "generateMipMaps": true
+            },
+            "textureMask":
+            [
+                1,
+                1,
+                1,
+                1
+            ],
+            "customShader": null,
+            "preventAutoStart": false,
+            "isAnimationSheetEnabled": true
+        }
+    ]
+}

+ 2 - 2
assets/particles/systems/sun.json

@@ -13,8 +13,8 @@
   },
   "systems": [
     {
-      "name": "surfaceParticles",
-      "id": "surfaceParticles",
+      "name": "sunSystem",
+      "id": "sunSystem",
       "capacity": 1600,
       "renderingGroupId": 3,
       "isBillboardBased": false,

BIN
assets/particles/textures/smoke/Smoke_SpriteSheet_8x8.png


File diff suppressed because it is too large
+ 4574 - 4574
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.js


+ 14 - 2
dist/preview release/babylon.max.js

@@ -59122,6 +59122,7 @@ var BABYLON;
             serializationObject.spriteCellChangeSpeed = particleSystem.spriteCellChangeSpeed;
             serializationObject.spriteCellWidth = particleSystem.spriteCellWidth;
             serializationObject.spriteCellHeight = particleSystem.spriteCellHeight;
+            serializationObject.spriteRandomStartCell = particleSystem.spriteRandomStartCell;
             var colorGradients = particleSystem.getColorGradients();
             if (colorGradients) {
                 serializationObject.colorGradients = [];
@@ -59467,6 +59468,7 @@ var BABYLON;
             particleSystem.spriteCellWidth = parsedParticleSystem.spriteCellWidth;
             particleSystem.spriteCellHeight = parsedParticleSystem.spriteCellHeight;
             particleSystem.spriteCellChangeSpeed = parsedParticleSystem.spriteCellChangeSpeed;
+            particleSystem.spriteRandomStartCell = parsedParticleSystem.spriteRandomStartCell;
         };
         /**
          * Parses a JSON object to create a particle system.
@@ -112342,8 +112344,14 @@ var BABYLON;
          * @returns a serialized noise procedural texture object
          */
         NoiseProceduralTexture.prototype.serialize = function () {
-            var serializationObject = BABYLON.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
+            var serializationObject = {};
             serializationObject.customType = "BABYLON.NoiseProceduralTexture";
+            serializationObject.brightness = this.brightness;
+            serializationObject.octaves = this.octaves;
+            serializationObject.persistence = this.persistence;
+            serializationObject.animationSpeedFactor = this.animationSpeedFactor;
+            serializationObject.size = this.getSize().width;
+            serializationObject.generateMipMaps = this._generateMipMaps;
             return serializationObject;
         };
         /**
@@ -112354,7 +112362,11 @@ var BABYLON;
          * @returns a parsed NoiseProceduralTexture
          */
         NoiseProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
-            var texture = BABYLON.SerializationHelper.Parse(function () { return new NoiseProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
+            var texture = new NoiseProceduralTexture(parsedTexture.name, parsedTexture.size, scene, undefined, parsedTexture.generateMipMaps);
+            texture.brightness = parsedTexture.brightness;
+            texture.octaves = parsedTexture.octaves;
+            texture.persistence = parsedTexture.persistence;
+            texture.animationSpeedFactor = parsedTexture.animationSpeedFactor;
             return texture;
         };
         return NoiseProceduralTexture;

+ 14 - 2
dist/preview release/babylon.no-module.max.js

@@ -59089,6 +59089,7 @@ var BABYLON;
             serializationObject.spriteCellChangeSpeed = particleSystem.spriteCellChangeSpeed;
             serializationObject.spriteCellWidth = particleSystem.spriteCellWidth;
             serializationObject.spriteCellHeight = particleSystem.spriteCellHeight;
+            serializationObject.spriteRandomStartCell = particleSystem.spriteRandomStartCell;
             var colorGradients = particleSystem.getColorGradients();
             if (colorGradients) {
                 serializationObject.colorGradients = [];
@@ -59434,6 +59435,7 @@ var BABYLON;
             particleSystem.spriteCellWidth = parsedParticleSystem.spriteCellWidth;
             particleSystem.spriteCellHeight = parsedParticleSystem.spriteCellHeight;
             particleSystem.spriteCellChangeSpeed = parsedParticleSystem.spriteCellChangeSpeed;
+            particleSystem.spriteRandomStartCell = parsedParticleSystem.spriteRandomStartCell;
         };
         /**
          * Parses a JSON object to create a particle system.
@@ -112309,8 +112311,14 @@ var BABYLON;
          * @returns a serialized noise procedural texture object
          */
         NoiseProceduralTexture.prototype.serialize = function () {
-            var serializationObject = BABYLON.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
+            var serializationObject = {};
             serializationObject.customType = "BABYLON.NoiseProceduralTexture";
+            serializationObject.brightness = this.brightness;
+            serializationObject.octaves = this.octaves;
+            serializationObject.persistence = this.persistence;
+            serializationObject.animationSpeedFactor = this.animationSpeedFactor;
+            serializationObject.size = this.getSize().width;
+            serializationObject.generateMipMaps = this._generateMipMaps;
             return serializationObject;
         };
         /**
@@ -112321,7 +112329,11 @@ var BABYLON;
          * @returns a parsed NoiseProceduralTexture
          */
         NoiseProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
-            var texture = BABYLON.SerializationHelper.Parse(function () { return new NoiseProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
+            var texture = new NoiseProceduralTexture(parsedTexture.name, parsedTexture.size, scene, undefined, parsedTexture.generateMipMaps);
+            texture.brightness = parsedTexture.brightness;
+            texture.octaves = parsedTexture.octaves;
+            texture.persistence = parsedTexture.persistence;
+            texture.animationSpeedFactor = parsedTexture.animationSpeedFactor;
             return texture;
         };
         return NoiseProceduralTexture;

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.worker.js


+ 14 - 2
dist/preview release/es6.js

@@ -59089,6 +59089,7 @@ var BABYLON;
             serializationObject.spriteCellChangeSpeed = particleSystem.spriteCellChangeSpeed;
             serializationObject.spriteCellWidth = particleSystem.spriteCellWidth;
             serializationObject.spriteCellHeight = particleSystem.spriteCellHeight;
+            serializationObject.spriteRandomStartCell = particleSystem.spriteRandomStartCell;
             var colorGradients = particleSystem.getColorGradients();
             if (colorGradients) {
                 serializationObject.colorGradients = [];
@@ -59434,6 +59435,7 @@ var BABYLON;
             particleSystem.spriteCellWidth = parsedParticleSystem.spriteCellWidth;
             particleSystem.spriteCellHeight = parsedParticleSystem.spriteCellHeight;
             particleSystem.spriteCellChangeSpeed = parsedParticleSystem.spriteCellChangeSpeed;
+            particleSystem.spriteRandomStartCell = parsedParticleSystem.spriteRandomStartCell;
         };
         /**
          * Parses a JSON object to create a particle system.
@@ -112309,8 +112311,14 @@ var BABYLON;
          * @returns a serialized noise procedural texture object
          */
         NoiseProceduralTexture.prototype.serialize = function () {
-            var serializationObject = BABYLON.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
+            var serializationObject = {};
             serializationObject.customType = "BABYLON.NoiseProceduralTexture";
+            serializationObject.brightness = this.brightness;
+            serializationObject.octaves = this.octaves;
+            serializationObject.persistence = this.persistence;
+            serializationObject.animationSpeedFactor = this.animationSpeedFactor;
+            serializationObject.size = this.getSize().width;
+            serializationObject.generateMipMaps = this._generateMipMaps;
             return serializationObject;
         };
         /**
@@ -112321,7 +112329,11 @@ var BABYLON;
          * @returns a parsed NoiseProceduralTexture
          */
         NoiseProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
-            var texture = BABYLON.SerializationHelper.Parse(function () { return new NoiseProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
+            var texture = new NoiseProceduralTexture(parsedTexture.name, parsedTexture.size, scene, undefined, parsedTexture.generateMipMaps);
+            texture.brightness = parsedTexture.brightness;
+            texture.octaves = parsedTexture.octaves;
+            texture.persistence = parsedTexture.persistence;
+            texture.animationSpeedFactor = parsedTexture.animationSpeedFactor;
             return texture;
         };
         return NoiseProceduralTexture;

+ 4 - 4
dist/preview release/viewer/babylon.viewer.d.ts

@@ -168,11 +168,11 @@ declare module BabylonViewer {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -189,11 +189,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 4 - 4
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -200,11 +200,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -221,11 +221,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }

+ 14 - 2
src/Materials/Textures/Procedurals/babylon.noiseProceduralTexture.ts

@@ -59,9 +59,16 @@ module BABYLON {
          * @returns a serialized noise procedural texture object
          */
         public serialize(): any {
-            var serializationObject = SerializationHelper.Serialize(this, super.serialize());
+            var serializationObject: any = {};
             serializationObject.customType = "BABYLON.NoiseProceduralTexture";
 
+            serializationObject.brightness = this.brightness;
+            serializationObject.octaves = this.octaves;
+            serializationObject.persistence = this.persistence;
+            serializationObject.animationSpeedFactor = this.animationSpeedFactor;
+            serializationObject.size = this.getSize().width;
+            serializationObject.generateMipMaps = this._generateMipMaps;
+
             return serializationObject;
         }
 
@@ -73,7 +80,12 @@ module BABYLON {
          * @returns a parsed NoiseProceduralTexture
          */
         public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): NoiseProceduralTexture {
-            var texture = SerializationHelper.Parse(() => new NoiseProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
+            var texture = new NoiseProceduralTexture(parsedTexture.name, parsedTexture.size, scene, undefined, parsedTexture.generateMipMaps);
+
+            texture.brightness = parsedTexture.brightness;
+            texture.octaves = parsedTexture.octaves;
+            texture.persistence = parsedTexture.persistence;
+            texture.animationSpeedFactor = parsedTexture.animationSpeedFactor;
 
             return texture;
         }        

+ 2 - 0
src/Particles/babylon.particleSystem.ts

@@ -2027,6 +2027,7 @@
             serializationObject.spriteCellChangeSpeed = particleSystem.spriteCellChangeSpeed;
             serializationObject.spriteCellWidth = particleSystem.spriteCellWidth;
             serializationObject.spriteCellHeight = particleSystem.spriteCellHeight;
+            serializationObject.spriteRandomStartCell = particleSystem.spriteRandomStartCell;
 
             let colorGradients = particleSystem.getColorGradients();
             if (colorGradients) {
@@ -2418,6 +2419,7 @@
             particleSystem.spriteCellWidth = parsedParticleSystem.spriteCellWidth;
             particleSystem.spriteCellHeight = parsedParticleSystem.spriteCellHeight;
             particleSystem.spriteCellChangeSpeed = parsedParticleSystem.spriteCellChangeSpeed;
+            particleSystem.spriteRandomStartCell = parsedParticleSystem.spriteRandomStartCell;
         }
 
         /**