Changeset 2004
- Timestamp:
- 01/21/07 17:25:42 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r2003 r2004 1737 1737 1738 1738 1739 float BvHierarchy::EvalAbsCost(const ObjectContainer &objects) // const1739 float BvHierarchy::EvalAbsCost(const ObjectContainer &objects) 1740 1740 { 1741 1741 #if USE_BETTER_RENDERCOST_EST … … 2346 2346 2347 2347 frontData.mSortedObjects[i]->reserve((int)sc.mFrontObjects.size()); 2348 backData.mSortedObjects[i]->reserve((int)sc.m FrontObjects.size());2348 backData.mSortedObjects[i]->reserve((int)sc.mBackObjects.size()); 2349 2349 2350 2350 ObjectContainer::const_iterator oit, oit_end = sc.mParentData.mSortedObjects[i]->end(); 2351 2351 2352 // all the front objects are mailed => assign the sorted object lists 2352 2353 for (oit = sc.mParentData.mSortedObjects[i]->begin(); oit != oit_end; ++ oit) 2353 2354 { -
GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp
r2003 r2004 43 43 ) 44 44 { 45 cout << "intel ray" << endl;45 //cout << "intel ray" << endl; 46 46 VssRay *vssRay = NULL; 47 47 int hits = 0; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2003 r2004 266 266 cout << "binary obj dump available, loading " << filename.c_str() << endl; 267 267 268 269 268 // table for vertices 270 269 VertexContainer vertices; … … 275 274 cout << "not using face parents" << endl; 276 275 277 int dummy = 0; 278 vector<Triangle3> triangles; 279 //triangles.reserve(sizeof(Triangle3) * 13000000); 280 //triangles.reserve(13000000); 276 // read in triangle size 277 int numTriangles; 278 279 samplesIn.read(reinterpret_cast<char *>(&numTriangles), sizeof(int)); 280 root->mGeometry.reserve(numTriangles); 281 cout << "reserved " << numTriangles << " triangles " << endl; 281 282 //root->mGeometry.reserve(13000000); 282 283 284 cout << "using " << numTriangles * (sizeof(TriangleIntersectable) + sizeof(TriangleIntersectable *)) / (1024 * 1024) << " MBs" << endl; 285 286 //vector<Triangle3> dummy; 287 //cout << "using " << numTriangles * sizeof(Triangle3) / (1024 * 1024) << " MBs" << endl; 288 //dummy.reserve(numTriangles); 289 290 int i = 0; 283 291 while (1) 284 292 { … … 295 303 TriangleIntersectable *obj = new TriangleIntersectable(tri); 296 304 root->mGeometry.push_back(obj); 297 //triangles.push_back(tri); 298 //dummy ++; 299 //if (dummy % 100000 == 9999) 300 //cout << "idx: " << dummy << endl; 301 } 302 303 //cout << "here411" << endl; 305 //dummy.push_back(tri); 306 i ++; 307 308 if (i % 500000 == 0) 309 cout << "idx: " << i << endl; 310 } 311 312 if (i != numTriangles) 313 { 314 cout << "warning: triangle size does not match with loaded triangle size" << endl; 315 return false; 316 } 317 318 cout << "loaded " << numTriangles << " triangles" << endl; 319 304 320 return true; 305 321 } … … 308 324 bool Preprocessor::ExportBinaryObj(const string filename, SceneGraphNode *root) 309 325 { 310 //ifstream samplesIn(filename, ios::binary);311 326 ogzstream samplesOut(filename.c_str()); 327 312 328 if (!samplesOut.is_open()) 313 329 return false; 330 331 int numTriangles = (int)root->mGeometry.size(); 332 333 samplesOut.write(reinterpret_cast<char *>(&numTriangles), sizeof(int)); 314 334 315 335 ObjectContainer::const_iterator oit, oit_end = root->mGeometry.end(); … … 333 353 } 334 354 355 cout << "exported " << numTriangles << " triangles" << endl; 356 335 357 return true; 336 358 } … … 346 368 ObjectContainer::const_iterator oit, oit_end = objects.end(); 347 369 348 AxisAlignedBox3 bbox = mSceneGraph->GetBox(); bbox.Enlarge(30.0);370 //AxisAlignedBox3 bbox = mSceneGraph->GetBox(); bbox.Enlarge(30.0); 349 371 for (oit = objects.begin(); oit != oit_end; ++ oit) 350 372 { … … 354 376 { 355 377 Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem(); 356 //if ( bbox.IsInside(tri.mVertices[0]) && bbox.IsInside(tri.mVertices[1]) && bbox.IsInside(tri.mVertices[2]))357 //{358 359 360 378 //if (!(bbox.IsInside(tri.mVertices[0]) && bbox.IsInside(tri.mVertices[1]) && bbox.IsInside(tri.mVertices[2])))continue; 379 380 samplesOut << "v " << tri.mVertices[0].x << " " << tri.mVertices[0].y << " " << tri.mVertices[0].z << endl; 381 samplesOut << "v " << tri.mVertices[1].x << " " << tri.mVertices[1].y << " " << tri.mVertices[1].z << endl; 382 samplesOut << "v " << tri.mVertices[2].x << " " << tri.mVertices[2].y << " " << tri.mVertices[2].z << endl; 361 383 //} 362 384 } … … 375 397 { 376 398 //Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem(); 377 //if (bbox.IsInside(tri.mVertices[0]) && bbox.IsInside(tri.mVertices[1]) && bbox.IsInside(tri.mVertices[2])) 378 //{ 379 Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem(); 380 samplesOut << "f " << i << " " << i + 1 << " " << i + 2 << endl; 381 i += 3; 382 //} 399 //if (!(bbox.IsInside(tri.mVertices[0]) && bbox.IsInside(tri.mVertices[1]) && bbox.IsInside(tri.mVertices[2]))) continue; 400 401 Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem(); 402 samplesOut << "f " << i << " " << i + 1 << " " << i + 2 << endl; 403 i += 3; 383 404 } 384 405 else … … 408 429 if (index < 0) 409 430 { 410 cerr << "Warning: triangle index smaller zero! " << index << endl;431 //cerr << "Warning: triangle index smaller zero! " << index << endl; 411 432 return NULL; 412 433 } … … 502 523 503 524 // hack: load binary dump 504 string binFile = ReplaceSuffix(filename, ".obj", ".bin");505 525 const string bnFile = ReplaceSuffix(filename, ".obj", ".bn"); 526 506 527 if (!mLoadMeshes) 507 528 { 508 result = LoadBinaryObj(b inFile, mSceneGraph->GetRoot(), fi);529 result = LoadBinaryObj(bnFile, mSceneGraph->GetRoot(), fi); 509 530 } 510 531 511 if (!result) 532 // parse obj 533 if (!result) 512 534 { 513 535 cout << "no binary dump available or loading full meshes, parsing file" << endl; … … 519 541 fi); 520 542 543 cout << "loaded " << (int)mSceneGraph->GetRoot()->mGeometry.size() << " entities" << endl; 521 544 // only works for triangles 522 if ( !mLoadMeshes)545 if (result && !mLoadMeshes) 523 546 { 524 cout << "exporting binary obj to " << b inFile << "... " << endl;525 ExportBinaryObj(b inFile, mSceneGraph->GetRoot());547 cout << "exporting binary obj to " << bnFile << "... " << endl; 548 ExportBinaryObj(bnFile, mSceneGraph->GetRoot()); 526 549 cout << "finished" << endl; 527 550 } … … 531 554 else if (0) 532 555 { 533 ExportBinaryObj("../data/test.b in", mSceneGraph->GetRoot());556 ExportBinaryObj("../data/test.bn", mSceneGraph->GetRoot()); 534 557 } 535 558 } -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2003 r2004 653 653 if (strcmp(curr, "mutation")==0) { 654 654 // temp matt: still no mutationstrategy! 655 mDistributions.push_back(new MutationBasedDistribution(mPreprocessor));655 //mDistributions.push_back(new MutationBasedDistribution(mPreprocessor)); 656 656 } 657 657 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2003 r2004 342 342 ViewCellsManager::CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects) 343 343 { 344 344 GetPreprocessor()->mKdTree->CollectObjects(box, objects); 345 345 } 346 346 … … 4321 4321 exporter->SetWireframe(); 4322 4322 4323 // matt: no kd pvs4324 /* 4323 // matt: we don't have no kd pvs 4324 #if 0 4325 4325 KdPvsMap::iterator kit = object->mKdPvs.mEntries.begin(); 4326 4326 Intersectable::NewMail(); … … 4348 4348 exporter->SetForcedMaterial(m); 4349 4349 exporter->ExportIntersectable(object); 4350 */ 4350 #endif 4351 4351 delete exporter; 4352 4352 } … … 6404 6404 VspOspViewCellsManager::CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects) 6405 6405 { 6406 6406 mHierarchyManager->CollectObjects(box, objects); 6407 6407 } 6408 6408
Note: See TracChangeset
for help on using the changeset viewer.