public MTSimpleSpriteBatchItem CreateSimpleBatchItem() { MTSimpleSpriteBatchItem simpleSpriteBatchItem = this._freeSimpleBatchItemQueue.Count <= 0 ? new MTSimpleSpriteBatchItem() : this._freeSimpleBatchItemQueue.Dequeue(); this._simpleBatchItemList.Add(simpleSpriteBatchItem); return(simpleSpriteBatchItem); }
public void DrawSimpleBatch(SpriteSortMode sortMode) { if (this._simpleBatchItemList.Count == 0) { return; } switch (sortMode) { case SpriteSortMode.BackToFront: this._simpleBatchItemList.Sort(new Comparison <MTSimpleSpriteBatchItem>(MTSpriteBatcher.CompareSimpleReverseDepth)); break; case SpriteSortMode.FrontToBack: this._simpleBatchItemList.Sort(new Comparison <MTSimpleSpriteBatchItem>(MTSpriteBatcher.CompareSimpleDepth)); break; } int index1 = 0; int numBatchItems; for (int count = this._simpleBatchItemList.Count; count > 0; count -= numBatchItems) { int start = 0; int end = 0; numBatchItems = count; if (numBatchItems > 5461) { numBatchItems = 5461; } this.EnsureSimpleArrayCapacity(numBatchItems); int num1 = 0; while (num1 < numBatchItems) { MTSimpleSpriteBatchItem simpleBatchItem = this._simpleBatchItemList[index1]; VertexPositionColor[] simpleVertexArray1 = this._simpleVertexArray; int index2 = end; int num2 = index2 + 1; simpleVertexArray1[index2] = simpleBatchItem.vertexTL; VertexPositionColor[] simpleVertexArray2 = this._simpleVertexArray; int index3 = num2; int num3 = index3 + 1; simpleVertexArray2[index3] = simpleBatchItem.vertexTR; VertexPositionColor[] simpleVertexArray3 = this._simpleVertexArray; int index4 = num3; int num4 = index4 + 1; simpleVertexArray3[index4] = simpleBatchItem.vertexBL; VertexPositionColor[] simpleVertexArray4 = this._simpleVertexArray; int index5 = num4; end = index5 + 1; simpleVertexArray4[index5] = simpleBatchItem.vertexBR; this._freeSimpleBatchItemQueue.Enqueue(simpleBatchItem); ++num1; ++index1; } this.FlushSimpleVertexArray(start, end); } this._simpleBatchItemList.Clear(); }
private static int CompareSimpleReverseDepth( MTSimpleSpriteBatchItem a, MTSimpleSpriteBatchItem b) { return(0); }
private static int CompareSimpleDepth(MTSimpleSpriteBatchItem a, MTSimpleSpriteBatchItem b) => 0;