private Color ModificationValueColor(ModificationValue val, bool depth) { float rangesize = (rangeMax - rangeMin); float r = val.col.value.f[0]; float g = val.col.value.f[1]; float b = val.col.value.f[2]; if (numChannels == 1) { r = g = b = val.col.value.f[channelIdx]; } else { if (!visibleChannels[0]) { r = 0.0f; } if (!visibleChannels[1]) { g = 0.0f; } if (!visibleChannels[2]) { b = 0.0f; } } r = Helpers.Clamp((r - rangeMin) / rangesize, 0.0f, 1.0f); g = Helpers.Clamp((g - rangeMin) / rangesize, 0.0f, 1.0f); b = Helpers.Clamp((b - rangeMin) / rangesize, 0.0f, 1.0f); if (depth) { r = g = b = Helpers.Clamp((val.depth - rangeMin) / rangesize, 0.0f, 1.0f); } { r = (float)Math.Pow(r, 1.0f / 2.2f); g = (float)Math.Pow(g, 1.0f / 2.2f); b = (float)Math.Pow(b, 1.0f / 2.2f); } return(Color.FromArgb((int)(255.0f * r), (int)(255.0f * g), (int)(255.0f * b))); }
private string ModificationValueString(ModificationValue val, ResourceFormat fmt, bool depth) { string s = ""; bool uintTex = (fmt.compType == FormatComponentType.UInt); bool sintTex = (fmt.compType == FormatComponentType.SInt); int numComps = (int)(fmt.compCount); if (!depth) { if (uintTex) { for (int i = 0; i < numComps; i++) { s += colourLetterPrefix[i] + val.col.value.u[i].ToString() + "\n"; } } else if (sintTex) { for (int i = 0; i < numComps; i++) { s += colourLetterPrefix[i] + val.col.value.i[i].ToString() + "\n"; } } else { for (int i = 0; i < numComps; i++) { s += colourLetterPrefix[i] + Formatter.Format(val.col.value.f[i]) + "\n"; } } } if (val.depth >= 0.0f) { s += "\nD: " + Formatter.Format(val.depth); } else if (val.depth < -1.5f) { s += "\nD: ?"; } else { s += "\nD: -"; } if (val.stencil >= 0) { s += String.Format("\nS: 0x{0:X2}", val.stencil); } else if (val.stencil == -2) { s += "\nS: ?"; } else { s += "\nS: -"; } return(s); }