Changeset 1979


Ignore:
Timestamp:
01/15/07 13:58:15 (17 years ago)
Author:
mattausch
Message:

removed errors in loader

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp

    r1978 r1979  
    7676static void LoadTriangles(char *str,  
    7777                                                  const VertexContainer &vertices,  
    78                                                   vector<Triangle3> &triangles) 
     78                                                  vector<Triangle3> &triangles, 
     79                                                  const int line) 
    7980{ 
    8081        char *pch = strtok(str + 1, " "); 
     
    8283        VertexIndexContainer indices; 
    8384         
    84         int i = 0; 
    8585        while (pch != NULL) 
    8686        { 
    8787                const int index = (int)strtol(pch, NULL, 10) - 1; 
    88                 ++ i; 
    89                                  
     88                                                 
    9089                // store vertex in hash table 
    9190                //hashTable[index] = vertices[index]; 
    9291                indices.push_back(index); 
    9392                 
     93                //if (line == 451703) 
     94                //      cout << index + 1 << " "; 
     95 
    9496                pch = strtok(NULL, " "); 
    9597 
     
    101103 
    102104                        triangles.push_back(Triangle3(vertices[indices[0]],  
    103                                                                                   vertices[indices[index_2]],  
    104                                                                                   vertices[indices[index_3]]));  
     105                                                                                  vertices[indices[index_2]],            
     106                                                                                  vertices[indices[index_3]])); 
    105107                } 
    106108        } 
     109        //if (line == 451703) 
     110        //      cout << "t: " << triangles.size() << endl; 
    107111} 
    108112 
     
    221225        FaceContainer faces; 
    222226 
    223         char str[100]; 
     227        int line = 0; 
     228 
     229        char str[1000]; 
    224230        int meshGrouping; 
    225231        Environment::GetSingleton()->GetIntValue("ObjParser.meshGrouping", meshGrouping); 
     
    227233        int nMaxFaces = meshGrouping; 
    228234 
    229         while (fgets(str, 80, file) != NULL) 
    230         { 
     235        while (fgets(str, 1000, file) != NULL) 
     236        {++ line; 
    231237          switch (str[0])  
    232238                { 
     
    264270                                        vector<Triangle3> triangles; 
    265271                                         
    266                                         LoadTriangles(str, vertices, triangles); 
     272                                        LoadTriangles(str, vertices, triangles, line); 
    267273 
    268274                                        vector<Triangle3>::const_iterator tit, tit_end = triangles.end(); 
     
    270276                                        for (tit = triangles.begin(); tit != tit_end; ++ tit) 
    271277                                        { 
    272                                                 //if (!TriangleValid(*tit)) continue; 
    273                                                  
     278                                                if (0 && !TriangleValid(*tit)) continue; 
     279 
    274280                                                TriangleIntersectable *obj = new TriangleIntersectable(*tit);    
    275                                                 root->mGeometry.push_back(obj); 
     281                        root->mGeometry.push_back(obj); 
    276282                                        } 
    277283                                } 
     
    282288                } 
    283289        } 
    284  
     290        //cout << "\n** " << root->mGeometry.size() << " " << " lines: " << line << endl; 
    285291        if (loadMeshes) 
    286292        { 
Note: See TracChangeset for help on using the changeset viewer.