Changeset 3263


Ignore:
Timestamp:
01/11/09 01:19:59 (15 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp

    r3261 r3263  
    3535        } 
    3636 
     37        // throw away last symbol (\n) 
     38        triples.back().resize(triples.back().size() - 1); 
     39 
    3740        vector<int> indices; 
    3841        vector<int> nIndices; 
    3942        vector<int> tIndices; 
    4043 
    41         char seps[] = " /\t\n"; 
     44        char seps[] = " "; 
     45        char seps2[] = "/"; 
    4246 
    4347        for (size_t i = 0; i < triples.size(); ++ i) 
    4448        { 
    45                 static int dummy = 0; 
    46  
     49                //cout << "triple " << i << " " << triples[i] << endl; 
    4750                size_t found; 
    48                 found = triples[i].find_first_of(seps); 
     51                found = triples[i].find_first_of(seps2); 
    4952                size_t prevfound = 0; 
    50                 // vertex, normal, texture indices 
     53 
     54                // extract vertex, normal, texture indices 
    5155                string str = triples[i].substr(prevfound, found); 
    5256 
    5357                int index = (int)strtol(str.c_str(), NULL, 10) - 1; 
    54  
    5558                int tIndex = index; 
    5659                int nIndex = index;      
    5760                 
    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);   
    6064 
    6165                if (found != string::npos) 
     
    6670                        if (idx > 0) tIndex = idx; 
    6771                } 
    68  
    69                 if ((found + 1) < triples[i].size()) 
     72                 
     73                if (found != string::npos) 
    7074                { 
    7175                        str = triples[i].substr(found + 1); 
     
    8185                        nIndices.push_back(nIndex); 
    8286                        tIndices.push_back(tIndex); 
     87 
     88                        //cout << index << " " << tIndex << " " << nIndex << endl; 
    8389                } 
    8490 
Note: See TracChangeset for help on using the changeset viewer.