|
@@ -358,6 +358,26 @@ class MeshBatch extends MultiMaterial {
|
|
|
instanceCount++;
|
|
|
}
|
|
|
|
|
|
+ public function disposeBuffers( useAllocator : Bool = true ) {
|
|
|
+ if( instanceCount == 0 ) return;
|
|
|
+ var p = dataPasses;
|
|
|
+ if ( useAllocator ) {
|
|
|
+ var alloc = hxd.impl.Allocator.get();
|
|
|
+ while( p != null ) {
|
|
|
+ for ( b in p.buffers )
|
|
|
+ alloc.disposeBuffer(b);
|
|
|
+ p.buffers.resize(0);
|
|
|
+ p = p.next;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ 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;
|