Browse Source

Can dispose mesh batch buffers that can be recovered later.

clementlandrin 2 years ago
parent
commit
420ab92edb
1 changed files with 11 additions and 0 deletions
  1. 11 0
      h3d/scene/MeshBatch.hx

+ 11 - 0
h3d/scene/MeshBatch.hx

@@ -316,6 +316,17 @@ class MeshBatch extends MultiMaterial {
 		instanceCount++;
 	}
 
+	public function disposeBuffers() {
+		if( instanceCount == 0 ) return;
+		var p = dataPasses;
+		var alloc = hxd.impl.Allocator.get();
+		while( p != null ) {
+			for ( b in p.buffers )
+				b.dispose();
+			p = p.next;
+		}
+	}
+
 	override function sync(ctx:RenderContext) {
 		super.sync(ctx);
 		if( instanceCount == 0 ) return;