Description:
Improve logging.
?Add logging for World.Draw (renderers)
?Keeping logging display from jumping around.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -186,6 +186,7 | |||||
|
186 | Drawing each tile individually is very silly when it's just a (big) square anyway. |
|
186 | Drawing each tile individually is very silly when it's just a (big) square anyway. |
|
187 | For edges: Using a dictionary with counts doesn't work either. (~5 fps) Nor using sets. |
|
187 | For edges: Using a dictionary with counts doesn't work either. (~5 fps) Nor using sets. |
|
188 | Instead need to do the fill and edge-drawing as large regions. |
|
188 | Instead need to do the fill and edge-drawing as large regions. |
|
|
189 | - Draw slows down after merely leaving it running | ||
|
189 | Structural improvements: |
|
190 | Structural improvements: |
|
190 | - Button to clear/thin debug buffers? |
|
191 | - Button to clear/thin debug buffers? |
|
191 | Take every nth to reduce counters to past 100 measurements |
|
192 | Take every nth to reduce counters to past 100 measurements |
@@ -61,6 +61,7 | |||||
|
61 | TimeSpan tileDrawTime = TimeSpan.Zero; |
|
61 | TimeSpan tileDrawTime = TimeSpan.Zero; |
|
62 | TimeSpan gridDrawTime = TimeSpan.Zero; |
|
62 | TimeSpan gridDrawTime = TimeSpan.Zero; |
|
63 | TimeSpan treeDrawTime = TimeSpan.Zero; |
|
63 | TimeSpan treeDrawTime = TimeSpan.Zero; |
|
|
64 | TimeSpan rendererDrawTime = TimeSpan.Zero; | ||
|
64 | TimeSpan updateTime = TimeSpan.Zero; |
|
65 | TimeSpan updateTime = TimeSpan.Zero; |
|
65 | TimeSpan worldUpdateTime = TimeSpan.Zero; |
|
66 | TimeSpan worldUpdateTime = TimeSpan.Zero; |
|
66 | TimeSpan simulationUpdateTime = TimeSpan.Zero; |
|
67 | TimeSpan simulationUpdateTime = TimeSpan.Zero; |
@@ -763,44 +764,6 | |||||
|
763 | this.gridDrawTime = stopWatch2.Elapsed; |
|
764 | this.gridDrawTime = stopWatch2.Elapsed; |
|
764 | #endregion draw_gridlines |
|
765 | #endregion draw_gridlines |
|
765 |
|
766 | ||
|
766 | //Gridlines |
|
||
|
767 | //Lines going down and to the right: |
|
||
|
768 | /* |
|
||
|
769 | for (int x = (int)(-this.squaresAcross/2); x < this.squaresAcross; x++) |
|
||
|
770 | { |
|
||
|
771 | int rowOffset = 0; |
|
||
|
772 |
|
|||
|
773 | float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2); |
|
||
|
774 |
|
|||
|
775 | Vector2 start = new Vector2(startX, -baseOffsetY+4); |
|
||
|
776 | Vector2 stop = new Vector2(startX + this.squaresAcross* Tile.TileStepX/2, |
|
||
|
777 | this.squaresDown*Tile.TileStepY- baseOffsetY+4); |
|
||
|
778 |
|
|||
|
779 |
|
|||
|
780 |
|
|||
|
781 | Line.drawLine(batch, |
|
||
|
782 | Line.departurePoint(stop, start, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), |
|
||
|
783 | Line.departurePoint(start, stop, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), |
|
||
|
784 | Color.White, 0.8f); |
|
||
|
785 |
|
|||
|
786 | } |
|
||
|
787 | //Lines going down and to the left: |
|
||
|
788 | for (int x = 0; x < (int)(1.5*this.squaresAcross); x++) |
|
||
|
789 | { |
|
||
|
790 |
|
|||
|
791 | float startX = (x * Tile.TileStepX) + baseOffsetX - (Tile.TileStepX / 2); |
|
||
|
792 |
|
|||
|
793 | Vector2 start_reverse = new Vector2(startX, -baseOffsetY + 4); |
|
||
|
794 | Vector2 stop_reverse = new Vector2(startX + -(this.squaresAcross * Tile.TileStepX / 2), |
|
||
|
795 | (this.squaresDown * Tile.TileStepY) - baseOffsetY + 4); |
|
||
|
796 |
|
|||
|
797 | Line.drawLine(batch, |
|
||
|
798 | Line.departurePoint(stop_reverse, start_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), |
|
||
|
799 | Line.departurePoint(start_reverse, stop_reverse, this.squaresAcross * Tile.TileWidth, this.squaresDown * Tile.TileHeight), |
|
||
|
800 | Color.White, 0.8f); |
|
||
|
801 |
|
|||
|
802 | } |
|
||
|
803 | */ |
|
||
|
804 | tileBatch.Begin(SpriteSortMode.BackToFront, |
|
767 | tileBatch.Begin(SpriteSortMode.BackToFront, |
|
805 | BlendState.AlphaBlend, |
|
768 | BlendState.AlphaBlend, |
|
806 | null, |
|
769 | null, |
@@ -890,9 +853,13 | |||||
|
890 | drawTileAt(3, 2, 140, 2); |
|
853 | drawTileAt(3, 2, 140, 2); |
|
891 | #endif |
|
854 | #endif |
|
892 |
|
855 | ||
|
|
856 | stopWatch2 = new Stopwatch(); | ||
|
|
857 | stopWatch2.Start(); | ||
|
893 | World.Draw(); |
|
858 | World.Draw(); |
|
894 | // _imGuiRenderer.AfterLayout(); |
|
859 | // _imGuiRenderer.AfterLayout(); |
|
895 | tileBatch.End(); |
|
860 | tileBatch.End(); |
|
|
861 | stopWatch2.Stop(); | ||
|
|
862 | this.rendererDrawTime = stopWatch2.Elapsed; | ||
|
896 |
|
863 | ||
|
897 | #region draw_header |
|
864 | #region draw_header |
|
898 | batch.Begin(SpriteSortMode.BackToFront, |
|
865 | batch.Begin(SpriteSortMode.BackToFront, |
@@ -1053,6 +1020,7 | |||||
|
1053 | treeDrawTime = this.treeDrawTime, |
|
1020 | treeDrawTime = this.treeDrawTime, |
|
1054 | gridDrawTime = this.gridDrawTime, |
|
1021 | gridDrawTime = this.gridDrawTime, |
|
1055 | tileDrawTime = this.tileDrawTime, |
|
1022 | tileDrawTime = this.tileDrawTime, |
|
|
1023 | rendererDrawTime = this.rendererDrawTime, | ||
|
1056 | updateTime = this.updateTime, |
|
1024 | updateTime = this.updateTime, |
|
1057 | worldUpdateTime = this.worldUpdateTime, |
|
1025 | worldUpdateTime = this.worldUpdateTime, |
|
1058 | simulationUpdateTime = this.simulationUpdateTime, |
|
1026 | simulationUpdateTime = this.simulationUpdateTime, |
@@ -19,6 +19,7 | |||||
|
19 | public TimeSpan treeDrawTime; |
|
19 | public TimeSpan treeDrawTime; |
|
20 | public TimeSpan gridDrawTime; |
|
20 | public TimeSpan gridDrawTime; |
|
21 | public TimeSpan tileDrawTime; |
|
21 | public TimeSpan tileDrawTime; |
|
|
22 | public TimeSpan rendererDrawTime; | ||
|
22 | public Vector2 cameraPosition; |
|
23 | public Vector2 cameraPosition; |
|
23 | public int treeCount; |
|
24 | public int treeCount; |
|
24 | public Vector2 mouseGrid; |
|
25 | public Vector2 mouseGrid; |
@@ -226,10 +227,11 | |||||
|
226 |
|
227 | ||
|
227 | ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps)); |
|
228 | ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps)); |
|
228 | ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString())); |
|
229 | ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString())); |
|
229 | ImGui.Text(string.Format("\tTree: {0:F3}; Grid: {1:F3}; Tile: {2:F3}", |
|
230 | ImGui.Text(string.Format("\tTree: {0,7:F3}; Grid: {1,7:F3}; Tile: {2,7:F3}\n\t Renderer: {3,7:F3}", |
|
230 | debugInfo.treeDrawTime.TotalMilliseconds.ToString(), |
|
231 | debugInfo.treeDrawTime.TotalMilliseconds.ToString(), |
|
231 | debugInfo.gridDrawTime.TotalMilliseconds.ToString(), |
|
232 | debugInfo.gridDrawTime.TotalMilliseconds.ToString(), |
|
232 |
debugInfo.tileDrawTime.TotalMilliseconds.ToString() |
|
233 | debugInfo.tileDrawTime.TotalMilliseconds.ToString(), |
|
|
234 | debugInfo.rendererDrawTime.TotalMilliseconds.ToString())); | ||
|
233 | ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString())); |
|
235 | ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString())); |
|
234 | ImGui.Text(string.Format("\tWorld: {0:F3}; Simulation: {1:F3}", |
|
236 | ImGui.Text(string.Format("\tWorld: {0:F3}; Simulation: {1:F3}", |
|
235 | debugInfo.worldUpdateTime.TotalMilliseconds.ToString(), |
|
237 | debugInfo.worldUpdateTime.TotalMilliseconds.ToString(), |
You need to be logged in to leave comments.
Login now