Hi Adrian,
This was a more productive day. I've learned something about obj files
and my previous code for generating them was incorrect.
obj file can support colored faces but in the form of x y z r g b. The
'p' (for point) items in the obj file I was generating for coloring were
non-functional. They were raising warnings in meshlab and blender. I
changed this to the correct way. Alpha values are not supported.
http://www.paulbourke.net/dataformats/obj/colour.html
There is no facility in the file format for edge colors. I commented out
the code to write edge colors, but there is virtually no chance edge
colors would ever be put into the format. Neither meshlab nor blender
will display edge lines nicely if at all when furnished in a format.
The obj2off program now can read in an obj file with face and vertex
colors being used from the mtl file. The mtl file is specified in the
obj file and is usually the same file name with mtl file type. off2obj
needs to specify this as a parameter since the filename might not be
known. If there is no mtl file specified, obj files can still work but
they will have all plain elements with no color. Even if the mtl is
missing the obj file will still load.
The tinyobjloader.h has a #def to allow it to work without needing to be
compiled to an object file. It only needed one change; it made the
default vertex color 1,1,1 which is now none. There is a comment at the
top of the file about this.
Meshlab will import OFF files directly. It was also import some vrml and
be able to output and OFF but it throws an error with our vrml files.
I think the off2obj and obj2off programs are now correct. I'll wait a
bit and then push these programs.
Roger