kvark's picture

Reading mesh data from a file

I'm a kind of newbie to .Net, but wasn't surprised about the problem of structure reading from a file. However, I still don't have a suitable solution for that. The problem is simple: how to load array of structures (or a structure of arrays) from a file if the structure consists of various Vector*[h] values? Please, share your IO experience here.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kvark's picture

I see the Half & Vector*h have pretty nice static method FromBytes. I wonder why other vectors don't...

Inertia's picture

You can use the ToBinaryStream and FromBinaryStream methods with a FileStream. You have to figure out the header information of the file format on your own though.

Special care has been taken to ensure the half-precision scalar and vectors can be easily used, because they aren't native. Other vectors will eventually get the same treatment, ideally you'd file an issue as a reminder.

kvark's picture

2Fiddler:
It would be nice to have something like IBinaryReadable interface that declares FromBinaryStream, ToBinaryStream & FromBytes.
It would be perfect to have all math structures implemented this interface...