• Advertisement

Archived

This topic is now archived and is closed to further replies.

loading geometry from a text file

This topic is 5901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to load my geometry from a .rtg ascii file exported from MAYA. Does anyone know of a reliable (ie flexible) method of doing this? I tried doing it with fgets and sscanf but the whitespaces in the exported file seem a bit random and sscanf throws a spac at this. The data''s basically in the form: OBJECT_START objectname v8 t14 n4 p12 //number of verts, uvs etc... VERTEX 0.0 1.0 0.0 ... ... TEXCOORD 0.0 1.0 ... ... NORMAL 0.0 1.0 0.0 ... ... POLYGON v 0 1 2 t 0 1 2 n 0 ... ... I was probably gonna skip loading the normals and just calculate them on the fly (not that that matters) Any ideas anyone? OnDeZ

Share this post


Link to post
Share on other sites
Advertisement
I wouldn''t have thought that the whitespace is random - there will be a method to the madness

Built-in functions like sscanf are general functions and not necessarily appropriate for every task. I would suggest writing your own function for importing data from .rtg files. It''ll involve some lovely pointer arithmetic but it''s all good practice.

Share this post


Link to post
Share on other sites
Try ifstream. The >> operator ignores whitespace, and you can also ignore it with ifstream::ignore or stop reading at whitespace with ifstream::getline.

Share this post


Link to post
Share on other sites

  • Advertisement