private void DrawMarksLabels() { // The marks' labels foreach (KeyValuePair <String, DebugMark> m in markTable) { DebugMark mark = m.Value as DebugMark; if (mark.ScreenSpace == true) { if (mark.ScreenSpace == false) { continue; } spriteBatch.Draw(markTexture, mark.ScreenSpacePosition - new Vector2((int)(markTexture.Width * .5f), (int)(markTexture.Height * .5f)), mark.color); spriteBatch.Draw(mark.label, mark.ScreenSpacePosition + new Vector2((int)(markTexture.Width * .5f), 0), Color.White); } else { Texture2D texture = mark.label; Vector3 position = Vector3.Transform(mark.mark[0].Position, Matrix.Identity * (GearsetResources.View * GearsetResources.Projection)); if (position.Z < 0) { continue; } Rectangle dest = new Rectangle((int)(((position.X / position.Z + 1) / 2) * GearsetResources.Device.Viewport.Width), (int)(((-position.Y / position.Z + 1) / 2) * GearsetResources.Device.Viewport.Height), (int)(texture.Width), (int)(texture.Height)); //Color color = new Color((byte)(255 - position.Z * 10), (byte)(255 - position.Z * 10), (byte)(255 - position.Z * 10)); spriteBatch.Draw(texture, dest, Color.White * GearsetResources.GlobalAlpha); } } }
private void DrawMarks() { // Draw the marks. foreach (KeyValuePair <String, DebugMark> m in markTable) { DebugMark mark = m.Value as DebugMark; if (mark.ScreenSpace == true) { continue; } switch (((DebugMark)m.Value).Type) { case MarkType.Cross: GearsetResources.Device.DrawUserPrimitives <VertexPositionColor>(PrimitiveType.LineList, ((DebugMark)m.Value).mark, 0, 3); break; } } }