diff --git a/Dalamud/Game/Gui/GameGui.cs b/Dalamud/Game/Gui/GameGui.cs index 1eaa9c60b..6603dd911 100644 --- a/Dalamud/Game/Gui/GameGui.cs +++ b/Dalamud/Game/Gui/GameGui.cs @@ -191,7 +191,7 @@ namespace Dalamud.Game.Gui /// Coordinates in the world. /// Converted coordinates. /// True if worldPos corresponds to a position in front of the camera. - public bool WorldToScreen(SharpDX.Vector3 worldPos, out SharpDX.Vector2 screenPos) + public bool WorldToScreen(Vector3 worldPos, out Vector2 screenPos) { // Get base object with matrices var matrixSingleton = this.getMatrixSingleton(); @@ -212,9 +212,10 @@ namespace Dalamud.Game.Gui height = *(rawMatrix + 1); } - SharpDX.Vector3.Transform(ref worldPos, ref viewProjectionMatrix, out SharpDX.Vector3 pCoords); + var worldPosDx = worldPos.ToSharpDX(); + SharpDX.Vector3.Transform(ref worldPosDx, ref viewProjectionMatrix, out SharpDX.Vector3 pCoords); - screenPos = new SharpDX.Vector2(pCoords.X / pCoords.Z, pCoords.Y / pCoords.Z); + screenPos = new Vector2(pCoords.X / pCoords.Z, pCoords.Y / pCoords.Z); screenPos.X = (0.5f * width * (screenPos.X + 1f)) + windowPos.X; screenPos.Y = (0.5f * height * (1f - screenPos.Y)) + windowPos.Y; @@ -224,22 +225,6 @@ namespace Dalamud.Game.Gui screenPos.Y > windowPos.Y && screenPos.Y < windowPos.Y + height; } - /// - /// Converts in-world coordinates to screen coordinates (upper left corner origin). - /// - /// Coordinates in the world. - /// Converted coordinates. - /// True if worldPos corresponds to a position in front of the camera. - /// - /// This overload requires a conversion to SharpDX vectors, however the penalty should be negligible. - /// - public bool WorldToScreen(Vector3 worldPos, out Vector2 screenPos) - { - var result = this.WorldToScreen(worldPos.ToSharpDX(), out var sharpScreenPos); - screenPos = sharpScreenPos.ToSystem(); - return result; - } - /// /// Converts screen coordinates to in-world coordinates via raycasting. /// @@ -247,7 +232,7 @@ namespace Dalamud.Game.Gui /// Converted coordinates. /// How far to search for a collision. /// True if successful. On false, worldPos's contents are undefined. - public bool ScreenToWorld(SharpDX.Vector2 screenPos, out SharpDX.Vector3 worldPos, float rayDistance = 100000.0f) + public bool ScreenToWorld(Vector2 screenPos, out Vector3 worldPos, float rayDistance = 100000.0f) { // The game is only visible in the main viewport, so if the cursor is outside // of the game window, do not bother calculating anything @@ -321,7 +306,7 @@ namespace Dalamud.Game.Gui } } - worldPos = new SharpDX.Vector3 + worldPos = new Vector3 { X = worldPosArray[0], Y = worldPosArray[1], @@ -332,23 +317,6 @@ namespace Dalamud.Game.Gui return isSuccess; } - /// - /// Converts screen coordinates to in-world coordinates via raycasting. - /// - /// Screen coordinates. - /// Converted coordinates. - /// How far to search for a collision. - /// True if successful. On false, worldPos's contents are undefined. - /// - /// This overload requires a conversion to SharpDX vectors, however the penalty should be negligible. - /// - public bool ScreenToWorld(Vector2 screenPos, out Vector3 worldPos, float rayDistance = 100000.0f) - { - var result = this.ScreenToWorld(screenPos.ToSharpDX(), out var sharpworldPos); - worldPos = sharpworldPos.ToSystem(); - return result; - } - /// /// Gets a pointer to the game's UI module. ///