1
0
mirror of synced 2024-12-01 02:27:22 +01:00

Some fixes to .mod

This commit is contained in:
KillzXGaming 2020-01-26 19:32:40 -05:00
parent 0488b29ddf
commit 53bbe3c45a
2 changed files with 18 additions and 5 deletions

View File

@ -85,6 +85,8 @@ namespace FirstPlugin
public DrawableContainer DrawableContainer = new DrawableContainer(); public DrawableContainer DrawableContainer = new DrawableContainer();
private STSkeleton Skeleton;
private Vertex[] Vertices; private Vertex[] Vertices;
private Vertex[] VertexNormals; private Vertex[] VertexNormals;
private Vertex[] Colors; private Vertex[] Colors;
@ -139,8 +141,10 @@ namespace FirstPlugin
//Set renderer //Set renderer
//Load it to a drawables list //Load it to a drawables list
Renderer = new MDL_Renderer(); Renderer = new MDL_Renderer();
Skeleton = new STSkeleton();
DrawableContainer.Name = FileName; DrawableContainer.Name = FileName;
DrawableContainer.Drawables.Add(Renderer); DrawableContainer.Drawables.Add(Renderer);
DrawableContainer.Drawables.Add(Skeleton);
using (var reader = new FileReader(stream)) using (var reader = new FileReader(stream))
{ {
@ -294,11 +298,21 @@ namespace FirstPlugin
List<Triangle> currentPolygons = ToTris(polygons, faceType); List<Triangle> currentPolygons = ToTris(polygons, faceType);
Console.WriteLine($"faceType {faceType} polygons {polygons.Length} ");
foreach (Triangle triangle in currentPolygons) foreach (Triangle triangle in currentPolygons)
{ {
polyGroup.faces.Add(triangle.C); if (faceType == 0x98)
polyGroup.faces.Add(triangle.B); {
polyGroup.faces.Add(triangle.A); polyGroup.faces.Add(triangle.B);
polyGroup.faces.Add(triangle.C);
polyGroup.faces.Add(triangle.A);
}
else
{
polyGroup.faces.Add(triangle.C);
polyGroup.faces.Add(triangle.B);
polyGroup.faces.Add(triangle.A);
}
} }
} }
} }

View File

@ -63,7 +63,7 @@ namespace FirstPlugin
LoadFile(stream); LoadFile(stream);
for (int i = 0; i < TextureInfos.Count; i++) { for (int i = 0; i < TextureInfos.Count; i++) {
string name = Path.GetFileNameWithoutExtension(FileName); string name = Path.GetFileNameWithoutExtension(FileName);
TextureInfos[0].Text = TextureInfos.Count == 1 ? name : $"{name}_image{i}"; TextureInfos[i].Text = TextureInfos.Count == 1 ? name : $"{name}_image{i}";
} }
ContextMenuStrip = new STContextMenuStrip(); ContextMenuStrip = new STContextMenuStrip();
@ -241,7 +241,6 @@ namespace FirstPlugin
while (reader.Position < reader.BaseStream.Length) while (reader.Position < reader.BaseStream.Length)
{ {
Console.WriteLine("BLOCK POS " + reader.Position);
BlockHeader blockHeader = new BlockHeader(); BlockHeader blockHeader = new BlockHeader();
blockHeader.Read(reader); blockHeader.Read(reader);
Blocks.Add(blockHeader); Blocks.Add(blockHeader);