Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void TriangleMesh::loadOff(const string& fileName) {
- ifstream trimesh("/meshes" + fileName);
- if (!trimesh) { cout << "While opening a file an error is encountered" << endl; }
- else { cout << "File is successfully opened" << endl; }
- while (!trimesh.eof()) {
- std::istream_iterator<std::string> it(trimesh);
- std::istream_iterator<std::string> end;
- std::vector<std::string> tokens(it, end);
- if (tokens.front == "OFF") {
- const int cvertices = std::stoi(tokens.at(1));
- int ctripol = std::stoi(tokens.at(2));
- //int edges = std::stoi(tokens.at(3));
- std::vector<vec3> vertices;
- int counter = 4;
- int i = 0;
- while (counter < cvertices * 4 + 3) {// Faces start at Vertices*4+3
- vec3 a(std::stoi(tokens.at(counter + 1)), std::stoi(tokens.at(counter + 2)), std::stoi(tokens.at(counter + 3)));
- vertices.insert();
- counter += 4;
- }
- i = 0; //reset i;
- while (counter < cvertices * 4 + ctripol * 4 + 7) {// last vertice of last face
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement