From 5f3b535d3112363c535bd9fb6f7474787bfb8d3f Mon Sep 17 00:00:00 2001 From: loosche Date: Fri, 19 Dec 2014 00:11:19 -0800 Subject: [PATCH] Add normalized UV coordinates to the TextureViewer window. --- renderdocui/Windows/TextureViewer.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/renderdocui/Windows/TextureViewer.cs b/renderdocui/Windows/TextureViewer.cs index 641fc0c2b..433303e0b 100644 --- a/renderdocui/Windows/TextureViewer.cs +++ b/renderdocui/Windows/TextureViewer.cs @@ -1411,7 +1411,18 @@ namespace renderdocui.Windows if (m_TexDisplay.FlipY) y = (int)tex.height - y; - string hoverCoords = String.Format("{0}, {1}", m_CurHoverPixel.X >> (int)m_TexDisplay.mip, y); + int x = m_CurHoverPixel.X >> (int)m_TexDisplay.mip; + float invWidth = tex.width > 0 ? 1.0f / tex.width : 0.0f; + float invHeight = tex.height > 0 ? 1.0f /tex.height : 0.0f; + + int minCount = m_Core.Config.Formatter_MinFigures; + int maxCount = m_Core.Config.Formatter_MaxFigures; + string minFigures= new String('0', minCount); + string maxFigures= new String('#', maxCount-minCount); + string formatString= String.Format("{{0}}, {{1}} ({{2:0.{0}{1}}}, {{3:0.{2}{3}}})", + minFigures, maxFigures, minFigures, maxFigures); + + string hoverCoords = String.Format(formatString, x, y, x * invWidth, y * invHeight); string statusText = "Hover - " + hoverCoords; if (m_CurHoverPixel.X > tex.width || m_CurHoverPixel.Y > tex.height || m_CurHoverPixel.X < 0 || m_CurHoverPixel.Y < 0)