public void DrawBatcherTools_CombineList_DoesSoInCorrectOrder() { IDrawStageBatcherTools tools = new DrawStageBatcherTools(); var messenger = Substitute.For <IFrameworkMessenger>(); var q0 = new DrawQueue(messenger, new ComparerCollection(), 12, 4, false); Add(q0, FillType.Coloured, 0UL, 0UL, TextureCoordinateMode.Mirror, TextureCoordinateMode.Mirror, 0); 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, 0); 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, 0); 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); Assert.Equal(2UL, combined[2].Queue.Data.Texture0[0]); }
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_IdentifyActiveInLayer_SimpleTest() { IDrawStageBatcherTools tools = new DrawStageBatcherTools(); var messenger = Substitute.For <IFrameworkMessenger>(); var q0 = new DrawQueue(messenger, new ComparerCollection(), 12, 4, false); Add(q0, FillType.Coloured, 0UL, 0UL, TextureCoordinateMode.Mirror, TextureCoordinateMode.Mirror, 3); 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, 10); 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); 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 activeInLayer = new bool[3]; tools.IdentifyWhichQueuesAreActiveInTheCurrentLayer(ref num, combined, new int[] { 0, 0, 0 }, 10, activeInLayer, new bool[] { true, false, true }); Assert.False(activeInLayer[0]); Assert.False(activeInLayer[1]); Assert.True(activeInLayer[2]); }
public void DrawBatcherTools_FindDeepestAtLowestLayer_SimpleTest() { IDrawStageBatcherTools tools = new DrawStageBatcherTools(); var messenger = Substitute.For <IFrameworkMessenger>(); var q0 = new DrawQueue(messenger, new ComparerCollection(), 12, 4, false); Add(q0, FillType.Coloured, 0UL, 0UL, TextureCoordinateMode.Mirror, TextureCoordinateMode.Mirror, 3); 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, 10, 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 index = tools.FindDeepestQueueAtLowestLayer(ref num, combined, new int[] { 0, 0, 0 }, 10, new bool[] { true, false, true }); Assert.Equal(2, index); }