karl- / pb_Stl

STL import/export for Unity, supporting both ASCII and Binary.
MIT License
179 stars 43 forks source link

Mesh indexformat #12

Closed AndreasLangberg closed 3 years ago

AndreasLangberg commented 5 years ago

With Unity 2017.3 they added the ability to import meshes over 65k vertices by increasing the indexformat to 32 bit. Would it be possible to manually set the indexformat on the stl importer, or have it check for vertice count > 65k and automatically flag it?

AndreasLangberg commented 5 years ago

I've done some testing, and upping MaxFacetsPerMesh to int.MaxValue/3 (It should really be uint, but libraries like Math doesn't support it, and I don't foresee a max Vertice count of 2,147,483,647 to become a problem in the immediate future) and setting mesh IndexFormat to IndexFormat.UInt32 every time it is newed seems to work.

I might provide a pull request in a bit