David Catuhe 7 år sedan
förälder
incheckning
ae97f0aa47

+ 10 - 0
src/Particles/babylon.gpuParticleSystem.ts

@@ -241,6 +241,12 @@
         }
         }
 
 
         /**
         /**
+         * Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls
+         * to override the particles.
+         */
+        public forceDepthWrite = false;        
+
+        /**
          * Gets or set the number of active particles
          * Gets or set the number of active particles
          */
          */
         public get activeParticleCount(): number {
         public get activeParticleCount(): number {
@@ -582,6 +588,10 @@
                 this._engine.setAlphaMode(Engine.ALPHA_COMBINE);
                 this._engine.setAlphaMode(Engine.ALPHA_COMBINE);
             }            
             }            
 
 
+            if (this.forceDepthWrite) {
+                this._engine.setDepthWrite(true);
+            }
+
             // Bind source VAO
             // Bind source VAO
             this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex], null);
             this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex], null);
 
 

+ 1 - 1
src/Shaders/gpuRenderParticles.vertex.fx

@@ -30,7 +30,7 @@ void main() {
 
 
   // Expand position
   // Expand position
   vec4 viewPosition = view * vec4(position, 1.0);
   vec4 viewPosition = view * vec4(position, 1.0);
-  gl_Position = projection * (viewPosition + vec4(offset * size, 0, 1.0));
+  gl_Position = projection * (viewPosition + vec4(offset * size, 0., 0.));
 
 
 	// Clip plane
 	// Clip plane
 #ifdef CLIPPLANE
 #ifdef CLIPPLANE