Changeset 2003 for GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
- Timestamp:
- 01/21/07 00:40:56 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2002 r2003 265 265 266 266 cout << "binary obj dump available, loading " << filename.c_str() << endl; 267 // table associating indices with vectors 268 map<int, Vector3> hashTable; 267 269 268 270 269 // table for vertices 271 270 VertexContainer vertices; 272 FaceContainer faces; 273 271 274 272 if (parents) 275 273 cout << "using face parents" << endl; … … 277 275 cout << "not using face parents" << endl; 278 276 277 int dummy = 0; 278 vector<Triangle3> triangles; 279 //triangles.reserve(sizeof(Triangle3) * 13000000); 280 //triangles.reserve(13000000); 281 //root->mGeometry.reserve(13000000); 282 279 283 while (1) 280 284 { … … 291 295 TriangleIntersectable *obj = new TriangleIntersectable(tri); 292 296 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; 303 304 return true; 304 305 } … … 405 406 Intersectable *Preprocessor::GetParentObject(const int index) const 406 407 { 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 } 409 413 410 414 if (!mFaceParents.empty()) … … 421 425 } 422 426 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 } 433 438 } 434 439 … … 1078 1083 1079 1084 1080 bool Preprocessor::InitRayCast(const string externKdTree, 1081 const string internKdTree) 1085 bool Preprocessor::LoadInternKdTree( const string internKdTree) 1082 1086 { 1083 1087 // always try to load the kd tree … … 1111 1115 cout << mKdTree->GetBox() << endl; 1112 1116 1117 return true; 1118 } 1119 1120 1121 bool 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 */ 1113 1154 int rayCastMethod; 1114 1155 Environment::GetSingleton()-> … … 1118 1159 { 1119 1160 cout << "ray cast method: internal" << endl; 1120 mRayCaster = new InternalRayCaster(*this , mKdTree);1161 mRayCaster = new InternalRayCaster(*this); 1121 1162 } 1122 1163 else … … 1140 1181 ) 1141 1182 { 1142 1143 1144 1183 const long t1 = GetTime(); 1145 1184
Note: See TracChangeset
for help on using the changeset viewer.