Skip to content

Commit

Permalink
GCAttach
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Dec 18, 2024
1 parent edc901f commit 7d1928c
Show file tree
Hide file tree
Showing 3 changed files with 539 additions and 349 deletions.
22 changes: 11 additions & 11 deletions Libraries/SAEditorCommon/Import/AssimpStuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,12 @@ public static List<int> ExportAttachMeshes(this Attach attach, Scene scene, stri
if (attach is GC.GCAttach gcAttach)
{
int nameMeshIndex = 0;
foreach (GC.GCMesh m in gcAttach.opaqueMeshes)
foreach (GC.GCMesh m in gcAttach.OpaqueMeshes)
{
result.Add(scene.Meshes.Count);
scene.Meshes.Add(ExportGCMesh(gcAttach, m, scene, texInfo, ref nameMeshIndex));
}
foreach (GC.GCMesh m in gcAttach.translucentMeshes)
foreach (GC.GCMesh m in gcAttach.TranslucentMeshes)
{
result.Add(scene.Meshes.Count);
scene.Meshes.Add(ExportGCMesh(gcAttach, m, scene, texInfo, ref nameMeshIndex));
Expand Down Expand Up @@ -545,10 +545,10 @@ private static Assimp.Mesh ExportGCMesh(GC.GCAttach gcAttach, GC.GCMesh m, Scene
}
}

List<GC.IOVtx> gcPositions = gcAttach.vertexData.Find(x => x.attribute == GC.GCVertexAttribute.Position)?.data;
List<GC.IOVtx> gcNormals = gcAttach.vertexData.Find(x => x.attribute == GC.GCVertexAttribute.Normal)?.data;
List<GC.IOVtx> gcColors = gcAttach.vertexData.Find(x => x.attribute == GC.GCVertexAttribute.Color0)?.data;
List<GC.IOVtx> gcUVs = gcAttach.vertexData.Find(x => x.attribute == GC.GCVertexAttribute.Tex0)?.data;
List<GC.IOVtx> gcPositions = gcAttach.VertexData.Find(x => x.attribute == GC.GCVertexAttribute.Position)?.data;
List<GC.IOVtx> gcNormals = gcAttach.VertexData.Find(x => x.attribute == GC.GCVertexAttribute.Normal)?.data;
List<GC.IOVtx> gcColors = gcAttach.VertexData.Find(x => x.attribute == GC.GCVertexAttribute.Color0)?.data;
List<GC.IOVtx> gcUVs = gcAttach.VertexData.Find(x => x.attribute == GC.GCVertexAttribute.Tex0)?.data;

foreach (GC.GCPrimitive prim in m.primitives)
{
Expand Down Expand Up @@ -1510,29 +1510,29 @@ private static GC.GCAttach AssimpImportGC(List<Material> materials, List<Assimp.
//VertexAttribute stuff
GC.GCVertexSet vtxPositions = new GC.GCVertexSet(GC.GCVertexAttribute.Position);
vtxPositions.data.AddRange(gcvertices);
attach.vertexData.Add(vtxPositions);
attach.VertexData.Add(vtxPositions);

if (texcoords.Count > 0)
{
GC.GCVertexSet vtxUV = new GC.GCVertexSet(GC.GCVertexAttribute.Tex0);
vtxUV.data.AddRange(texcoords);
attach.vertexData.Add(vtxUV);
attach.VertexData.Add(vtxUV);
}

if (colors.Count > 0)
{
GC.GCVertexSet vtxColors = new GC.GCVertexSet(GC.GCVertexAttribute.Color0);
vtxColors.data.AddRange(colors);
attach.vertexData.Add(vtxColors);
attach.VertexData.Add(vtxColors);
}
else
{
GC.GCVertexSet vtxNormals = new GC.GCVertexSet(GC.GCVertexAttribute.Normal);
vtxNormals.data.AddRange(gcnormals);
attach.vertexData.Add(vtxNormals);
attach.VertexData.Add(vtxNormals);
}

attach.opaqueMeshes.AddRange(gcmeshes);
attach.OpaqueMeshes.AddRange(gcmeshes);
return attach;
}
#endregion
Expand Down
Loading

0 comments on commit 7d1928c

Please sign in to comment.