public void TestIndexedLineStripBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue( TestVertices, 10, 2 + 0 + 9, TestIndices, 0, 9, PrimitiveType.LineStrip ); // - Indices start at 2 ("index[0] == 2") // - First index used is index 9 (so vertices 11 - 41 will be drawn) // - Base vertex (offset that becomes vertex index 0) is 10 // -- Resulting in vertices 21 - 51 to be drawn creator.Queue( TestVertices, 10, 2 + 9 + 30, TestIndices, 9, 30, PrimitiveType.LineStrip ); } finally { creator.End(); } // First line strip with 9 supporting points Assert.AreEqual(subArray(TestVertices, 12, 9), creator.DrawnBatches[0]); // Second line strip, first batch Assert.AreEqual(subArray(TestVertices, 21, 5), creator.DrawnBatches[1]); // Second line strip, second batch, repeating cutoff vertex Assert.AreEqual(subArray(TestVertices, 25, 16), creator.DrawnBatches[2]); // Second line strip, third batch, repeating cutoff vertex Assert.AreEqual(subArray(TestVertices, 40, 11), creator.DrawnBatches[3]); } }
public void TestIndexedTriangleStripBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue( TestVertices, 0, 7 + 2, TestIndices, 0, 7, PrimitiveType.TriangleStrip ); creator.Queue( TestVertices, 10, 30 + 2, TestIndices, 7, 30, PrimitiveType.TriangleStrip ); } finally { creator.End(); } // First triangle strip with 7 supporting points Assert.AreEqual(subArray(TestVertices, 0 + 2, 7), creator.DrawnBatches[0]); // Second triangle strip, first batch Assert.AreEqual(subArray(TestVertices, 17 + 2, 7), creator.DrawnBatches[1]); // Second triangle strip, second batch, repeating two vertices before cutoff Assert.AreEqual(subArray(TestVertices, 22 + 2, 15), creator.DrawnBatches[2]); // Second triangle strip, third batch, repeating two vertices before cutoff Assert.AreEqual(subArray(TestVertices, 35 + 2, 12), creator.DrawnBatches[3]); } }
public void TestIndexedLineStripBatchOverflowSkip() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue( TestVertices, 0, 2 + 0 + 13, TestIndices, 0, 13, PrimitiveType.LineStrip ); // - Indices start at 2 ("index[0] == 2") // - First index used is index 13 (so vertices 15 - 31 will be drawn) // - Base vertex (offset that becomes vertex index 0) is 10 // -- Resulting in vertices 25 - 41 to be drawn creator.Queue( TestVertices, 10, 2 + 13 + 16, TestIndices, 13, 16, PrimitiveType.LineStrip ); } finally { creator.End(); } // First line strip with 15 supporting points Assert.AreEqual(subArray(TestVertices, 2, 13), creator.DrawnBatches[0]); // Second line strip, should be unsplit in the second batch Assert.AreEqual(subArray(TestVertices, 25, 16), creator.DrawnBatches[1]); } }
public void TestIndexedTriangleFanBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue( TestVertices, 0, 2 + 0 + 12, TestIndices, 0, 12, PrimitiveType.TriangleFan ); creator.Queue( TestVertices, 10, 2 + 14 + 25, TestIndices, 14, 25, PrimitiveType.TriangleFan ); } finally { creator.End(); } TestVertex[] lastBatch = creator.DrawnBatches[2].ToArray(); // First triangle fan with 12 supporting points Assert.AreEqual(subArray(TestVertices, 0 + 2, 12), creator.DrawnBatches[0]); // Second triangle fan, first batch Assert.AreEqual(subArray(TestVertices, 24 + 2, 16), creator.DrawnBatches[1]); // Second triangle fan, second batch, repeating first and cutoff vertex Assert.AreEqual(TestVertices[24 + 2], lastBatch[0]); Assert.AreEqual(subArray(TestVertices, 39 + 2, 10), subArray(lastBatch, 1)); } }
public void TestIndexedPointListBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue( TestVertices, 10, 2 + 0 + 9, TestIndices, 0, 9, PrimitiveType.PointList ); // - Indices start at 2 ("index[0] == 2") // - First index used is index 9 (so vertices 11 - 41 will be drawn) // - Base vertex (offset that becomes vertex index 0) is 10 // -- Resulting in vertices 21 - 51 to be drawn creator.Queue( TestVertices, 10, 2 + 9 + 30, TestIndices, 9, 30, PrimitiveType.PointList ); } finally { creator.End(); } TestVertex[] firstBatch = creator.DrawnBatches[0].ToArray(); Assert.AreEqual(subArray(TestVertices, 12, 9), subArray(firstBatch, 0, 9)); Assert.AreEqual(subArray(TestVertices, 21, 7), subArray(firstBatch, 9, 7)); Assert.AreEqual(subArray(TestVertices, 28, 16), creator.DrawnBatches[1]); Assert.AreEqual(subArray(TestVertices, 44, 7), creator.DrawnBatches[2]); } }
public void TestSimpleDrawing() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue(TestVertices, 0, 9, PrimitiveType.TriangleList); creator.Queue(TestVertices, 9, 3, PrimitiveType.PointList); } finally { creator.End(); } Assert.AreEqual(subArray(TestVertices, 0, 9), creator.DrawnBatches[0]); Assert.AreEqual(subArray(TestVertices, 9, 3), creator.DrawnBatches[1]); } }
public void TestPointListBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue(TestVertices, 0, 9, PrimitiveType.PointList); creator.Queue(TestVertices, 9, 30, PrimitiveType.PointList); } finally { creator.End(); } Assert.AreEqual(subArray(TestVertices, 0, 16), creator.DrawnBatches[0]); Assert.AreEqual(subArray(TestVertices, 16, 16), creator.DrawnBatches[1]); Assert.AreEqual(subArray(TestVertices, 32, 7), creator.DrawnBatches[2]); } }
public void TestTriangleListBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { TestVertex[] test = subArray(TestVertices, 0, 39); creator.Queue(TestVertices, 0, 15, PrimitiveType.TriangleList); creator.Queue(test, 15, 24, PrimitiveType.TriangleList); } finally { creator.End(); } Assert.AreEqual(subArray(TestVertices, 0, 15), creator.DrawnBatches[0]); Assert.AreEqual(subArray(TestVertices, 15, 15), creator.DrawnBatches[1]); Assert.AreEqual(subArray(TestVertices, 30, 9), creator.DrawnBatches[2]); } }
public void TestLineListBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { TestVertex[] test = subArray(TestVertices, 0, 40); creator.Queue(TestVertices, 0, 10, PrimitiveType.LineList); creator.Queue(test, 10, 30, PrimitiveType.LineList); } finally { creator.End(); } Assert.AreEqual(subArray(TestVertices, 0, 16), creator.DrawnBatches[0]); Assert.AreEqual(subArray(TestVertices, 16, 16), creator.DrawnBatches[1]); Assert.AreEqual(subArray(TestVertices, 32, 8), creator.DrawnBatches[2]); } }
public void TestLineStripBatchOverflowSkip() { using (Creator creator = new Creator()) { creator.Begin(); try { TestVertex[] test = subArray(TestVertices, 0, 31); creator.Queue(TestVertices, 0, 15, PrimitiveType.LineStrip); creator.Queue(test, 15, 16, PrimitiveType.LineStrip); } finally { creator.End(); } // First line strip with 15 supporting points Assert.AreEqual(subArray(TestVertices, 0, 15), creator.DrawnBatches[0]); // Second line strip, should be unsplit in the second batch Assert.AreEqual(subArray(TestVertices, 15, 16), creator.DrawnBatches[1]); } }
public void TestIndexedTriangleListBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue( TestVertices, 0, 13 + 2, TestIndices, 0, 13, PrimitiveType.TriangleList ); creator.Queue( TestVertices, 10, 24 + 2, TestIndices, 15, 24, PrimitiveType.TriangleList ); } finally { creator.End(); } Assert.AreEqual(subArray(TestVertices, 0 + 2, 13), creator.DrawnBatches[0]); Assert.AreEqual(subArray(TestVertices, 25 + 2, 15), creator.DrawnBatches[1]); Assert.AreEqual(subArray(TestVertices, 40 + 2, 9), creator.DrawnBatches[2]); } }
public void TestTriangleStripBatchOverflowSkip() { using (Creator creator = new Creator()) { creator.Begin(); try { TestVertex[] test = subArray(TestVertices, 0, 39); creator.Queue(TestVertices, 0, 13, PrimitiveType.TriangleStrip); creator.Queue(test, 13, 26, PrimitiveType.TriangleStrip); } finally { creator.End(); } // First triangle strip with 13 supporting points Assert.AreEqual(subArray(TestVertices, 0, 13), creator.DrawnBatches[0]); // Second triangle strip, first batch Assert.AreEqual(subArray(TestVertices, 13, 15), creator.DrawnBatches[1]); // Second triangle strip, second batch, repeating two vertices before cutoff Assert.AreEqual(subArray(TestVertices, 26, 13), creator.DrawnBatches[2]); } }
public void TestLineStripBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { TestVertex[] test = subArray(TestVertices, 0, 39); creator.Queue(TestVertices, 0, 9, PrimitiveType.LineStrip); creator.Queue(test, 9, 30, PrimitiveType.LineStrip); } finally { creator.End(); } // First line strip with 9 supporting points Assert.AreEqual(subArray(TestVertices, 0, 9), creator.DrawnBatches[0]); // Second line strip, first batch Assert.AreEqual(subArray(TestVertices, 9, 7), creator.DrawnBatches[1]); // Second line strip, second batch, repeating cutoff vertex Assert.AreEqual(subArray(TestVertices, 15, 16), creator.DrawnBatches[2]); // Second line strip, third batch, repeating cutoff vertex Assert.AreEqual(subArray(TestVertices, 30, 9), creator.DrawnBatches[3]); } }
public void TestIndexedLineListBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue( TestVertices, 0, 2 + 0 + 10, TestIndices, 0, 10, PrimitiveType.LineList ); creator.Queue( TestVertices, 10, 2 + 10 + 30, TestIndices, 10, 30, PrimitiveType.LineList ); } finally { creator.End(); } TestVertex[] firstBatch = creator.DrawnBatches[0].ToArray(); Assert.AreEqual(subArray(TestVertices, 2, 10), subArray(firstBatch, 0, 10)); Assert.AreEqual(subArray(TestVertices, 22, 4), subArray(firstBatch, 10)); Assert.AreEqual(subArray(TestVertices, 26, 16), creator.DrawnBatches[1]); Assert.AreEqual(subArray(TestVertices, 42, 10), creator.DrawnBatches[2]); } }
public void TestIndexedDrawing() { using (Creator creator = new Creator()) { creator.Begin(); try { creator.Queue( TestVertices, 10, 2 + 0 + 9, TestIndices, 0, 9, PrimitiveType.TriangleList ); // - Indices start at 2 ("index[0] == 2") // - First index used is index 9 (so vertices 11 - 14 will be drawn) // - Base vertex (offset that becomes vertex index 0) is 10 // -- Resulting in vertices 21 - 24 to be drawn creator.Queue( TestVertices, 10, 2 + 9 + 3, TestIndices, 9, 3, PrimitiveType.PointList ); } finally { creator.End(); } Assert.AreEqual(subArray(TestVertices, 12, 9), creator.DrawnBatches[0]); Assert.AreEqual(subArray(TestVertices, 21, 3), creator.DrawnBatches[1]); } }
public void TestTriangleFanBatchOverflow() { using (Creator creator = new Creator()) { creator.Begin(); try { TestVertex[] test = subArray(TestVertices, 0, 39); creator.Queue(TestVertices, 0, 14, PrimitiveType.TriangleFan); creator.Queue(test, 14, 25, PrimitiveType.TriangleFan); } finally { creator.End(); } // First triangle fan with 14 supporting points Assert.AreEqual(subArray(TestVertices, 0, 14), creator.DrawnBatches[0]); // Second triangle fan, first batch Assert.AreEqual(subArray(TestVertices, 14, 16), creator.DrawnBatches[1]); // Second triangle fan, second batch, repeating first and cutoff vertex Assert.AreEqual(TestVertices[14], creator.DrawnBatches[2][0]); Assert.AreEqual( subArray(TestVertices, 29, 10), subArray(creator.DrawnBatches[2].ToArray(), 1) ); } }