- Timestamp:
- 04/07/06 23:42:54 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj
r728 r734 83 83 AdditionalDependencies="xerces-c_2.lib zdll.lib zziplib.lib devil.lib qtmain.lib QtOpenGL4.lib QtCore4.lib QtGui4.lib Qt3Supportd4.lib QAxContainer.lib glut32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib" 84 84 AdditionalLibraryDirectories="..\support\xercesc\lib\;..\support\zlib\lib\;..\support\devil\lib;"$(QTDIR)\lib";..\include;..\src\GL;"$(CG_LIB_PATH)";"$(GTPDIR)\NonGTP\Xerces";"$(GTPDIR)\NonGTP\Xerces\xercesc\lib";"$(GTPDIR)\NonGTP\zlib\lib";"$(GTPDIR)\NonGTP\Devil\lib"" 85 GenerateDebugInformation=" TRUE"85 GenerateDebugInformation="FALSE" 86 86 LargeAddressAware="2"/> 87 87 <Tool -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r728 r734 2064 2064 "false"); 2065 2065 2066 RegisterOption("VspBspTree.useDepthFirstSplits", 2067 optBool, 2068 "vsp_bsp_depth_first_splits=", 2069 "false"); 2070 2066 2071 RegisterOption("VspBspTree.useRandomAxis", 2067 2072 optBool, -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r729 r734 532 532 // frequency stats are updated 533 533 const int statsOut = 500; 534 Debug << "here3" << endl; Debug.flush();534 535 535 // passes are needed for statistics, because we don't want to record 536 536 // every merge … … 546 546 int maxMergesPerPass; 547 547 int numMergedViewCells = 0; 548 Debug << "here5" << endl; Debug.flush();548 549 549 environment->GetIntValue("ViewCells.PostProcess.maxMergesPerPass", maxMergesPerPass); 550 550 environment->GetFloatValue("ViewCells.PostProcess.avgCostMaxDeviation", avgCostMaxDeviation); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
r729 r734 178 178 } 179 179 180 static bool SmallerRenderCost(const ViewCell *a, const ViewCell *b) 181 { 182 return a->GetRenderCost() < b->GetRenderCost(); 183 } 180 184 181 185 void SetMergeCost(const float mergeCost); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r729 r734 91 91 environment->GetIntValue("ViewCells.Filter.maxSize", mMaxFilterSize); 92 92 environment->GetFloatValue("ViewCells.Filter.width", mFilterWidth); 93 environment->GetIntValue("ViewCells. mRenderCostEvaluationType", mRenderCostEvaluationType);93 environment->GetIntValue("ViewCells.renderCostEvaluationType", mRenderCostEvaluationType); 94 94 95 95 char buf[100]; … … 129 129 environment->GetStringValue("ViewCells.renderCostEvaluationType", buf); 130 130 131 if (strcmp(buf, " box") == 0)131 if (strcmp(buf, "perobject") == 0) 132 132 { 133 133 mRenderCostEvaluationType = ViewCellsManager::PER_OBJECT; … … 535 535 } 536 536 537 537 538 void ViewCellsManager::EvalViewCellHistogram(const string filename, const int nViewCells) 538 539 { … … 540 541 outstream.open(filename.c_str()); 541 542 543 Debug << "here3" << endl; 542 544 ViewCellContainer viewCells; 543 545 mViewCellsTree->CollectBestViewCellSet(mViewCells, nViewCells); 544 546 545 547 float maxRenderCost, minRenderCost; 548 546 549 /// find out the range for valid render cost 547 550 ComputeMinMaxRenderCost(minRenderCost, maxRenderCost, viewCells); 551 552 // sort by render cost 553 sort(viewCells.begin(), viewCells.end(), ViewCell::SmallerRenderCost); 554 555 minRenderCost = viewCells.front()->GetRenderCost(); 556 maxRenderCost = viewCells.back()->GetRenderCost(); 548 557 549 558 const int intervals = 10000; … … 552 561 const int stepSize = (int)((float)range / (float)intervals); 553 562 563 float vol = 0; 564 int smallerCost = 0; 565 566 ViewCellContainer::const_iterator it = viewCells.begin(), it_end = viewCells.end(); 567 568 int i = 0; 569 570 // note can skip computations for view cells already evaluated and delete them from vector ... 571 while (1) 572 { 573 Debug << "here4" << endl; 574 while ((i < (int)viewCells.size()) && (viewCells[i]->GetRenderCost() < currentRenderCost)) 575 { 576 577 Debug << "here5" << endl; 578 ++ i; 579 ++ smallerCost; 580 vol += viewCells[i]->GetVolume(); 581 } 582 583 currentRenderCost += stepSize; 584 585 outstream << "#RenderCost: " << currentRenderCost << endl; 586 outstream << "#ViewCells: " << smallerCost << endl; 587 outstream << "#Volume: " << vol << endl << endl; 588 } 589 outstream.close(); 590 Debug << "here6" << endl; 591 } 592 593 /* 594 void ViewCellsManager::EvalViewCellHistogramForPvs(const string filename, const int nViewCells) 595 { 596 std::ofstream outstream; 597 outstream.open(filename.c_str()); 598 599 ViewCellContainer viewCells; 600 mViewCellsTree->CollectBestViewCellSet(mViewCells, nViewCells); 601 602 float maxRenderCost, minRenderCost; 603 /// find out the range for valid render cost 604 ComputeMinMaxRenderCost(minRenderCost, maxRenderCost, viewCells); 605 606 const int intervals = 10000; 607 const float range = maxRenderCost - minRenderCost; 608 int currentRenderCost = (int)ceil(minRenderCost); 609 const int stepSize = (int)((float)range / (float)intervals); 610 float vol = 0; 611 612 ViewCell::NewMail(); 613 554 614 for (; currentRenderCost < (int)maxRenderCost; currentRenderCost += stepSize) 555 615 { … … 558 618 int smallerCost = 0; 559 619 560 for (it = viewCells.begin(); it != viewCells.end(); ++ it) 561 { 620 // note can skip computations for view cells already evaluated and delete them from vector ... 621 for (it = viewCells.begin(); it != viewCells.end(); ++ it) 622 { 623 if (!vc->Mailed()) 624 { 625 vc->Mail(); 562 626 ViewCell *vc = *it; 563 627 564 628 if (EvalRenderCost(vc) < currentRenderCost) 629 { 565 630 ++ smallerCost; 631 vol = (*it)->GetVolume(); 632 } 566 633 } 567 634 // note: can remove already found view cells … … 572 639 outstream << "#RenderCost: " << currentRenderCost << endl; 573 640 outstream << "#ViewCells: " << smallerCost << endl; 574 }575 576 } 577 641 outstream << "#Volume: " << vol << endl << endl; 642 } 643 } 644 */ 578 645 579 646 void ViewCellsManager::EvalViewCellPartition(Preprocessor *preprocessor) … … 660 727 } 661 728 662 string filename = "histogram.log"; 663 int nViewCells = 5000; 664 665 EvalViewCellHistogram(filename, nViewCells); 666 729 #if 0 730 // evaluate view cells in a histogram 731 vector<int> nViewCells; 732 nViewCells.push_back(10000); 733 nViewCells.push_back(5000); 734 nViewCells.push_back(1000); 735 nViewCells.push_back(500); 736 nViewCells.push_back(100); 737 738 vector<int>::const_iterator iit, iit_end = nViewCells.end(); 739 char filename[64]; 740 741 for (iit = nViewCells.begin(); iit != nViewCells.end(); ++ iit) 742 { 743 Debug << "here2" << endl; 744 int n = *iit; 745 746 sprintf(filename, "histogram%06d.log", n); 747 EvalViewCellHistogram(filename, n); 748 } 749 750 #endif 667 751 // find empty view cells bug 668 752 if (TEST_EMPTY_VIEW_CELLS) … … 687 771 int i = 0; 688 772 689 ViewCellContainer::const_iterator it,it_end = neighborhood.end();690 691 for ( it = neighborhood.begin(); it != it_end; ++it, ++ i)692 { 693 const float mc = EvalMergeCost(root, * it);773 ViewCellContainer::const_iterator vit, vit_end = neighborhood.end(); 774 775 for (vit = neighborhood.begin(); vit != vit_end; ++ vit, ++ i) 776 { 777 const float mc = EvalMergeCost(root, *vit); 694 778 695 779 if (mc < mergeCost) -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r729 r734 155 155 Debug << "use random axis: " << mUseRandomAxis << endl; 156 156 Debug << "breath first splits: " << mBreathFirstSplits << endl; 157 Debug << "depth first splits: " << mDepthFirstSplits << endl; 158 157 159 Debug << "empty view cells merge: " << mEmptyViewCellsMergeAllowed << endl; 158 160 … … 940 942 void VspBspTree::EvalPriority(VspBspTraversalData &tData) const 941 943 { 942 tData.mPriority = mBreathFirstSplits ? 943 (float)-tData.mDepth : tData.mPvs * tData.mProbability; 944 if (mBreathFirstSplits) 945 tData.mPriority = (float)-tData.mDepth; 946 else if (mDepthFirstSplits) 947 tData.mPriority = (float)tData.mDepth; 948 else 949 tData.mPriority = tData.mPvs * tData.mProbability; 944 950 //cout << "priority: " << tData.mPriority << endl; 945 951 } -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
r729 r734 811 811 /// if we should use breath first priority for the splits 812 812 bool mBreathFirstSplits; 813 813 bool mDepthFirstSplits; 814 814 bool mEmptyViewCellsMergeAllowed; 815 815
Note: See TracChangeset
for help on using the changeset viewer.