Changeset 1633 for GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
- Timestamp:
- 10/17/06 20:32:06 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1624 r1633 509 509 510 510 const float renderCostDecr = oldRenderCost - newRenderCost; 511 const int pvsEntriesIncr = EvalPvsEntriesIncr(splitCandidate); 512 511 513 512 #ifdef _DEBUG 514 513 Debug << "old render cost: " << oldRenderCost << endl; … … 516 515 Debug << "render cost decrease: " << renderCostDecr << endl; 517 516 #endif 518 519 splitCandidate.SetRenderCostDecrease(renderCostDecr);520 splitCandidate.SetPvsEntriesIncr(EvalPvsEntriesIncr(splitCandidate));521 517 522 518 #if 1 … … 529 525 #endif 530 526 527 splitCandidate.SetRenderCostDecrease(renderCostDecr); 528 529 // increase in pvs entries 530 const int pvsEntriesIncr = EvalPvsEntriesIncr(splitCandidate); 531 splitCandidate.SetPvsEntriesIncr(pvsEntriesIncr); 532 531 533 // compute global decrease in render cost 532 534 splitCandidate.SetPriority(priority); 535 } 536 537 538 float BvHierarchy::EvalPriority(const BvhSubdivisionCandidate &splitCandidate) const 539 { 540 BvhLeaf *leaf = splitCandidate.mParentData.mNode; 541 542 const float oldRenderCost = EvalRenderCost(leaf->mObjects); 543 544 // compute global decrease in render cost 545 const float newRenderCost = 546 EvalRenderCost(splitCandidate.mFrontObjects) + 547 EvalRenderCost(splitCandidate.mBackObjects); 548 549 const float renderCostDecr = oldRenderCost - newRenderCost; 550 551 #ifdef _DEBUG 552 Debug << "old render cost: " << oldRenderCost << endl; 553 Debug << "new render cost: " << newRenderCost << endl; 554 Debug << "render cost decrease: " << renderCostDecr << endl; 555 #endif 556 557 #if 1 558 // take render cost of node into account 559 // otherwise danger of being stuck in a local minimum!! 560 const float factor = mRenderCostDecreaseWeight; 561 const float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 562 #else 563 const float priority = (float)-splitCandidate.mParentData.mDepth; 564 #endif 565 566 return priority; 533 567 } 534 568 … … 569 603 ); 570 604 571 if (1 && terminationCriteriaMet) 605 #ifdef _DEBUG 606 if (terminationCriteriaMet) 572 607 { 573 608 Debug << "bvh global termination criteria met:" << endl; … … 575 610 Debug << "leaves: " << mBvhStats.Leaves() << " " << mTermMaxLeaves << endl; 576 611 } 577 612 #endif 578 613 return terminationCriteriaMet; 579 614 } … … 1529 1564 1530 1565 void BvHierarchy::CollectDirtyCandidates(BvhSubdivisionCandidate *sc, 1531 vector<SubdivisionCandidate *> &dirtyList) 1566 vector<SubdivisionCandidate *> &dirtyList, 1567 const bool onlyUnmailed) 1532 1568 { 1533 1569 BvhTraversalData &tData = sc->mParentData; … … 1535 1571 1536 1572 ViewCellContainer viewCells; 1537 CollectViewCells(node->mObjects, viewCells); 1573 ViewCell::NewMail(); 1574 CollectViewCells(node->mObjects, viewCells, true); 1575 1538 1576 if (0) cout << "collected " << (int)viewCells.size() << " dirty candidates" << endl; 1539 1577 1540 1578 // split candidates handling 1541 1579 // these view cells are thrown into dirty list … … 1544 1582 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 1545 1583 { 1546 1584 VspViewCell *vc = dynamic_cast<VspViewCell *>(*vit); 1547 1585 VspLeaf *leaf = vc->mLeaves[0]; 1586 1548 1587 SubdivisionCandidate *candidate = leaf->GetSubdivisionCandidate(); 1549 1588 1550 if (candidate) // is this leaf still a split candidate? 1551 { 1589 // is this leaf still a split candidate? 1590 if (candidate && (!onlyUnmailed || !candidate->Mailed())) 1591 { 1592 candidate->Mail(); 1552 1593 dirtyList.push_back(candidate); 1553 1594 }
Note: See TracChangeset
for help on using the changeset viewer.