public void UpdateCounters(DiagnosticData data) { #region World statistics if (data.AreasLoaded.HasValue) { Update(lblLoadedAreas, data.AreasLoaded.Value.ToString()); } if (data.AreasRendered.HasValue) { Update(lblRenderedAreas, data.AreasRendered.Value.ToString()); Update(lblPercentAreas, ((double)data.AreasRendered / (double)data.AreasLoaded * 100.0d).ToString("0.0")); } if (data.BoxesLoaded.HasValue) { Update(lblLoadedBoxes, data.BoxesLoaded.Value.ToString()); } if (data.BoxesPooled.HasValue) { Update(lblPoolBoxes, data.BoxesPooled.Value.ToString()); } if (data.BoxesRendered.HasValue) { Update(lblRenderedBoxes, data.BoxesRendered.Value.ToString()); Update(lblPercentBoxes, ((double)data.BoxesRendered / (double)data.BoxesLoaded * 100.0d).ToString("0.0")); } if (data.FacesLoaded.HasValue) { Update(lblLoadedFaces, data.FacesLoaded.Value.ToString()); } if (data.FacesRendered.HasValue) { Update(lblRenderedFaces, data.FacesRendered.Value.ToString()); Update(lblPercentFaces, ((double)data.FacesRendered / (double)data.FacesLoaded * 100.0d).ToString("0.0")); } if (data.SegmentsLoaded.HasValue) { Update(lblLoadedSegments, data.SegmentsLoaded.Value.ToString()); } if (data.SegmentsPooled.HasValue) { Update(lblPoolSegments, data.SegmentsPooled.Value.ToString()); } if (data.SegmentsRendered.HasValue) { Update(lblRenderedSegments, data.SegmentsRendered.Value.ToString()); Update(lblPercentSegments, ((double)data.SegmentsRendered / (double)data.SegmentsLoaded * 100.0d).ToString("0.0")); } #endregion #region Player data if (data.CurrentSegmentX.HasValue) { Update(lblCurrentSegmentX, data.CurrentSegmentX.Value.ToString()); } if (data.CurrentSegmentY.HasValue) { Update(lblCurrentSegmentY, data.CurrentSegmentY.Value.ToString()); } if (data.CurrentSegmentZ.HasValue) { Update(lblCurrentSegmentZ, data.CurrentSegmentZ.Value.ToString()); } if (data.DiagonalNeighbourX.HasValue) { Update(lblDiagonalNeighbourX, data.DiagonalNeighbourX.Value.ToString()); } if (data.DiagonalNeighbourY.HasValue) { Update(lblDiagonalNeighbourY, data.DiagonalNeighbourY.Value.ToString()); } if (data.DiagonalNeighbourZ.HasValue) { Update(lblDiagonalNeighbourZ, data.DiagonalNeighbourZ.Value.ToString()); } if (data.PlayerDirectionLeft.HasValue) { Update(lblLeftRight, data.PlayerDirectionLeft.Value.ToString("0.0") + "°"); } if (data.PlayerDirectionUp.HasValue) { Update(lblUpDown, data.PlayerDirectionUp.Value.ToString("0.0") + "°"); } if (data.PlayerX.HasValue) { Update(lblX, data.PlayerX.Value.ToString("0.0")); } if (data.PlayerY.HasValue) { Update(lblY, data.PlayerY.Value.ToString("0.0")); } if (data.PlayerZ.HasValue) { Update(lblZ, data.PlayerZ.Value.ToString("0.0")); } if (data.PreviousCheckpointX.HasValue) { Update(lblPreviousCheckpointX, data.PreviousCheckpointX.Value.ToString("0.0")); } if (data.PreviousCheckpointY.HasValue) { Update(lblPreviousCheckpointY, data.PreviousCheckpointY.Value.ToString("0.0")); } if (data.PreviousCheckpointZ.HasValue) { Update(lblPreviousCheckpointZ, data.PreviousCheckpointZ.Value.ToString("0.0")); } #endregion #region Viewport elimination if (data.AwayAreasEliminatedAngle.HasValue) { Update(lblEliminatedAreasAwayAngle, data.AwayAreasEliminatedAngle.Value.ToString()); } if (data.AwayAreasEliminatedDistance.HasValue) { Update(lblEliminatedAreasAwayDistance, data.AwayAreasEliminatedDistance.Value.ToString()); } if (data.AwayAreasPassed.HasValue) { Update(lblPassedAreasAway, data.AwayAreasPassed.Value.ToString()); } if (data.AwaySegmentsEliminatedAngle.HasValue) { Update(lblEliminatedSegmentsAwayAngle, data.AwaySegmentsEliminatedAngle.Value.ToString()); } if (data.AwaySegmentsEliminatedDistance.HasValue) { Update(lblEliminatedSegmentsAwayDistance, data.AwaySegmentsEliminatedDistance.Value.ToString()); } if (data.AwaySegmentsPassed.HasValue) { Update(lblPassedSegmentsAway, data.AwaySegmentsPassed.Value.ToString()); } if (data.CloseAreasEliminated.HasValue) { Update(lblEliminatedAreasClose, data.CloseAreasEliminated.Value.ToString()); } if (data.CloseAreasPassed.HasValue) { Update(lblPassedAreasClose, data.CloseAreasPassed.Value.ToString()); } if (data.CloseSegmentsEliminatedAngle.HasValue) { Update(lblEliminatedSegmentsCloseAngle, data.CloseSegmentsEliminatedAngle.Value.ToString()); } if (data.CloseSegmentsEliminatedDistance.HasValue) { Update(lblEliminatedSegmentsCloseDistance, data.CloseSegmentsEliminatedDistance.Value.ToString()); } if (data.CloseSegmentsPassed.HasValue) { Update(lblPassedSegmentsClose, data.CloseSegmentsPassed.Value.ToString()); } #endregion #region Performance if (data.FiftyFramesIn.HasValue) { Update(lbl50FramesIn, data.FiftyFramesIn.Value.ToString()); Update(lblAverageFPS, (1000.0d / ((double)data.FiftyFramesIn / 50.0d)).ToString("0.0")); } if (data.GlBindTextureCalls.HasValue) { Update(lblGlBindTextureCalls, data.GlBindTextureCalls.Value.ToString()); } if (data.GlGetErrorResult.HasValue) { Update(lblGlGetErrorResult, data.GlGetErrorResult.Value.ToString()); } if (data.UsedMemory.HasValue) { Update(lblUsedMemory, data.UsedMemory.Value.ToString() + " MB"); } #endregion #region Point/vector operations if (data.Angle.HasValue) { Update(lblPointAngle, data.Angle.Value.ToString()); } if (data.ArithmethicOperators.HasValue) { Update(lblPointArithmethicOperator, data.ArithmethicOperators.Value.ToString()); } if (data.Clone.HasValue) { Update(lblPointClone, data.Clone.Value.ToString()); } if (data.ComparativeOperators.HasValue) { Update(lblPointComparisonOperator, data.ComparativeOperators.Value.ToString()); } if (data.Distance.HasValue) { Update(lblPointDistance, data.Distance.Value.ToString()); } if (data.Intersect.HasValue) { Update(lblPointIntersect, data.Intersect.Value.ToString()); } if (data.Rotation.HasValue) { Update(lblPointRotation, data.Rotation.Value.ToString()); } #endregion }
internal static void WriteStatistics(int time) { // lock (_ConsoleLock) // { // Console.CursorLeft = 0; // Console.CursorTop = 0; // for (int i = 0; i < 8; i++) // { // Console.Write(ClearBox); // } // } // double avgFps = 1000.0d / ((double)time / 50.0d); // int memory = Convert.ToInt32((double)Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024); // lock (_ConsoleLock) // { // Console.CursorLeft = 0; // Console.CursorTop = 0; //#if DIAG // double areasPct = (double)AreasRendered / (double)AreasLoaded * 100.0d; // double sgmtsPct = (double)SegmentsRendered / (double)SegmentsLoaded * 100.0d; // double boxesPct = (double)BoxesRendered / (double)BoxesLoaded * 100.0d; // double facesPct = (double)FacesRendered / (double)FacesLoaded * 100.0d; // Console.WriteLine(OutputFormat, // AreasLoaded, SegmentsLoaded, BoxesLoaded, FacesLoaded, // AreasRendered, SegmentsRendered, BoxesRendered, FacesRendered + (FacesRendered > 50000 ? "!" : ""), // areasPct, sgmtsPct, boxesPct, facesPct, // _World.Location.X, _World.Location.Y, _World.Location.Z, // _World.RotationY, _World.RotationX, // time, avgFps, // memory, // GlBindTextureCalls, // EliminatedAreaCloseDistance, PassedAreaCloseDistance, // EliminatedBasicDistance, EliminatedBasicAngle, PassedBasic, // Point3D.AngleOperations, Point3D.DistanceOperations); //#else // Console.WriteLine(OutputFormat, // AreasLoaded, SegmentsLoaded, BoxesLoaded, FacesLoaded, // _World.Location.X, _World.Location.Y, _World.Location.Z, // _World.RotationY, _World.RotationX, // time, avgFps, // memory); //#endif // } DiagnosticData data = new DiagnosticData(); #region World statistics data.AreasLoaded = AreasLoaded; #if DIAG data.AreasRendered = AreasRendered; #endif data.BoxesLoaded = BoxesLoaded; #if DIAG data.BoxesPooled = ClientWorldManager.Instance.PooledBoxCount; data.BoxesRendered = BoxesRendered; #endif data.FacesLoaded = FacesLoaded; #if DIAG data.FacesRendered = FacesRendered; #endif data.SegmentsLoaded = SegmentsLoaded; #if DIAG data.SegmentsPooled = ClientWorldManager.Instance.PooledSegmentCount; data.SegmentsRendered = SegmentsRendered; #endif #endregion #region Player data if (ClientWorldManager.Instance.Player.CurrentSegment != null) { data.CurrentSegmentX = ClientWorldManager.Instance.Player.CurrentSegment.X; data.CurrentSegmentY = ClientWorldManager.Instance.Player.CurrentSegment.Y; data.CurrentSegmentZ = ClientWorldManager.Instance.Player.CurrentSegment.Z; Segment diagonalNeighbour = ClientWorldManager.Instance.Player.GetCurrentSegmentNeighbour(6); data.DiagonalNeighbourX = diagonalNeighbour.X; data.DiagonalNeighbourY = diagonalNeighbour.Y; data.DiagonalNeighbourZ = diagonalNeighbour.Z; } data.PlayerDirectionLeft = ClientWorldManager.Instance.RotationY; data.PlayerDirectionUp = ClientWorldManager.Instance.RotationX; data.PlayerX = ClientWorldManager.Instance.Location.X; data.PlayerY = ClientWorldManager.Instance.Location.Y; data.PlayerZ = ClientWorldManager.Instance.Location.Z; Point3D checkpoint = ClientWorldManager.Instance.Player.PreviousCheckPoint; data.PreviousCheckpointX = checkpoint.X; data.PreviousCheckpointY = checkpoint.Y; data.PreviousCheckpointZ = checkpoint.Z; #endregion #region Viewport elimination #if DIAG data.AwayAreasEliminatedAngle = EliminatedAreasBasicAngle; data.AwayAreasEliminatedDistance = EliminatedAreasBasicDistance; data.AwayAreasPassed = PassedAreasBasic; data.AwaySegmentsEliminatedAngle = EliminatedSegmentsBasicAngle; data.AwaySegmentsEliminatedDistance = EliminatedSegmentsBasicDistance; data.AwaySegmentsPassed = PassedSegmentsBasic; data.CloseAreasEliminated = EliminatedAreasClose; data.CloseAreasPassed = PassedAreasClose; data.CloseSegmentsEliminatedAngle = EliminatedSegmentsCloseAngle; data.CloseSegmentsEliminatedDistance = EliminatedSegmentsCloseDistance; data.CloseSegmentsPassed = PassedSegmentsClose; #endif #endregion #region Performance data.FiftyFramesIn = time; #if DIAG data.GlBindTextureCalls = GlBindTextureCalls; data.GlGetErrorResult = GlGetErrorResult; #endif data.UsedMemory = Convert.ToInt32((double)Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024); #endregion #region Point/vector operations #if DIAG data.Angle = Point3D.AngleCounter; data.ArithmethicOperators = Point3D.ArithmethicOperatorsCounter; data.Clone = Point3D.CloneCounter; data.ComparativeOperators = Point3D.ComparativeOperatorsCounter; data.Distance = Point3D.DistanceCounter; data.Intersect = Point3D.IntersectCounter; data.Rotation = Point3D.RotationCounter; #endif #endregion if (_Form != null) { _Form.UpdateCounters(data); } }