- Timestamp:
- 01/13/09 12:43:51 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/VisibilitySolutionConverter/VisibilitySolutionConverter.cpp
r3272 r3273 52 52 { 53 53 vector<string> triples; 54 54 55 char *next_token; 55 56 … … 60 61 { 61 62 string s(pch); 62 //s += "\n",63 63 triples.push_back(s); 64 64 … … 66 66 } 67 67 68 // throw away last symbol (\n) 69 triples.back().resize(triples.back().size() - 1); 70 68 71 vector<int> indices; 69 72 vector<int> nIndices; 70 73 vector<int> tIndices; 71 74 72 char seps[] = " /\t\n"; 75 char seps[] = " "; 76 char seps2[] = "/"; 73 77 74 78 for (size_t i = 0; i < triples.size(); ++ i) 75 79 { 76 static int dummy = 0;77 78 80 size_t found; 79 found = triples[i].find_first_of(seps );81 found = triples[i].find_first_of(seps2); 80 82 size_t prevfound = 0; 81 // vertex, normal, texture indices 83 84 // extract vertex, normal, texture indices 82 85 string str = triples[i].substr(prevfound, found); 83 86 84 87 int index = (int)strtol(str.c_str(), NULL, 10) - 1; 85 86 88 int tIndex = index; 87 89 int nIndex = index; 88 90 89 prevfound = found; 90 found = triples[i].find_first_of(seps, found + 1); 91 // try to extract texture and normal indices 92 prevfound = found + 1; 93 found = triples[i].find_first_of(seps2, prevfound); 91 94 92 95 if (found != string::npos) … … 97 100 if (idx > 0) tIndex = idx; 98 101 } 99 100 if ( (found + 1) < triples[i].size())102 103 if (found != string::npos) 101 104 { 102 105 str = triples[i].substr(found + 1);
Note: See TracChangeset
for help on using the changeset viewer.