Namespace: DeltaEngine.Graphics
Assembly: DeltaEngine.Graphics (in DeltaEngine.Graphics.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Graphics.Tests.DrawingPerformanceTests
2 unit tests call DeltaEngine.Graphics.Drawing.ViewportPixelSize
Assembly: DeltaEngine.Graphics (in DeltaEngine.Graphics.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: SizeRemarks
Examples
/// <summary> /// Proof that 30k lines can be rendered with up to 3000fps in a small window, fast GPU. Even /// 1000fps means that 30 million lines are drawn each second. More than 30k lines are possible /// with multiple draw calls, but causes multiple CircularBuffer flushes and thus not faster. /// </summary> [Test, Category("Slow")] public void Draw30000LinesPerFrame() { var manyLines = new DrawingTests.Line(Vector2D.Zero, new Vector2D(1280, 720), Color.Red); const int NumberOfRandomLines = 30000; var vertices = new VertexPosition2DColor[2 * NumberOfRandomLines]; var random = Randomizer.Current; var viewport = Resolve<Window>().ViewportPixelSize; for (int i = 0; i < NumberOfRandomLines; i++) { var startPoint = new Vector2D(random.Get(0, viewport.Width), random.Get(0, viewport.Height)); var endPoint = startPoint + new Vector2D(random.Get(-50, 50), random.Get(-50, 50)); vertices[i * 2 + 0] = new VertexPosition2DColor(startPoint, Color.GetRandomColor()); vertices[i * 2 + 1] = new VertexPosition2DColor(endPoint, Color.GetRandomColor()); } manyLines.Set(vertices); }
[Test, CloseAfterFirstFrame] public void TestViewportPixelSize() { var drawing = Resolve<Drawing>(); var window = Resolve<Window>(); window.ViewportPixelSize = new Size(800, 600); Assert.AreEqual(new Size(800, 600), drawing.ViewportPixelSize); }
See Also