Need .ToIntArray method for Mesh.Vertex.Colors

@stevebaer, @brian,

Currently all the mesh data that can be exported to a .OBJ file has a .ToIntArray or .ToFloatArray method except for Mesh.Vertex.Colors. As a consequence, accessing the colors takes 10X longer than the mesh faces, vertices, texture coordinates or vertex normals.

In the case of a mesh with 18M faces, it takes 0.44 sec to access the faces and 0.15 sec to access the vertices, textures or normals. These can all be accessed in parallel (using Tasks.Parallel.ForEach) for a total elapsed time of about 0.5 sec. But if colors are added into the mix, the time jumps out to 3 sec.

The .ToIntArray or .ToFloatArray methods for faces/vertices/textures/normals would be of more benefit if a .ToIntArray method was provided for colors.

The best implementation of a .ToIntArray method is to provide an array of 32-bit colors. This is the fastest format for use with Color.ToArgb when adding colors to a mesh and for passing to a DLL or dylib.

I checked Rhino 7 WIP and see it is the same as Rhino 6; There is no .ToIntArray method for Mesh.VertexColors.

Oh Rhino, you’re breaking my heart
You’re shaking my confidence daily
Oh, Rhino, I’m down on my knees
I’m begging you please to add colors

(Adapted from Simon & Garfunkel Cecilia)

Regards,
Terry.

I added this request to our issue tracker at
https://mcneel.myjetbrains.com/youtrack/issue/RH-54754