Improve performance of line rendering.

- Create an overload that renders a line in one color, as this allows most existing calls to be simplified. This also allows a slight performance improvement by only normalizing the components once.
- Introduce a DrawLineStrip method. This improves performance by allowing the color components to be normalized once for the whole strip, and only needing to calculate vertices once per point rather than twice since we can reuse the last result.
This commit is contained in:
RoosterDragon
2015-05-19 20:50:51 +01:00
parent 9397749118
commit b9ebeaadca
12 changed files with 138 additions and 100 deletions

View File

@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Widgets
top.Y -= 1;
}
Game.Renderer.LineRenderer.DrawLine(bottom, top, color, color);
Game.Renderer.LineRenderer.DrawLine(bottom, top, color);
}
}
else
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.Widgets
right.X -= 1;
}
Game.Renderer.LineRenderer.DrawLine(left, right, color, color);
Game.Renderer.LineRenderer.DrawLine(left, right, color);
}
}
else