Hi folks, I'm trying to write an optimiser utility that takes a .b3d file and merges the meshblocks together for instance
would now read
the way i'm trying to do it is to save the vertex and face element separately, so what i wanted to do was to save the address of each line in a different section of an array, so all the 'face' lines get saved in one part of the array and the 'vertex' ones in another. then what I want to do is output the 1st element of the array then point to the next element, meaning the face statements should come out one after the other instead of being separated. the problem is that trying to make an array containing the addresses of each line doesn't seem to work for me. is there an easy way to make an array containing addresses, rather than integers and strings etc?
I'm not trying to sort the data into the largest number of alphabetic etc (i wish i was)
i'm tearing my hair out!
Maybe use two vectors of strings?
std::vector< std::string > vertices;
std::vector< std::string > faces;
When you read each line, decide which vector you want to push_back on, based on the first word in the line (lookup the appropriate std::string method to do this)
When you're done, just output all the vertices, then all the faces.
Should be about 20 lines tops.
I haven't come across lists yet, but i see what you're getting at and how it can be simpler than the way i was trying to do it. just so I can confirm my understanding:
1) make two lists, one containing vertexes and faces.
2) compare each line coming in and use the push_back function to put it to the end of each appropriate list?