本文整理汇总了C#中ITexture.EvaluateAsync方法的典型用法代码示例。如果您正苦于以下问题:C# ITexture.EvaluateAsync方法的具体用法?C# ITexture.EvaluateAsync怎么用?C# ITexture.EvaluateAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITexture
的用法示例。
在下文中一共展示了ITexture.EvaluateAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BumpAsync
/// <summary>
///
/// </summary>
/// <param name="d"></param>
/// <param name="dgGeom"></param>
/// <param name="dgShading"></param>
/// <param name="dgBump"></param>
/// <returns></returns>
public static async Task<DifferentialGeometry> BumpAsync (ITexture<double> d, DifferentialGeometry dgGeom, DifferentialGeometry dgShading)
{
var dgBump = new DifferentialGeometry ();
var dgEval = new DifferentialGeometry (dgShading);
var du = .5 * (Math.Abs (dgShading.dudx) + Math.Abs (dgShading.dudy));
if (du == 0.0)
du = .01;
dgEval.p = dgShading.p + du * dgShading.dpdu;
dgEval.u = dgShading.u + du;
dgEval.nn = null;// TODO
var uDisplace = await d.EvaluateAsync (dgEval);
var dv = .5 * (Math.Abs (dgShading.dvdx) + Math.Abs (dgShading.dvdy));
//
var vDisplace = await d.EvaluateAsync (dgEval);
var displace = await d.EvaluateAsync (dgShading);
dgBump = new DifferentialGeometry (dgShading);
dgBump.dpdu = dgShading.dpdu + (uDisplace - displace) / du * new Vector (dgShading.nn) + displace * new Vector (dgShading.dndu);
dgBump.dpdv = dgShading.dpdv + (vDisplace - displace) / dv * new Vector (dgShading.nn) + displace * new Vector (dgShading.dndv);
if (dgShading.Shape.ReverseOrientation ^ dgShading.Shape.TransformSwapsHandedness)
dgBump.nn *= -1.0;
dgBump.nn = Util.FaceForward (dgBump.nn, dgGeom.nn);
return dgBump;
}