Changeset 1680 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 10/26/06 11:09:58 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1679 r1680 5619 5619 5620 5620 5621 typedef priority_queue<ViewCell *, vector<ViewCell *>,5622 myless<vector<ViewCell *>::value_type> > ViewCellsQueue;5623 5624 typedef priority_queue<BvhNode *, vector<BvhNode *>,5625 myless<vector<BvhNode *>::value_type> > BvhQueue;5626 5627 typedef priority_queue<VspNode *, vector<VspNode *>,5628 myless<vector<VspNode *>::value_type> > VspQueue;5629 5630 static void UpdateStats(ofstream &stats,5631 const int splits,5632 const float totalRenderCost,5633 const int entriesInPvs,5634 const float memoryCost,5635 const bool vsp)5636 {5637 stats << "#Pass\n" << 0 << endl5638 << "#Splits\n" << splits << endl5639 << "#TotalRenderCost\n" << totalRenderCost << endl5640 << "#TotalEntriesInPvs\n" << entriesInPvs << endl5641 << "#Memory\n" << memoryCost << endl5642 << "#Vsp\n" << (vsp ? 1 : 0) << endl5643 << endl;5644 }5645 5646 /*5647 void VspOspViewCellsManager::ExportStats(const string &mergeStats)5648 {5649 ofstream stats;5650 stats.open(mergeStats.c_str());5651 5652 BvhQueue bvhQueue;5653 VspQueue vspQueue;5654 //ViewCellsQueue viewCellsQueue;5655 5656 bvhQueue.push(mHierarchyManager->mBvHierarchy->GetRoot());5657 vspQueue.push(mHierarchyManager->GetVspTree()->GetRoot());5658 5659 int numSteps = 1;5660 5661 const AxisAlignedBox3 box = mViewSpaceBox;5662 const float vol = box.GetVolume();5663 5664 float totalRenderCost = (float)mPreprocessor->mObjects.size();//(float)mViewCellsTree->GetPvsSize(mViewCellsTree->GetRoot());5665 int entriesInPvs = 1;//mViewCellsTree->GetPvsEntries(mViewCellsTree->GetRoot());5666 5667 cout << "exporting vsposp stats ... " << endl;5668 const float memoryCost = (float)entriesInPvs * (float)ObjectPvs::GetEntrySize();5669 5670 /////////////5671 //-- first view cell5672 UpdateStats(stats, 2, totalRenderCost, entriesInPvs, memoryCost, true);5673 5674 //-- go through tree in the order of render cost decrease5675 //-- which is the same order as the view cells were merged5676 //-- or the reverse order of subdivision for subdivision-only5677 //-- view cell hierarchies.5678 int i = 0;5679 while (!(bvhQueue.empty() && vspQueue.empty()))5680 {5681 const float vspCost = !vspQueue.empty() ? vspQueue.top()->GetMergeCost() : -99999999.0;5682 const float ospCost = !bvhQueue.empty() ? bvhQueue.top()->GetMergeCost() : -99999999.0;5683 5684 if (vspCost > ospCost)5685 {5686 cout << "vsp: " << (int)-vspCost << endl;5687 cout << "v";5688 VspNode *vspNode = vspQueue.top();5689 5690 if (!vspNode)5691 {5692 cerr << "big error!" << endl;5693 break;5694 }5695 vspQueue.pop();5696 5697 if (!vspNode->IsLeaf())5698 {5699 totalRenderCost -= vspNode->mRenderCostDecr;5700 entriesInPvs += vspNode->mPvsEntriesIncr;5701 5702 i ++;5703 5704 const float memoryCost = (float)entriesInPvs * (float)ObjectPvs::GetEntrySize();5705 UpdateStats(stats, i, totalRenderCost, entriesInPvs, memoryCost, true);5706 5707 VspNode *front = dynamic_cast<VspInterior *>(vspNode)->GetFront();5708 VspNode *back= dynamic_cast<VspInterior *>(vspNode)->GetBack();5709 5710 if (!front->IsLeaf())5711 vspQueue.push(front);5712 if (!back->IsLeaf())5713 vspQueue.push(back);5714 }5715 }5716 else // object space split5717 {5718 cout << "o";5719 BvhNode *bvhNode = bvhQueue.top();5720 cout << "bvh: " << (int)-ospCost << endl;5721 if (!bvhNode)5722 {5723 cerr << "big error!" << endl;5724 break;5725 }5726 bvhQueue.pop();5727 5728 if (!bvhNode->IsLeaf())5729 {5730 totalRenderCost -= bvhNode->mRenderCostDecr;5731 entriesInPvs += bvhNode->mPvsEntriesIncr;5732 5733 i ++;5734 const float memoryCost = (float)entriesInPvs * (float)ObjectPvs::GetEntrySize();5735 UpdateStats(stats, i, totalRenderCost, entriesInPvs, memoryCost, false);5736 5737 BvhNode *front = dynamic_cast<BvhInterior *>(bvhNode)->GetFront();5738 BvhNode *back= dynamic_cast<BvhInterior *>(bvhNode)->GetBack();5739 5740 if (!front->IsLeaf())5741 bvhQueue.push(front);5742 if (!back->IsLeaf())5743 bvhQueue.push(back);5744 }5745 }5746 cout << i << endl;5747 5748 }5749 5750 stats.close();5751 }5752 */5753 5754 5621 #if TEST_EVALUATION 5755 5622 void VspOspViewCellsManager::EvalViewCellPartition()
Note: See TracChangeset
for help on using the changeset viewer.