mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
71c18a9ad1
When vertices are not welded (the default IfcConvert path when normals are requested), IfcGeom::Representation::Triangulation stores one position and one normal per triangle corner, so both arrays repeat the same values many times. The OBJ and COLLADA formats support indexing positions, normals and texture coordinates independently, but the serializers were reusing a single combined index for all of them, inflating output size without needing to. Positions and normals are now deduplicated by exact value within each serializer and referenced through their own index streams (UV indices are left untouched, since a UV depends on both position and normal together). Verified against a real IFC model (test/input/IfcReinforcingBar.ifc): DAE output drops from 48.4MB to 20.6MB (-57.5%) and OBJ output from 51.3MB to 23.6MB (-54.0%), with the decoded position/normal value for every triangle corner checked byte-identical to the unpatched output. Addresses #46. Generated with the assistance of an AI coding tool.