Browse Source

use allocator for particles

Nicolas Cannasse 2 years ago
parent
commit
de35301017
1 changed files with 3 additions and 2 deletions
  1. 3 2
      h3d/parts/Particles.hx

+ 3 - 2
h3d/parts/Particles.hx

@@ -364,13 +364,14 @@ class Particles extends h3d.scene.Mesh {
 		}
 		}
 		var stride = 10;
 		var stride = 10;
 		if( hasColor ) stride += 4;
 		if( hasColor ) stride += 4;
-		var buffer = h3d.Buffer.ofSubFloats(tmp, stride, Std.int(pos/stride), [Dynamic, RawFormat]);
+		var count = Std.int(pos/stride);
+		var buffer = hxd.impl.Allocator.get().ofSubFloats(tmp, stride, count,RawFormat);
 		if( pshader.is3D )
 		if( pshader.is3D )
 			pshader.size.set(globalSize, globalSize);
 			pshader.size.set(globalSize, globalSize);
 		else
 		else
 			pshader.size.set(globalSize * ctx.engine.height / ctx.engine.width * 4, globalSize * 4);
 			pshader.size.set(globalSize * ctx.engine.height / ctx.engine.width * 4, globalSize * 4);
 		ctx.uploadParams();
 		ctx.uploadParams();
-		ctx.engine.renderQuadBuffer(buffer);
+		ctx.engine.renderQuadBuffer(buffer, 0, Std.int(count/3));
 		buffer.dispose();
 		buffer.dispose();
 	}
 	}