public void AddBatch(SpriteBatch spriteBatch) { if (spriteBatchBufferList.ContainsKey(spriteBatch)) throw new Exception("Batch already present!"); spriteBatchBufferGenerator.Clear(); foreach (var operation in spriteBatch.GetOperations()) { spriteBatchBufferGenerator.AddRectangle(operation.SourceX, operation.SourceY, operation.SourceWidth, operation.SourceHeight, operation.TargetX, operation.TargetY, operation.TargetWidth, operation.TargetHeight); } var spriteBatchBuffer = spriteBatchBufferGenerator.GetBuffer(); spriteBatchBufferList.Add(spriteBatch, spriteBatchBuffer); }