本文整理汇总了C#中XMVector.Saturate方法的典型用法代码示例。如果您正苦于以下问题:C# XMVector.Saturate方法的具体用法?C# XMVector.Saturate怎么用?C# XMVector.Saturate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMVector
的用法示例。
在下文中一共展示了XMVector.Saturate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SrgbToRgb
public static XMVector SrgbToRgb(XMVector srgb)
{
XMVector cutoff = XMVector.FromFloat(0.04045f, 0.04045f, 0.04045f, 1.0f);
XMVector invLinear = XMVector.FromFloat(1.0f / 12.92f, 1.0f / 12.92f, 1.0f / 12.92f, 1.0f);
XMVector scale = XMVector.FromFloat(1.0f / 1.055f, 1.0f / 1.055f, 1.0f / 1.055f, 1.0f);
XMVector bias = XMVector.FromFloat(0.055f, 0.055f, 0.055f, 0.0f);
XMVector gamma = XMVector.FromFloat(2.4f, 2.4f, 2.4f, 1.0f);
XMVector v = srgb.Saturate();
XMVector v0 = XMVector.Multiply(v, invLinear);
XMVector v1 = XMVector.Pow(XMVector.Multiply(XMVector.Add(v, bias), scale), gamma);
XMVector select = XMVector.Greater(v, cutoff);
v = XMVector.Select(v0, v1, select);
return XMVector.Select(srgb, v, XMGlobalConstants.Select1110);
}
示例2: RgbToSrgb
public static XMVector RgbToSrgb(XMVector rgb)
{
XMVector cutoff = XMVector.FromFloat(0.0031308f, 0.0031308f, 0.0031308f, 1.0f);
XMVector linear = XMVector.FromFloat(12.92f, 12.92f, 12.92f, 1.0f);
XMVector scale = XMVector.FromFloat(1.055f, 1.055f, 1.055f, 1.0f);
XMVector bias = XMVector.FromFloat(0.055f, 0.055f, 0.055f, 0.0f);
XMVector invGamma = XMVector.FromFloat(1.0f / 2.4f, 1.0f / 2.4f, 1.0f / 2.4f, 1.0f);
XMVector v = rgb.Saturate();
XMVector v0 = XMVector.Multiply(v, linear);
XMVector v1 = XMVector.Subtract(XMVector.Multiply(scale, XMVector.Pow(v, invGamma)), bias);
XMVector select = XMVector.Less(v, cutoff);
v = XMVector.Select(v1, v0, select);
return XMVector.Select(rgb, v, XMGlobalConstants.Select1110);
}