Changeset 3263 for GTP/trunk/App/Demos/Vis
- Timestamp:
- 01/11/09 01:19:59 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp
r3261 r3263 35 35 } 36 36 37 // throw away last symbol (\n) 38 triples.back().resize(triples.back().size() - 1); 39 37 40 vector<int> indices; 38 41 vector<int> nIndices; 39 42 vector<int> tIndices; 40 43 41 char seps[] = " /\t\n"; 44 char seps[] = " "; 45 char seps2[] = "/"; 42 46 43 47 for (size_t i = 0; i < triples.size(); ++ i) 44 48 { 45 static int dummy = 0; 46 49 //cout << "triple " << i << " " << triples[i] << endl; 47 50 size_t found; 48 found = triples[i].find_first_of(seps );51 found = triples[i].find_first_of(seps2); 49 52 size_t prevfound = 0; 50 // vertex, normal, texture indices 53 54 // extract vertex, normal, texture indices 51 55 string str = triples[i].substr(prevfound, found); 52 56 53 57 int index = (int)strtol(str.c_str(), NULL, 10) - 1; 54 55 58 int tIndex = index; 56 59 int nIndex = index; 57 60 58 prevfound = found; 59 found = triples[i].find_first_of(seps, found + 1); 61 // try to extract texture and normal indices 62 prevfound = found + 1; 63 found = triples[i].find_first_of(seps2, prevfound); 60 64 61 65 if (found != string::npos) … … 66 70 if (idx > 0) tIndex = idx; 67 71 } 68 69 if ( (found + 1) < triples[i].size())72 73 if (found != string::npos) 70 74 { 71 75 str = triples[i].substr(found + 1); … … 81 85 nIndices.push_back(nIndex); 82 86 tIndices.push_back(tIndex); 87 88 //cout << index << " " << tIndex << " " << nIndex << endl; 83 89 } 84 90
Note: See TracChangeset
for help on using the changeset viewer.