Guest User

Untitled

a guest
May 25th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. public Vector3 GetVertexNormal(int index)
  2.         {
  3.             Vector3 normal = Vector3.Zero;
  4.             for (int i = 0; i < Indices.Length; i++)
  5.             {
  6.                 if (Indices[i] == index)
  7.                 {
  8.                     normal += DataHelper.GetNormalFromCCWTriangle(Vertices[Indices[i - (i % 3)]], Vertices[Indices[i - (i % 3) + 1]], Vertices[Indices[i - (i % 3) + 2]]);
  9.                     i += 3 - (i % 3);
  10.                 }
  11.             }
  12.             normal.Normalize();
  13.             return normal;
  14.         }
Add Comment
Please, Sign In to add comment