Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 0; i < indices.Length / 3; i++)
- {
- int index1 = indices[i * 3];
- int index2 = indices[i * 3 + 1];
- int index3 = indices[i * 3 + 2];
- Vector3 side1 = vertices[index1].Position - vertices[index3].Position;
- Vector3 side2 = vertices[index1].Position - vertices[index2].Position;
- Vector3 normal = Vector3.Cross(side1, side2);
- vertices[index1].Normal += normal;
- vertices[index2].Normal += normal;
- vertices[index3].Normal += normal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement