- Timestamp:
- 11/24/05 03:42:19 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r427 r429 24 24 environment->GetIntValue("VssPreprocessor.vssSamples", mVssSamples); 25 25 environment->GetIntValue("VssPreprocessor.vssSamplesPerPass", mVssSamplesPerPass); 26 environment->GetBoolValue("VssPreprocessor.useImportanceSampling", mUseImportanceSampling); 26 environment->GetBoolValue("VssPreprocessor.useImportanceSampling", mUseImportanceSampling); 27 environment->GetIntValue("BspTree.Construction.samples", mBspConstructionSamples); 27 28 28 29 mStats.open("stats.log"); … … 353 354 VssTree *vssTree = NULL; 354 355 356 RayContainer bspRays; 357 355 358 while (totalSamples < mInitialSamples) { 356 359 int passContributingSamples = 0; … … 422 425 423 426 424 425 427 vssTree = new VssTree; 426 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 427 444 vssTree->Construct(mVssRays, mViewSpaceBox); 428 445 … … 469 486 } 470 487 488 489 for (int i = 0; i < (int)vssRays.size(); ++ i) 490 { 491 CastRay(*mBspTree, *mVssRays[i]); 492 } 471 493 472 494 samples+=num; … … 482 504 483 505 delete vssTree; 484 485 return true; 486 } 487 506 507 ObjectContainer objects; 508 ExportSplits(objects, bspRays, 10000); 509 ExportBspPvs(objects, bspRays, 10000); 510 511 CLEAR_CONTAINER(bspRays); 512 513 return true; 514 } 515 516 void VssPreprocessor::CastRay(const BspTree &tree, const VssRay & vssRay) 517 { 518 //-- cast ray to BSP tree to get intersection with view cells 519 Ray ray(vssRay); 520 521 mBspTree->CastRay(ray); 522 523 if (ray.sourceObject.mObject) 524 //sampleContributions += 525 AddObjectSamples(ray.sourceObject.mObject, ray); 526 527 if (!ray.intersections.empty()) // second intersection found 528 { 529 //sampleContributions += 530 AddObjectSamples(ray.intersections[0].mObject, ray); 531 } 532 } 533 534 int VssPreprocessor::AddObjectSamples(Intersectable *obj, const Ray &ray) 535 { 536 int contributingSamples = 0; 537 int j; 538 539 // object can be seen from the view cell => add to view cell pvs 540 for (j=0; j < ray.bspIntersections.size(); ++ j) 541 { 542 BspLeaf *leaf = ray.bspIntersections[j].mLeaf; 543 // if ray not in unbounded space 544 if (leaf->GetViewCell() != &mUnbounded) 545 contributingSamples += 546 leaf->GetViewCell()->GetPvs().AddSample(obj); 547 } 548 549 // rays passing through this viewcell 550 if (mPass > 1) 551 for (j=1; j < ((int)ray.bspIntersections.size() - 1); ++ j) 552 { 553 BspLeaf *leaf = ray.bspIntersections[j].mLeaf; 554 555 if (leaf->GetViewCell() != &mUnbounded) 556 leaf->GetViewCell()-> 557 AddPassingRay(ray, contributingSamples ? 1 : 0); 558 } 559 560 return contributingSamples; 561 }
Note: See TracChangeset
for help on using the changeset viewer.