mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 15:14:55 +00:00
Add some face checks to check for valid triangles.
Should fix common errors from tangent/bitangents and normals calculation.
This commit is contained in:
parent
7c9d8cfd98
commit
ce06922fd7
1 changed files with 12 additions and 0 deletions
|
@ -316,6 +316,9 @@ namespace Toolbox.Library
|
|||
|
||||
for (int i = 0; i < faces.Count; i += 3)
|
||||
{
|
||||
if (faces.Count <= i + 2)
|
||||
continue;
|
||||
|
||||
Vertex v1 = vertices[faces[i]];
|
||||
Vertex v2 = vertices[faces[i + 1]];
|
||||
Vertex v3 = vertices[faces[i + 2]];
|
||||
|
@ -415,6 +418,9 @@ namespace Toolbox.Library
|
|||
|
||||
for (int v = 0; v < f.Count; v += 3)
|
||||
{
|
||||
if (f.Count <= i + 2)
|
||||
continue;
|
||||
|
||||
Vertex v1 = Shapes[s].vertices[f[v]];
|
||||
Vertex v2 = Shapes[s].vertices[f[v + 1]];
|
||||
Vertex v3 = Shapes[s].vertices[f[v + 2]];
|
||||
|
@ -497,6 +503,9 @@ namespace Toolbox.Library
|
|||
|
||||
for (int i = 0; i < f.Count; i += 3)
|
||||
{
|
||||
if (f.Count <= i + 2)
|
||||
continue;
|
||||
|
||||
Vertex v1 = vertices[f[i]];
|
||||
Vertex v2 = vertices[f[i + 1]];
|
||||
Vertex v3 = vertices[f[i + 2]];
|
||||
|
@ -559,6 +568,9 @@ namespace Toolbox.Library
|
|||
List<int> f = GetFaces();
|
||||
for (int i = 0; i < f.Count; i += 3)
|
||||
{
|
||||
if (f.Count <= i + 2)
|
||||
continue;
|
||||
|
||||
Vertex v1 = vertices[f[i]];
|
||||
Vertex v2 = vertices[f[i + 1]];
|
||||
Vertex v3 = vertices[f[i + 2]];
|
||||
|
|
Loading…
Reference in a new issue