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