Hi!
I have a fair number of single dots that I need to convert to screen space each frame and I use the following snippet of code below to do so. This is, however, the most costly lines of code in my game.
I draw one small texture at each point to define a trace line. Should I be doing this some other way? Perhaps using a transformation matrix passed into the constructor of the spritebatch used?
public Vector2 ConvertWorldToScreen(Vector2 location)
{
Vector3 t = new Vector3(location, 0);
t = _viewport.Project(t, _projection, _view, Matrix.Identity);
return new Vector2(t.X, t.Y);
}