igorseabra4 / HeroesPowerPlant

Level editor for Sonic Heroes (PC, GameCube, XBOX, PS2) and Shadow the Hedgehog (GameCube, XBOX, PS2). Integrates editors for various file types with a 3D view of the stage.
27 stars 14 forks source link

[Enhancement] GameCube Tri/Vert Count Optimization / Ineffiency Fix #66

Open dreamsyntax opened 1 month ago

dreamsyntax commented 1 month ago

Per https://github.com/igorseabra4/HeroesPowerPlant/issues/60#issuecomment-2415300585

Geo optimization findings:

Xbox native and PC native 'obj' -> export -> import = 1:1 tri/vert
Gamecube native 'obj' -> export -> import = increased tri/vert
Not tri-strip related.
GC specific code has an issue in RWFile or importer func

It may be worth still exploring tri-strip support, but first this GC inconsistency must be fixed.
dreamsyntax commented 1 month ago

In BSP_IO_Heroes.cs

        private static void GetAtomicTriangleList(StreamWriter OBJWriter, AtomicSector_0009 AtomicSector, ref List<Triangle> triangleList, ref int totalVertexIndices, bool isCollision, bool flipUVs)
        {
            if (AtomicSector.atomicSectorStruct.isNativeData)
            {
                GetNativeTriangleList(OBJWriter, AtomicSector.atomicSectorExtension, ref triangleList, ref totalVertexIndices, flipUVs);
                return;
            }

            //Write vertex list to obj

The above code only runs for GameCube on export. Xbox never enters in the

if (AtomicSector.atomicSectorStruct.isNativeData)

section of the code.