Skip to content

Commit

Permalink
Implement CPlugSurface.Compound
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 committed Jul 19, 2024
1 parent 9123ccb commit 9bcd2e2
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions Src/GBX.NET/Engines/Plug/CPlugSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,47 @@ public void Write(GbxWriter w, int version = 0)
public sealed partial class Compound : ISurf, IVersionable
{
public int Version { get; set; }
public ISurf[] Surfs { get; set; } = [];
public Iso4[] SurfLocs { get; set; } = [];
public short[] SurfJoints { get; set; } = [];
public Vec3? U01 { get; set; }

public void Read(GbxReader r, int version = 0)
{
throw new NotImplementedException();
var surfCount = r.ReadInt32();
Surfs = new ISurf[surfCount];

for (var i = 0; i < surfCount; i++)
{
Surfs[i] = ReadSurf(r, version);
}

SurfLocs = r.ReadArray<Iso4>(surfCount);

if (version >= 1)
{
SurfJoints = r.ReadArray<short>();
}
}

public void Write(GbxWriter w, int version = 0)
{
throw new NotImplementedException();
w.Write(Surfs.Length);

foreach (var surf in Surfs)
{
WriteSurf(surf, w, version);
}

foreach (var surfLoc in SurfLocs)
{
w.Write(surfLoc);
}

if (version >= 1)
{
w.WriteArray(SurfJoints);
}
}
}
}

0 comments on commit 9bcd2e2

Please sign in to comment.