public void DrawBatcherTools_GenerateTheNextBatch_ConsumesOneRequestButSkipsQueueDueToInactive() { IDrawStageBatcherTools tools = new DrawStageBatcherTools(); var messenger = Substitute.For <IFrameworkMessenger>(); var q0 = new DrawQueue(messenger, new ComparerCollection(), 12, 4, false); Add(q0, FillType.Coloured, 12UL, 0UL, TextureCoordinateMode.Mirror, TextureCoordinateMode.Mirror, 3); Add(q0, FillType.Coloured, 12UL, 0UL, TextureCoordinateMode.Mirror, TextureCoordinateMode.Mirror, 3); Add(q0, FillType.Coloured, 12UL, 0UL, TextureCoordinateMode.Mirror, TextureCoordinateMode.Mirror, 11); var w0 = new QueueWrap { Id = 0, BufferPositionOfFirstIndex = 0, BufferPositionOfFirstVertex = 0, Queue = q0 }; var q1 = new DrawQueue(messenger, new ComparerCollection(), 12, 4, false); Add(q1, FillType.Coloured, 1UL, 0UL, TextureCoordinateMode.Mirror, TextureCoordinateMode.Mirror, 9, 1.0f); var w1 = new QueueWrap { Id = 0, BufferPositionOfFirstIndex = 0, BufferPositionOfFirstVertex = 0, Queue = q1 }; var q2 = new DrawQueue(messenger, new ComparerCollection(), 12, 4, false); Add(q2, FillType.Coloured, 2UL, 0UL, TextureCoordinateMode.Mirror, TextureCoordinateMode.Mirror, 10, 0.5f); var w2 = new QueueWrap { Id = 0, BufferPositionOfFirstIndex = 0, BufferPositionOfFirstVertex = 0, Queue = q2 }; var others = new List <QueueWrap> { w1, w2 }; var combined = tools.CombinedList(w0, others).ToArray(); var num = 3; var pool = new DrawingBatch[] { new DrawingBatch() }; tools.GenerateTheNextBatch(pool, 1, 0, ref num, combined, new int[] { 0, 0, 0 }, 3, new bool[] { true, false, true }, new int[] { 0, 0, 0 }, new bool[] { true, false, true }); var batch = pool[0]; Assert.Equal(1UL, batch.Texture0); Assert.Equal(3, batch.NumIndices); }
public void DrawBatcherTools_CreatePoolSize_ExistingDataPersists() { IDrawStageBatcherTools tools = new DrawStageBatcherTools(); var pool = new DrawingBatch[] { new DrawingBatch { NumIndices = 5, StartIndex = 7, Texture0 = 0UL, Texture1 = 8UL, TextureMode0 = TextureCoordinateMode.None, TextureMode1 = TextureCoordinateMode.Wrap }, new DrawingBatch { NumIndices = 9, StartIndex = 3, Texture0 = 4UL, Texture1 = 9UL, TextureMode0 = TextureCoordinateMode.Mirror, TextureMode1 = TextureCoordinateMode.Wrap }, new DrawingBatch { NumIndices = 9, StartIndex = 2, Texture0 = 2UL, Texture1 = 12UL, TextureMode0 = TextureCoordinateMode.Wrap, TextureMode1 = TextureCoordinateMode.None } }; var result = tools.CreatePoolOfSize(6, true, pool); Assert.Equal(8UL, result[0].Texture1); Assert.Equal(TextureCoordinateMode.Mirror, result[1].TextureMode0); Assert.Equal(2, result[2].StartIndex); }