Ignore:
Timestamp:
01/21/07 00:40:56 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2002 r2003  
    265265 
    266266        cout << "binary obj dump available, loading " << filename.c_str() << endl; 
    267         // table associating indices with vectors 
    268         map<int, Vector3> hashTable; 
     267         
    269268 
    270269        // table for vertices 
    271270        VertexContainer vertices;  
    272         FaceContainer faces; 
    273  
     271         
    274272        if (parents) 
    275273                cout << "using face parents" << endl; 
     
    277275                cout << "not using face parents" << endl; 
    278276 
     277        int dummy = 0; 
     278        vector<Triangle3> triangles; 
     279        //triangles.reserve(sizeof(Triangle3) * 13000000); 
     280        //triangles.reserve(13000000); 
     281        //root->mGeometry.reserve(13000000); 
     282 
    279283        while (1) 
    280284        { 
     
    291295                TriangleIntersectable *obj = new TriangleIntersectable(tri); 
    292296                root->mGeometry.push_back(obj); 
    293  
    294                 // matt: we don't really need to keep an additional data structure 
    295                 // if working with triangles => remove this 
    296                 if (parents)  
    297                 { 
    298                         FaceParentInfo info(obj, 0); 
    299                         parents->push_back(info); 
    300                 }        
    301         } 
    302          
     297                //triangles.push_back(tri); 
     298                //dummy ++; 
     299                //if (dummy % 100000 == 9999) 
     300                //cout << "idx: " << dummy << endl; 
     301        } 
     302         
     303        //cout << "here411" << endl; 
    303304        return true; 
    304305} 
     
    405406Intersectable *Preprocessor::GetParentObject(const int index) const 
    406407{ 
    407         if (index == -1) 
    408           return NULL; 
     408        if (index < 0) 
     409        { 
     410                cerr << "Warning: triangle index smaller zero! " << index << endl; 
     411                return NULL; 
     412        } 
    409413         
    410414        if (!mFaceParents.empty()) 
     
    421425        } 
    422426        else 
    423           { 
    424           if (index >= (int)mObjects.size()) { 
    425                 cerr<<"Warning: triangle  index out of range! "<<index<<endl; 
    426                 return NULL; 
    427           } 
    428           else 
    429                 { 
    430                   return mObjects[index]; 
    431                 } 
    432           } 
     427        { 
     428                  if (index >= (int)mObjects.size())  
     429                  { 
     430                          cerr<<"Warning: triangle  index out of range! " << index << endl; 
     431                          return NULL; 
     432                  } 
     433                  else 
     434                  { 
     435                          return mObjects[index]; 
     436                  } 
     437        } 
    433438} 
    434439 
     
    10781083 
    10791084 
    1080 bool Preprocessor::InitRayCast(const string externKdTree,  
    1081                                                            const string internKdTree) 
     1085bool Preprocessor::LoadInternKdTree( const string internKdTree) 
    10821086{ 
    10831087        // always try to load the kd tree 
     
    11111115        cout << mKdTree->GetBox() << endl; 
    11121116 
     1117        return true; 
     1118} 
     1119 
     1120 
     1121bool Preprocessor::InitRayCast(const string externKdTree,  
     1122                                                           const string internKdTree) 
     1123{ 
     1124        // always try to load the kd tree 
     1125/*      cout << "loading kd tree file " << internKdTree << " ... " << endl; 
     1126 
     1127        if (!LoadKdTree(internKdTree)) 
     1128        { 
     1129                cout << "error loading kd tree with filename "  
     1130                         << internKdTree << ", rebuilding it instead ... " << endl; 
     1131                // build new kd tree from scene geometry 
     1132                BuildKdTree(); 
     1133 
     1134                // export kd tree? 
     1135                const long startTime = GetTime(); 
     1136                cout << "exporting kd tree ... "; 
     1137 
     1138                if (!ExportKdTree(internKdTree)) 
     1139                { 
     1140                        cout << " error exporting kd tree with filename "  
     1141                                 << internKdTree << endl; 
     1142                } 
     1143                else 
     1144                { 
     1145                        cout << "finished in "  
     1146                                 << TimeDiff(startTime, GetTime()) * 1e-3  
     1147                                 << " secs" << endl; 
     1148                } 
     1149        } 
     1150         
     1151        KdTreeStatistics(cout); 
     1152        cout << mKdTree->GetBox() << endl; 
     1153*/ 
    11131154        int rayCastMethod; 
    11141155        Environment::GetSingleton()-> 
     
    11181159        { 
    11191160                cout << "ray cast method: internal" << endl; 
    1120                 mRayCaster = new InternalRayCaster(*this, mKdTree); 
     1161                mRayCaster = new InternalRayCaster(*this); 
    11211162        } 
    11221163        else 
     
    11401181                                           ) 
    11411182{ 
    1142  
    1143  
    11441183  const long t1 = GetTime(); 
    11451184 
Note: See TracChangeset for help on using the changeset viewer.