private void UpdateStatistics() { if (MainDXViewportView.DXScene == null || MainDXViewportView.DXScene.Statistics == null) { return; } // NOTE that if want to use RenderingStatistics we need to set DXDiagnostics.IsCollectingStatistics to true (here this is done in constructor) RenderingStatistics statistics = MainDXViewportView.DXScene.Statistics; int currentRenderedPositionsCount = statistics.DrawnIndicesCount; int currentTotalPositionsCount = _optimizedPointMesh.VertexBufferArray.Length; if (currentRenderedPositionsCount == _lastRenderedPositionsCount && currentTotalPositionsCount == _lastTotalPositionsCount) { return; // Nn change } RenderingStatisticsTextBlock.Text = string.Format("Rendered positions: {0:#,##0} / Total positions: {1:#,##0}", statistics.DrawnIndicesCount, currentTotalPositionsCount); PerformanceTextBlock.Text = string.Format("({0:0.0}% reduction)", 100.0 - ((100.0 * (double)currentRenderedPositionsCount) / (double)currentTotalPositionsCount)); _lastRenderedPositionsCount = currentRenderedPositionsCount; _lastTotalPositionsCount = currentTotalPositionsCount; }
private void DXSceneOnAfterFrameRendered(object sender, EventArgs eventArgs) { if (_totalSamplesCount == 0 && _dxScene.FrameNumber == 1) // Only store _timeToFirstFrame when we actually get the data for the first frame { _timeToFirstFrame = _stopwatch.Elapsed.TotalMilliseconds; } // Copy values into preallocated object _dxScene.Statistics.Copy(_currentRenderingStatisticsList[_currentIndex]); _lastRenderingStatistics = _currentRenderingStatisticsList[_currentIndex]; _currentIndex++; _totalSamplesCount++; if ((_currentIndex + 1) >= _currentRenderingStatisticsList.Capacity) { _currentRenderingStatisticsList = CreatePreallocatedList(_initialCapacity); _allCollectedRenderingStatistics.Add(_currentRenderingStatisticsList); _currentIndex = 0; } }