コード例 #1
0
 /// <summary>
 /// 屏幕空间插值生成新顶点,此时已近经过透视除法,z信息已经没有作用
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <param name="t"></param>
 /// <returns></returns>
 public static CVertex ScreenSpaceLerpVertex(CVertex v1, CVertex v2, float t)
 {
     CVertex v = new CVertex();
     float   u = MathUntil.Lerp(left.u, right.u, lerpFactor) * w * (_texture.Width - 1);
     float   v = MathUntil.Lerp(left.v, right.v, lerpFactor) * w * (_texture.Height - 1);
     float   r = MathUntil.Lerp(left.color.r, right.color.r, lerpFactor) * w * 255;
     float   g = MathUntil.Lerp(left.color.g, right.color.g, lerpFactor) * w * 255;
     float   b = MathUntil.Lerp(left.color.b, right.color.b, lerpFactor) * w * 255;
 }
コード例 #2
0
 /// <summary>
 /// 屏幕空间插值生成新顶点,此时已近经过透视除法,z信息已经没有作用
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <param name="t"></param>
 /// <returns></returns>
 public static void ScreenSpaceLerpVertex(ref CVertex v, CVertex v1, CVertex v2, float t)
 {
     v.onePerZ = MathUntil.Lerp(v1.onePerZ, v2.onePerZ, t);
     //
     v.u = MathUntil.Lerp(v1.u, v2.u, t);
     v.v = MathUntil.Lerp(v1.v, v2.v, t);
     //
     v.color.r = MathUntil.Lerp(v1.color.r, v2.color.r, t);
     v.color.g = MathUntil.Lerp(v1.color.g, v2.color.g, t);
     v.color.b = MathUntil.Lerp(v1.color.b, v2.color.b, t);
 }
コード例 #3
0
 /// <summary>
 /// 屏幕空间插值生成新顶点,此时已近经过透视除法,z信息已经没有作用
 /// </summary>
 /// <param name="v1"></param>
 /// <param name="v2"></param>
 /// <param name="t"></param>
 /// <returns></returns>
 public static void ScreenSpaceLerpVertex(ref Vertex v, Vertex v1, Vertex v2, float t)
 {
     v.onePerZ = MathUntil.Lerp(v1.onePerZ, v2.onePerZ, t);
     //
     v.u = MathUntil.Lerp(v1.u, v2.u, t);
     v.v = MathUntil.Lerp(v1.v, v2.v, t);
     //
     v.vcolor = MathUntil.Lerp(v1.vcolor, v2.vcolor, t);
     //
     v.lightingColor = MathUntil.Lerp(v1.lightingColor, v2.lightingColor, t);
 }