Skip to content

Commit

Permalink
New additions to PolygonFormatEditor menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-HyperCake committed Sep 1, 2024
1 parent 91d1a8f commit dccce01
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 92 deletions.
42 changes: 39 additions & 3 deletions Smash Forge/Filetypes/Models/Nuds/Polygon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,10 @@ public void AddDefaultMaterial()
mat.textures.Add(MatTexture.GetDefault());
}

public List<int> GetRenderingVertexIndices()
public List<int> GetTriangles()
{
if (strip == (int)PrimitiveTypes.Triangles)
{
displayFaceSize = vertexIndices.Count;
return vertexIndices;
}
else if (strip == (int)PrimitiveTypes.TriangleStrip)
Expand Down Expand Up @@ -384,14 +383,51 @@ public List<int> GetRenderingVertexIndices()
}
} while (p < this.vertexIndices.Count);

displayFaceSize = vertexIndices.Count;
return vertexIndices;
}
else
{
throw new NotImplementedException("Face type not supported: " + strip);
}
}

public List<int> GetTriangleStrip()
{
if (strip == (int)PrimitiveTypes.TriangleStrip)
{
return vertexIndices;
}
else if (strip == (int)PrimitiveTypes.Triangles)
{
// TODO: Come up with a proper algorithm.
// This is the simplest possible form, as it merely puts
// the triangles directly into the strip format.
List<int> vertexIndices = new List<int>();

for (int p = 0;;)
{
vertexIndices.Add(this.vertexIndices[p++]);
vertexIndices.Add(this.vertexIndices[p++]);
vertexIndices.Add(this.vertexIndices[p++]);
if (p < this.vertexIndices.Count)
vertexIndices.Add(0xFFFF);
else
break;
}
return vertexIndices;
}
else
{
throw new NotImplementedException("Face type not supported: " + strip);
}
}

public List<int> GetRenderingVertexIndices()
{
List<int> vertexIndices = GetTriangles();
displayFaceSize = vertexIndices.Count;
return vertexIndices;
}
}
}
}
Expand Down
94 changes: 76 additions & 18 deletions Smash Forge/GUI/Menus/PolygonFormatEditor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dccce01

Please sign in to comment.