- Timestamp:
- 11/24/05 18:38:19 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r429 r430 423 423 } 424 424 425 425 //-- construct BSP view cells 426 if (ViewCell::sHierarchy == ViewCell::BSP) 427 { 428 const int bspSamples = min((int)mVssRays.size(), mBspConstructionSamples); 429 430 for (int i = 0; i < bspSamples; ++ i) 431 bspRays.push_back(new Ray(*mVssRays[i])); 432 433 //-- construct BSP tree using the samples 434 mBspTree = new BspTree(&mUnbounded); 435 436 mBspTree->SetGenerateViewCells(true); 437 mBspTree->Construct(bspRays); 438 439 Exporter *exporter = Exporter::GetExporter("vccbsprays.x3d"); 440 441 // export rays piercing this view cell 442 exporter->ExportRays(bspRays, 1000, RgbColor(0, 1, 0)); 443 444 // cast remaining initial rays into BSP tree 445 for (int i = bspSamples; i < (int)mVssRays.size(); ++ i) 446 CastRay(*mBspTree, *mVssRays[i]); 447 } 426 448 427 449 vssTree = new VssTree; 428 429 const int bspSamples = min((int)mVssRays.size(), mBspConstructionSamples);430 431 for (int i = 0; i < bspSamples; ++ i)432 bspRays.push_back(new Ray(*mVssRays[i]));433 434 mBspTree = new BspTree(&mUnbounded);435 436 mBspTree->SetGenerateViewCells(true);437 mBspTree->Construct(bspRays);438 439 for (int i = bspSamples; i < (int)mVssRays.size(); ++ i)440 {441 CastRay(*mBspTree, *mVssRays[i]);442 }443 450 444 451 vssTree->Construct(mVssRays, mViewSpaceBox); … … 486 493 } 487 494 488 489 for (int i = 0; i < (int)vssRays.size(); ++ i)495 // cast rays into BSP tree 496 if (ViewCell::sHierarchy == ViewCell::BSP) 490 497 { 491 CastRay(*mBspTree, *mVssRays[i]); 492 } 493 498 for (int i = 0; i < (int)vssRays.size(); ++ i) 499 { 500 CastRay(*mBspTree, *mVssRays[i]); 501 } 502 } 503 494 504 samples+=num; 495 505 float pvs = vssTree->GetAvgPvsSize(); … … 505 515 delete vssTree; 506 516 507 ObjectContainer objects; 508 ExportSplits(objects, bspRays, 10000); 509 ExportBspPvs(objects, bspRays, 10000); 510 511 CLEAR_CONTAINER(bspRays); 517 if (ViewCell::sHierarchy == ViewCell::BSP) 518 { 519 Debug << mBspTree->GetStatistics(); 520 521 ObjectContainer objects; 522 ExportSplits(objects, bspRays, 10000); 523 ExportBspPvs(objects, bspRays, 10000); 524 525 BspViewCellsStatistics stat; 526 mBspTree->EvaluateViewCellsStats(stat); 527 Debug << "original view cell partition:\n" << stat << endl; 528 529 // clear BSP samples 530 CLEAR_CONTAINER(bspRays); 531 } 512 532 513 533 return true; … … 519 539 Ray ray(vssRay); 520 540 541 /*Debug << ray << endl; 542 if (ray.intersections.empty()) 543 Debug << "empty ray" << endl; 544 else 545 Debug << "intersection: " << ray.intersections[0].mT << " " << ray.intersections[0].mObject << endl; 546 */ 521 547 mBspTree->CastRay(ray); 522 548
Note: See TracChangeset
for help on using the changeset viewer.