Changeset 710 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 03/20/06 00:11:27 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r708 r710 16 16 #include "RssPreprocessor.h" 17 17 18 #define SAMPLE_AFTER_SUBDIVISION 118 #define SAMPLE_AFTER_SUBDIVISION 0 19 19 #define TEST_EMPTY_VIEW_CELLS 0 20 20 … … 62 62 environment->GetFloatValue("ViewCells.maxPvsRatio", mMaxPvsRatio); 63 63 64 bool emptyViewCells = false; 65 environment->GetBoolValue("ViewCells.pruneEmptyViewCells", emptyViewCells); 66 mMinPvsSize = emptyViewCells ? 1 : 0; 64 environment->GetBoolValue("ViewCells.pruneEmptyViewCells", mPruneEmptyViewCells); 65 66 // HACK 67 if (0) 68 mMinPvsSize = mPruneEmptyViewCells ? 1 : 0; 69 else 70 mMinPvsSize = 0; 67 71 68 72 environment->GetBoolValue("ViewCells.processOnlyValidViewCells", mOnlyValidViewCells); … … 85 89 environment->GetIntValue("ViewCells.Filter.maxSize", mMaxFilterSize); 86 90 environment->GetFloatValue("ViewCells.Filter.width", mFilterWidth); 87 //mSampleEmptyViewCells = true; 91 88 92 char buf[100]; 89 93 environment->GetStringValue("ViewCells.samplingType", buf); … … 112 116 113 117 118 114 119 Debug << "***********View Cells options ****************" << endl; 115 120 Debug << "color code: " << mColorCode << endl; … … 119 124 Debug << "max pvs ratio: " << mMaxPvsRatio << endl; 120 125 121 Debug << "prune empty view cells: " << emptyViewCells << endl;126 Debug << "prune empty view cells: " << mPruneEmptyViewCells << endl; 122 127 123 128 Debug << "process only valid view cells: " << mOnlyValidViewCells << endl; … … 137 142 Debug << "show visualization: " << mShowVisualization << endl; 138 143 Debug << "filter width: " << mFilterWidth << endl; 139 144 Debug << "sample after subdivision: " << SAMPLE_AFTER_SUBDIVISION << endl; 140 145 Debug << endl; 141 146 } … … 427 432 428 433 // needed to fix empty view cells 429 SetValidity(0, 99999999999);434 //SetValidity(0, 99999999999); 430 435 431 436 if (mEvaluateViewCells) … … 618 623 { 619 624 620 if ((vc->GetPvs().GetSize() > maxPvsSize) || 621 (vc->GetPvs().GetSize() < minPvsSize)) 622 { 623 return false; 624 } 625 626 return true; 627 } 628 625 if ((vc->GetPvs().GetSize() > maxPvsSize) || 626 (vc->GetPvs().GetSize() < minPvsSize)) 627 { 628 return false; 629 } 630 631 return true; 632 } 633 634 635 bool ViewCellsManager::EqualToSpatialNode(ViewCell *viewCell) const 636 { 637 return false; 638 } 639 640 int ViewCellsManager::ComputeBoxIntersections(const AxisAlignedBox3 &box, 641 ViewCellContainer &viewCells) const 642 { 643 return 0; 644 }; 629 645 630 646 AxisAlignedBox3 ViewCellsManager::GetFilterBBox(const Vector3 &viewPoint, … … 944 960 // generate parent view cell 945 961 ViewCellInterior *vc = new ViewCellInterior();//GenerateViewCell(); 946 962 947 963 vc->GetPvs() = left->GetPvs(); 948 949 964 // merge pvs 950 965 vc->GetPvs().Merge(right->GetPvs()); … … 961 976 } 962 977 963 vc->SetupChildLink(left); 964 vc->SetupChildLink(right); 965 978 // set only links to child (not from child to parent, maybe not wished!!) 979 vc->mChildren.push_back(left); 980 vc->mChildren.push_back(right); 981 966 982 return vc; 967 983 } … … 978 994 // merge pvs 979 995 vc->GetPvs().Merge((*it)->GetPvs()); 980 981 vc->SetupChildLink(*it);996 vc->mChildren.push_back(*it); 997 //vc->SetupChildLink(*it); 982 998 } 983 999 … … 2902 2918 const VssRayContainer &rays) 2903 2919 { 2920 mMaxPvsSize = (int)(mMaxPvsRatio * (float)objects.size()); 2921 2904 2922 // if view cells were already constructed 2905 2923 if (ViewCellsConstructed()) … … 2923 2941 Debug << "saved rays: " << (int)savedRays.size() << endl; 2924 2942 2925 mMaxPvsSize = (int)(mMaxPvsRatio * (float)objects.size());2926 2943 2927 2944 //TODO: remove … … 2968 2985 const ObjectContainer &objects) 2969 2986 { 2970 //-- post processing of bsp view cells2971 2987 int vcSize = 0; 2972 2988 int pvsSize = 0; 2973 2989 2974 2990 //-- merge view cells 2975 2976 2991 cout << "starting merge using " << mPostProcessSamples << " samples ... " << endl; 2977 2992 long startTime = GetTime(); … … 2981 2996 { 2982 2997 // TODO: should be done BEFORE the ray casting 2998 // compute tree by merging the nodes based on cost heuristics 2983 2999 mViewCellsTree->ConstructMergeTree(rays, objects); 2984 3000 } 2985 3001 else 2986 3002 { 2987 mViewCellsTree->SetRoot(ConstructSpatialMergeTree(mVspBspTree->GetRoot())); 3003 // compute tree by merging the nodes of the spatial hierarchy 3004 ViewCell *root = ConstructSpatialMergeTree(mVspBspTree->GetRoot()); 3005 mViewCellsTree->SetRoot(root); 2988 3006 } 2989 3007 … … 3162 3180 } 3163 3181 3164 3165 3182 // check if new view cells turned invalid 3166 Debug << "setting validity, min: " << mMinPvsSize << " max: " << mMaxPvsSize << endl; 3167 cout << "setting validity, min: " << mMinPvsSize << " max: " << mMaxPvsSize << endl; 3168 SetValidity(mMinPvsSize, mMaxPvsSize); 3183 int minPvs, maxPvs; 3184 3185 if (0) 3186 { 3187 minPvs = mMinPvsSize; 3188 maxPvs = mMaxPvsSize; 3189 } 3190 else 3191 { 3192 minPvs = mPruneEmptyViewCells ? 1 : 0; 3193 maxPvs = mMaxPvsSize; 3194 } 3195 Debug << "setting validity, min: " << minPvs << " max: " << maxPvs << endl; 3196 cout << "setting validity, min: " << minPvs << " max: " << maxPvs << endl; 3197 3198 SetValidity(minPvs, maxPvs); 3199 3169 3200 // update valid view space according to valid view cells 3170 3201 if (0) … … 3190 3221 MergeViewCells(postProcessRays, objects); 3191 3222 3192 3193 3223 // only for testing 3194 3224 TestSubdivision(); … … 3749 3779 mVspBspTree->ConstructGeometry(leaf, geom); 3750 3780 3751 const int cf = Polygon3::ClassifyPlane(geom.GetPolys(), *clipPlane, 0.00000001f); 3752 3753 if (cf == Polygon3::BACK_SIDE) 3781 const float eps = 0.00000001f; 3782 const int cf = geom.Side(*clipPlane, eps); 3783 3784 if (cf == -1) 3754 3785 { 3755 3786 exporter->ExportPolygons(geom.GetPolys()); 3756 3787 } 3757 else if (cf == Polygon3::SPLIT)3788 else if (cf == 0) 3758 3789 { 3759 3790 geom.SplitGeometry(front, … … 3761 3792 *clipPlane, 3762 3793 mViewSpaceBox, 3763 0.00000001f);3794 eps); 3764 3795 3765 3796 //Debug << "geo size: " << geom.Size() << endl;
Note: See TracChangeset
for help on using the changeset viewer.