Pārlūkot izejas kodu

Fixed a nasty bug with cube shadows and instances

David Catuhe 9 gadi atpakaļ
vecāks
revīzija
4f20f4f5b0

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 21 - 21
dist/preview release/babylon.core.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2111 - 2063
dist/preview release/babylon.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 27 - 27
dist/preview release/babylon.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 110 - 50
dist/preview release/babylon.max.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 26 - 26
dist/preview release/babylon.noworker.js


+ 3 - 2
src/Materials/Textures/babylon.renderTargetTexture.js

@@ -137,6 +137,7 @@ var BABYLON;
             // Prepare renderingManager
             this._renderingManager.reset();
             var currentRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;
+            var sceneRenderId = scene.getRenderId();
             for (var meshIndex = 0; meshIndex < currentRenderList.length; meshIndex++) {
                 var mesh = currentRenderList[meshIndex];
                 if (mesh) {
@@ -145,9 +146,9 @@ var BABYLON;
                         this.resetRefreshCounter();
                         continue;
                     }
-                    mesh._preActivate();
+                    mesh._preActivateForIntermediateRendering(sceneRenderId);
                     if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && ((mesh.layerMask & scene.activeCamera.layerMask) !== 0)) {
-                        mesh._activate(scene.getRenderId());
+                        mesh._activate(sceneRenderId);
                         for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {
                             var subMesh = mesh.subMeshes[subIndex];
                             scene._activeIndices += subMesh.indexCount;

+ 3 - 3
src/Materials/Textures/babylon.renderTargetTexture.ts

@@ -149,7 +149,7 @@
             this._renderingManager.reset();
 
             var currentRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;
-
+            var sceneRenderId = scene.getRenderId();
             for (var meshIndex = 0; meshIndex < currentRenderList.length; meshIndex++) {
                 var mesh = currentRenderList[meshIndex];
 
@@ -160,10 +160,10 @@
                         continue;
                     }
 
-                    mesh._preActivate();
+                    mesh._preActivateForIntermediateRendering(sceneRenderId);
 
                     if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && ((mesh.layerMask & scene.activeCamera.layerMask) !== 0)) {
-                        mesh._activate(scene.getRenderId());
+                        mesh._activate(sceneRenderId);
 
                         for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {
                             var subMesh = mesh.subMeshes[subIndex];

+ 2 - 0
src/Mesh/babylon.abstractMesh.js

@@ -258,6 +258,8 @@ var BABYLON;
         });
         AbstractMesh.prototype._preActivate = function () {
         };
+        AbstractMesh.prototype._preActivateForIntermediateRendering = function (renderId) {
+        };
         AbstractMesh.prototype._activate = function (renderId) {
             this._renderId = renderId;
         };

+ 3 - 0
src/Mesh/babylon.abstractMesh.ts

@@ -270,6 +270,9 @@
         public _preActivate(): void {
         }
 
+        public _preActivateForIntermediateRendering(renderId: number): void {
+        }
+                
         public _activate(renderId: number): void {
             this._renderId = renderId;
         }

+ 9 - 3
src/Mesh/babylon.mesh.js

@@ -352,6 +352,11 @@ var BABYLON;
             this._preActivateId = sceneRenderId;
             this._visibleInstances = null;
         };
+        Mesh.prototype._preActivateForIntermediateRendering = function (renderId) {
+            if (this._visibleInstances) {
+                this._visibleInstances.intermediateDefaultRenderId = renderId;
+            }
+        };
         Mesh.prototype._registerInstanceForRenderId = function (instance, renderId) {
             if (!this._visibleInstances) {
                 this._visibleInstances = {};
@@ -557,11 +562,12 @@ var BABYLON;
             this._batchCache.visibleInstances[subMeshId] = null;
             if (this._visibleInstances) {
                 var currentRenderId = scene.getRenderId();
+                var defaultRenderId = (scene._isInIntermediateRendering() ? this._visibleInstances.intermediateDefaultRenderId : this._visibleInstances.defaultRenderId);
                 this._batchCache.visibleInstances[subMeshId] = this._visibleInstances[currentRenderId];
                 var selfRenderId = this._renderId;
-                if (!this._batchCache.visibleInstances[subMeshId] && this._visibleInstances.defaultRenderId) {
-                    this._batchCache.visibleInstances[subMeshId] = this._visibleInstances[this._visibleInstances.defaultRenderId];
-                    currentRenderId = Math.max(this._visibleInstances.defaultRenderId, currentRenderId);
+                if (!this._batchCache.visibleInstances[subMeshId] && defaultRenderId) {
+                    this._batchCache.visibleInstances[subMeshId] = this._visibleInstances[defaultRenderId];
+                    currentRenderId = Math.max(defaultRenderId, currentRenderId);
                     selfRenderId = Math.max(this._visibleInstances.selfDefaultRenderId, currentRenderId);
                 }
                 if (this._batchCache.visibleInstances[subMeshId] && this._batchCache.visibleInstances[subMeshId].length) {

+ 10 - 3
src/Mesh/babylon.mesh.ts

@@ -373,6 +373,12 @@
             this._visibleInstances = null;
         }
 
+        public _preActivateForIntermediateRendering(renderId: number): void {
+            if (this._visibleInstances) {
+                this._visibleInstances.intermediateDefaultRenderId = renderId;
+            }
+        }
+
         public _registerInstanceForRenderId(instance: InstancedMesh, renderId: number) {
             if (!this._visibleInstances) {
                 this._visibleInstances = {};
@@ -618,12 +624,13 @@
 
             if (this._visibleInstances) {
                 var currentRenderId = scene.getRenderId();
+                var defaultRenderId = (scene._isInIntermediateRendering() ? this._visibleInstances.intermediateDefaultRenderId : this._visibleInstances.defaultRenderId);
                 this._batchCache.visibleInstances[subMeshId] = this._visibleInstances[currentRenderId];
                 var selfRenderId = this._renderId;
 
-                if (!this._batchCache.visibleInstances[subMeshId] && this._visibleInstances.defaultRenderId) {
-                    this._batchCache.visibleInstances[subMeshId] = this._visibleInstances[this._visibleInstances.defaultRenderId];
-                    currentRenderId = Math.max(this._visibleInstances.defaultRenderId, currentRenderId);
+                if (!this._batchCache.visibleInstances[subMeshId] && defaultRenderId) {
+                    this._batchCache.visibleInstances[subMeshId] = this._visibleInstances[defaultRenderId];
+                    currentRenderId = Math.max(defaultRenderId, currentRenderId);
                     selfRenderId = Math.max(this._visibleInstances.selfDefaultRenderId, currentRenderId);
                 }
 

+ 55 - 8
src/Mesh/babylon.meshBuilder.js

@@ -80,7 +80,7 @@ var BABYLON;
          * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
          * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array.
          * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array.
-         * The optional parameter èinstance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
+         * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
          * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
          * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
@@ -427,16 +427,16 @@ var BABYLON;
          * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe.
          * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#lathe
          *
-         * The parameter "shape" is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
+         * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be
          * rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero.
-         * The parameter "radius" (positive float, default 1) is the radius value of the lathe.
-         * The parameter "tessellation" (positive integer, default 64) is the side number of the lathe.
-         * The parameter "arc" (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape.
-         * The parameter "closed" (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
-         * The parameter "cap" sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
+         * The parameter `radius` (positive float, default 1) is the radius value of the lathe.
+         * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe.
+         * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape.
+         * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
+         * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
          * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
          * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
-         * The mesh can be set to updatable with the boolean parameter "updatable" (default false) if its internal geometry is supposed to change once created.
+         * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
          */
         MeshBuilder.CreateLathe = function (name, options, scene) {
             var arc = (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;
@@ -595,6 +595,27 @@ var BABYLON;
             BABYLON.Tools.LoadImage(url, onload, function () { }, scene.database);
             return ground;
         };
+        /**
+         * Creates a tube mesh.
+         * The tube is a parametric shape :  http://doc.babylonjs.com/tutorials/Parametric_Shapes.  It has no predefined shape. Its final shape will depend on the input parameters.
+         *
+         * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#tube
+         * The parameter `path` is a required array of successive `Vector3`. It is the curve used as the axis of the tube.
+         * The parameter `radius` (positive float, default 1) sets the tube radius size.
+         * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface.
+         * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overwrittes the parameter `radius`.
+         * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path.
+         * It must return a radius value (positive float) :
+         * ```var radiusFunction = function(i, distance) {
+         *   // do things
+         *   return radius; }```
+         * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc.
+         * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
+         * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
+         * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
+         * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
+         * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
+         */
         MeshBuilder.CreateTube = function (name, options, scene) {
             var path = options.path;
             var radius = options.radius || 1;
@@ -689,12 +710,38 @@ var BABYLON;
             tube.arc = options.arc;
             return tube;
         };
+        /**
+         * Creates a polyhedron mesh.
+         *
+         * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#polyhedron
+         * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial
+         *  to choose the wanted type.
+         * The parameter `size` (positive float, default 1) sets the polygon size.
+         * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value).
+         * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`.
+         * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
+         * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (`Color4`, default `(1, 1, 1, 1)`) and faceUV (`Vector4`, default `(0, 0, 1, 1)`).
+         * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
+         * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
+         * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
+         * Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
+         * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
+         */
         MeshBuilder.CreatePolyhedron = function (name, options, scene) {
             var polyhedron = new BABYLON.Mesh(name, scene);
             var vertexData = BABYLON.VertexData.CreatePolyhedron(options);
             vertexData.applyToMesh(polyhedron, options.updatable);
             return polyhedron;
         };
+        /**
+         * Creates a decal mesh.
+         * tuto : http://doc.babylonjs.com/tutorials/Mesh_CreateXXX_Methods_With_Options_Parameter#decals
+         * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal.
+         * The parameter `position` (`Vector3`, default `(0, 0, 0)`) sets the position of the decal in World coordinates.
+         * The parameter `normal` (`Vector3`, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates.
+         * The parameter `size` (`Vector3`, default `(1, 1, 1)`) sets the decal scaling.
+         * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal.
+         */
         MeshBuilder.CreateDecal = function (name, sourceMesh, options) {
             var indices = sourceMesh.getIndices();
             var positions = sourceMesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);

+ 1 - 1
src/Mesh/babylon.meshBuilder.ts

@@ -1112,4 +1112,4 @@
             return extrudedGeneric;
         }
     }
-}
+}

+ 34 - 36
src/Particles/babylon.solidParticleSystem.js

@@ -6,9 +6,10 @@ var BABYLON;
     var SolidParticleSystem = (function () {
         /**
         * Creates a SPS (Solid Particle System) object.
-        * @param name the SPS name, this will be the underlying mesh name
-        * @param scene the scene in which the SPS is added
-        * @param options "updatable" (default true) : if the SPS must be updatable or immutable, "isPickable" (default false) : if the solid particles must be pickable
+        * `name` (String) is the SPS name, this will be the underlying mesh name.
+        * `scene` (Scene) is the scene in which the SPS is added.
+        * `updatableè (default true) : if the SPS must be updatable or immutable.
+        * `isPickable` (default false) : if the solid particles must be pickable.
         */
         function SolidParticleSystem(name, scene, options) {
             // public members
@@ -96,7 +97,7 @@ var BABYLON;
         }
         /**
         * Builds the SPS underlying mesh. Returns a standard Mesh.
-        * If no model shape was added to the SPS, the return mesh is only a single triangular plane.
+        * If no model shape was added to the SPS, the returned mesh is just a single triangular plane.
         */
         SolidParticleSystem.prototype.buildMesh = function () {
             if (this.nbParticles === 0) {
@@ -136,13 +137,13 @@ var BABYLON;
             return mesh;
         };
         /**
-        * Digests the mesh and generates as many solid particles in the system as wanted.
+        * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
         * These particles will have the same geometry than the mesh parts and will be positioned at the same localisation than the mesh original places.
-        * Thus the particles generated from digest() have their property "positiion" yet set.
-        * @param mesh the mesh to be digested
-        * @param facetNb the number of mesh facets per particle (optional, default 1), this parameter is overriden by the parameter "number" if any
-        * @param delta the random extra number of facets per partical (optional, default 0), each particle will have between facetNb and facetNb + delta facets
-        * @param number the wanted number of particles : each particle is built with mesh_total_facets / number facets (optional)
+        * Thus the particles generated from `digest()` have their property `position` set yet.
+        * `mesh` (`Mesh`) is the mesh to be digested
+        * `facetNb` (optional integer, default 1) is the number of mesh facets per particle, this parameter is overriden by the parameter `number` if any
+        * `delta` (optional integer, default 0) is the random extra number of facets per particle , each particle will have between `facetNb` and `facetNb + delta` facets
+        * `number` (optional positive integer) is the wanted number of particles : each particle is built with `mesh_total_facets / number` facets
         */
         SolidParticleSystem.prototype.digest = function (mesh, options) {
             var size = (options && options.facetNb) || 1;
@@ -220,6 +221,7 @@ var BABYLON;
                 this._shapeCounter++;
                 f += size;
             }
+            return this;
         };
         //reset copy
         SolidParticleSystem.prototype._resetCopy = function () {
@@ -327,11 +329,12 @@ var BABYLON;
             this.particles.push(new BABYLON.SolidParticle(idx, idxpos, model, shapeId, idxInShape));
         };
         /**
-        * Adds some particles to the SPS from the model shape.
+        * Adds some particles to the SPS from the model shape. Returns the shape id.
         * Please read the doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#create-an-immutable-sps
-        * @param mesh any Mesh object that will be used as a model for the solid particles.
-        * @param nb the number of particles to be created from this model
-        * @param options positionFunction is an optional javascript function to called for each particle on SPS creation. vertexFunction an optional javascript function to called for each vertex of each particle on SPS creation
+        * `mesh` is any `Mesh` object that will be used as a model for the solid particles.
+        * `nb` (positive integer) the number of particles to be created from this model
+        * `positionFunction` is an optional javascript function to called for each particle on SPS creation.
+        * `vertexFunction` is an optional javascript function to called for each vertex of each particle on SPS creation
         */
         SolidParticleSystem.prototype.addShape = function (mesh, nb, options) {
             var meshPos = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
@@ -414,7 +417,7 @@ var BABYLON;
         };
         /**
         *  Sets all the particles : this method actually really updates the mesh according to the particle positions, rotations, colors, textures, etc.
-        *  This method calls updateParticle() for each particles of the SPS.
+        *  This method calls `updateParticle()` for each particle of the SPS.
         *  For an animated SPS, it is usually called within the render loop.
         * @param start (default 0) the particle index in the particle array where to start to compute the particle property values
         * @param end (default nbParticle - 1)  the particle index in the particle array where to stop to compute the particle property values
@@ -642,7 +645,7 @@ var BABYLON;
             this.pickedParticles = null;
         };
         /**
-        *  Visibilty helper : Recomputes the visible size according to the mesh bounding box
+        * Visibilty helper : Recomputes the visible size according to the mesh bounding box
         * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility
         */
         SolidParticleSystem.prototype.refreshVisibleSize = function () {
@@ -650,7 +653,8 @@ var BABYLON;
                 this.mesh.refreshBoundingInfo();
             }
         };
-        /** Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
+        /**
+        * Visibility helper : Sets the size of a visibility box, this sets the underlying mesh bounding box.
         * @param size the size (float) of the visibility box
         * note : this doesn't lock the SPS mesh bounding box.
         * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#sps-visibility
@@ -661,9 +665,6 @@ var BABYLON;
         };
         Object.defineProperty(SolidParticleSystem.prototype, "isAlwaysVisible", {
             // getter and setter
-            /**
-            * True if the SPS is set as always visible
-            */
             get: function () {
                 return this._alwaysVisible;
             },
@@ -679,9 +680,6 @@ var BABYLON;
             configurable: true
         });
         Object.defineProperty(SolidParticleSystem.prototype, "isVisibilityBoxLocked", {
-            /**
-            * True if the SPS visibility box is locked. The underlying mesh bounding box is then not updatable any more.
-            */
             get: function () {
                 return this._isVisibilityBoxLocked;
             },
@@ -703,9 +701,9 @@ var BABYLON;
             },
             // Optimizer setters
             /**
-            * Tells to setParticles() to compute the particle rotations or not.
+            * Tells to `setParticles()` to compute the particle rotations or not.
             * Default value : true. The SPS is faster when it's set to false.
-            * Note : the particle rotations aren't stored values, so setting computeParticleRotation to false will prevents the particle to rotate.
+            * Note : the particle rotations aren't stored values, so setting `computeParticleRotation` to false will prevents the particle to rotate.
             */
             set: function (val) {
                 this._computeParticleRotation = val;
@@ -718,9 +716,9 @@ var BABYLON;
                 return this._computeParticleColor;
             },
             /**
-            * Tells to setParticles() to compute the particle colors or not.
+            * Tells to `setParticles()` to compute the particle colors or not.
             * Default value : true. The SPS is faster when it's set to false.
-            * Note : the particle colors are stored values, so setting computeParticleColor to false will keep yet the last colors set.
+            * Note : the particle colors are stored values, so setting `computeParticleColor` to false will keep yet the last colors set.
             */
             set: function (val) {
                 this._computeParticleColor = val;
@@ -733,9 +731,9 @@ var BABYLON;
                 return this._computeParticleTexture;
             },
             /**
-            * Tells to setParticles() to compute the particle textures or not.
+            * Tells to `setParticles()` to compute the particle textures or not.
             * Default value : true. The SPS is faster when it's set to false.
-            * Note : the particle textures are stored values, so setting computeParticleTexture to false will keep yet the last colors set.
+            * Note : the particle textures are stored values, so setting `computeParticleTexture` to false will keep yet the last colors set.
             */
             set: function (val) {
                 this._computeParticleTexture = val;
@@ -748,7 +746,7 @@ var BABYLON;
                 return this._computeParticleVertex;
             },
             /**
-            * Tells to setParticles() to call the vertex function for each vertex of each particle, or not.
+            * Tells to `setParticles()` to call the vertex function for each vertex of each particle, or not.
             * Default value : false. The SPS is faster when it's set to false.
             * Note : the particle custom vertex positions aren't stored values.
             */
@@ -763,7 +761,7 @@ var BABYLON;
                 return this._computeBoundingBox;
             },
             /**
-            * Tells to setParticles() to compute or not the mesh bounding box when computing the particle positions.
+            * Tells to `setParticles()` to compute or not the mesh bounding box when computing the particle positions.
             */
             set: function (val) {
                 this._computeBoundingBox = val;
@@ -775,7 +773,7 @@ var BABYLON;
         // Particle behavior logic
         // these following methods may be overwritten by the user to fit his needs
         /**
-        * This function does nothing. It may be overwritten to set all the particles first values.
+        * This function does nothing. It may be overwritten to set all the particle first values.
         * The SPS doesn't call this function, you may have to call it by your own.
         * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#particle-management
         */
@@ -791,7 +789,7 @@ var BABYLON;
         };
         /**
         * Updates a particle : this function should  be overwritten by the user.
-        * It is called on each particle by setParticles(). This is the place to code each particle behavior.
+        * It is called on each particle by `setParticles()`. This is the place to code each particle behavior.
         * doc : http://doc.babylonjs.com/tutorials/Solid_Particle_System#particle-management
         * ex : just set a particle position or velocity and recycle conditions
         */
@@ -800,7 +798,7 @@ var BABYLON;
         };
         /**
         * Updates a vertex of a particle : it can be overwritten by the user.
-        * This will be called on each vertex particle by setParticles() if computeParticleVertex is set to true only.
+        * This will be called on each vertex particle by `setParticles()` if `computeParticleVertex` is set to true only.
         * @param particle the current particle
         * @param vertex the current index of the current particle
         * @param pt the index of the current vertex in the particle shape
@@ -811,7 +809,7 @@ var BABYLON;
             return vertex;
         };
         /**
-        * This will be called before any other treatment by setParticles() and will be passed three parameters.
+        * This will be called before any other treatment by `setParticles()` and will be passed three parameters.
         * This does nothing and may be overwritten by the user.
         * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
         * @param stop the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()
@@ -820,7 +818,7 @@ var BABYLON;
         SolidParticleSystem.prototype.beforeUpdateParticles = function (start, stop, update) {
         };
         /**
-        * This will be called  by setParticles() after all the other treatments and just before the actual mesh update.
+        * This will be called  by `setParticles()` after all the other treatments and just before the actual mesh update.
         * This will be passed three parameters.
         * This does nothing and may be overwritten by the user.
         * @param start the particle index in the particle array where to stop to iterate, same than the value passed to setParticle()

+ 1 - 1
src/Particles/babylon.solidParticleSystem.ts

@@ -1,4 +1,4 @@
-module BABYLON {
+module BABYLON {
 
     /**
     * Full documentation here : http://doc.babylonjs.com/tutorials/Solid_Particle_System

+ 6 - 0
src/babylon.scene.js

@@ -123,6 +123,7 @@ var BABYLON;
             this._animationRatio = 0;
             this._renderId = 0;
             this._executeWhenReadyTimeoutId = -1;
+            this._intermediateRendering = false;
             this._toBeDisposed = new BABYLON.SmartArray(256);
             this._onReadyCallbacks = new Array();
             this._pendingData = []; //ANY
@@ -1196,6 +1197,9 @@ var BABYLON;
                 }
             }
         };
+        Scene.prototype._isInIntermediateRendering = function () {
+            return this._intermediateRendering;
+        };
         Scene.prototype._evaluateActiveMeshes = function () {
             this.activeCamera._activeMeshes.reset();
             this._activeMeshes.reset();
@@ -1338,6 +1342,7 @@ var BABYLON;
             // Render targets
             var beforeRenderTargetDate = BABYLON.Tools.Now;
             if (this.renderTargetsEnabled && this._renderTargets.length > 0) {
+                this._intermediateRendering = true;
                 BABYLON.Tools.StartPerformanceCounter("Render targets", this._renderTargets.length > 0);
                 for (var renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {
                     var renderTarget = this._renderTargets.data[renderIndex];
@@ -1348,6 +1353,7 @@ var BABYLON;
                     }
                 }
                 BABYLON.Tools.EndPerformanceCounter("Render targets", this._renderTargets.length > 0);
+                this._intermediateRendering = false;
                 this._renderId++;
                 engine.restoreDefaultFramebuffer(); // Restore back buffer
             }

+ 7 - 0
src/babylon.scene.ts

@@ -243,6 +243,7 @@
 
         private _renderId = 0;
         private _executeWhenReadyTimeoutId = -1;
+        private _intermediateRendering = false;
 
         public _toBeDisposed = new SmartArray<IDisposable>(256);
 
@@ -1522,6 +1523,10 @@
             }
         }
 
+        public _isInIntermediateRendering(): boolean {
+            return this._intermediateRendering
+        }
+
         private _evaluateActiveMeshes(): void {
             this.activeCamera._activeMeshes.reset();
             this._activeMeshes.reset();
@@ -1701,6 +1706,7 @@
             // Render targets
             var beforeRenderTargetDate = Tools.Now;
             if (this.renderTargetsEnabled && this._renderTargets.length > 0) {
+                this._intermediateRendering = true;
                 Tools.StartPerformanceCounter("Render targets", this._renderTargets.length > 0);
                 for (var renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {
                     var renderTarget = this._renderTargets.data[renderIndex];
@@ -1712,6 +1718,7 @@
                 }
                 Tools.EndPerformanceCounter("Render targets", this._renderTargets.length > 0);
 
+                this._intermediateRendering = false;
                 this._renderId++;
                 engine.restoreDefaultFramebuffer(); // Restore back buffer
             }