- Timestamp:
- 03/20/06 00:11:27 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r708 r710 560 560 mMergeQueue.pop(); 561 561 562 // both view cells equal 562 // both view cells equal because of previous merges 563 563 // NOTE: do I really still need this? probably cannot happen!! 564 564 if (mc.mLeftViewCell == mc.mRightViewCell) … … 579 579 totalRenderCost += renderCostIncr; 580 580 mDeviation += mc.GetDeviationIncr(); 581 582 583 // merge the view cells of leaf1 and leaf2581 582 583 //-- merge the view cells of leaf1 and leaf2 584 584 int pvsDiff; 585 585 ViewCellInterior *mergedVc = 586 586 MergeViewCells(mc.mLeftViewCell, mc.mRightViewCell, pvsDiff); 587 587 588 588 589 589 // total render cost and deviation has changed … … 641 641 642 642 ViewCellInterior *root = mViewCellsManager->MergeViewCells(activeViewCells); 643 644 ViewCellContainer::const_iterator it, it_end = root->mChildren.end(); 645 646 for (it = root->mChildren.begin(); it != it_end; ++ it) 647 (*it)->SetParent(root); 648 643 649 root->SetMergeCost(totalRenderCost); 644 650 // $$JB keep this 0 temporarilly … … 647 653 mRoot = root; 648 654 } 649 else if ((int)activeViewCells.size() == 1) 655 // normal case 656 else if (!activeViewCells.empty()) 650 657 { 651 658 Debug << "setting root of the merge history" << endl; 652 659 mRoot = activeViewCells[0]; 660 Debug << "rootvc volume: " << mRoot->GetVolume() << endl; 653 661 } 654 662 … … 742 750 743 751 // all merged view cells have been found 744 if (i >= viewCells.size())752 if (i >= (int)viewCells.size()) 745 753 break; 746 754 747 // already merged view cell, put it to end of vector755 // already merged this view cell, put it to end of vector 748 756 if (viewCells[i]->GetParent()) 749 757 swap(viewCells[i], viewCells.back()); 750 758 751 viewCells[i ++]->Mail(); 759 // mail view cell as it has not been merged 760 viewCells[i]->Mail(); 761 762 // increase loop counter 763 ++ i; 752 764 } 753 765 … … 847 859 if (!vc) return NULL; 848 860 861 l->SetParent(vc); 862 r->SetParent(vc); 863 849 864 // set new size of view cell 850 865 if (mUseAreaForPvs) 866 { 851 867 vc->SetArea(l->GetArea() + l->GetArea()); 868 } 852 869 else 853 870 { 854 871 vc->SetVolume(r->GetVolume() + l->GetVolume()); 855 872 } 873 874 856 875 // important so other merge candidates sharing this view cell 857 876 // are notified that the merge cost must be updated!! … … 957 976 return shuffledViewCells; 958 977 } 959 960 961 978 962 979 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r704 r710 159 159 mFront = f; 160 160 } 161 161 162 162 163 /****************************************************************/ … … 588 589 } 589 590 591 590 592 int BspTree::AddMeshToPolygons(Mesh *mesh, 591 593 PolygonContainer &polys, 592 594 MeshInstance *parent) 593 595 { 594 FaceContainer::const_iterator fi ;596 FaceContainer::const_iterator fi, fi_end = mesh->mFaces.end(); 595 597 596 598 // copy the face data to polygons 597 for (fi = mesh->mFaces.begin(); fi != mesh->mFaces.end(); ++ fi)599 for (fi = mesh->mFaces.begin(); fi != fi_end; ++ fi) 598 600 { 599 601 Polygon3 *poly = new Polygon3((*fi), mesh); … … 2839 2841 { 2840 2842 mPolys.reserve(rhs.mPolys.size()); 2841 2843 mPlanes.reserve(rhs.mPolys.size()); 2844 2845 2842 2846 PolygonContainer::const_iterator it, it_end = rhs.mPolys.end(); 2843 2847 2844 2848 int i = 0; 2845 2849 2846 for (it = rhs.mPolys.begin(); it != it_end; ++ it )2850 for (it = rhs.mPolys.begin(); it != it_end; ++ it, ++i) 2847 2851 { 2848 2852 Polygon3 *poly = *it; 2849 Add(new Polygon3(*poly), rhs.mPlanes[i ++]); 2853 Add(new Polygon3(*poly), rhs.mPlanes[i]); 2854 } 2855 } 2856 2857 2858 BspNodeGeometry& BspNodeGeometry::operator=(const BspNodeGeometry& g) 2859 { 2860 if (this == &g) 2861 return *this; 2862 2863 CLEAR_CONTAINER(mPolys); 2864 2865 mPolys.reserve(g.mPolys.size()); 2866 mPlanes.reserve(g.mPolys.size()); 2867 2868 PolygonContainer::const_iterator it, it_end = g.mPolys.end(); 2869 2870 int i = 0; 2871 2872 for (it = g.mPolys.begin(); it != it_end; ++ it, ++ i) 2873 { 2874 Polygon3 *poly = *it; 2875 Add(new Polygon3(*poly), g.mPlanes[i]); 2876 } 2877 2878 return *this; 2879 } 2880 2881 2882 BspNodeGeometry::BspNodeGeometry(const PolygonContainer &polys) 2883 { 2884 mPolys = polys; 2885 mPlanes.reserve(polys.size()); 2886 2887 PolygonContainer::const_iterator it, it_end = polys.end(); 2888 2889 for (it = polys.begin(); it != it_end; ++ it) 2890 { 2891 Polygon3 *poly = *it; 2892 mPlanes.push_back(poly->GetSupportingPlane()); 2850 2893 } 2851 2894 } … … 2922 2965 2923 2966 2924 int BspNodeGeometry::Side(const Plane3 &plane ) const2967 int BspNodeGeometry::Side(const Plane3 &plane, const float eps) const 2925 2968 { 2926 2969 PolygonContainer::const_iterator it, it_end = mPolys.end(); … … 2931 2974 for (it = mPolys.begin(); it != it_end; ++ it) 2932 2975 { 2933 const int side = (*it)->Side(plane, 0.0f);2976 const int side = (*it)->Side(plane, eps); 2934 2977 2935 2978 if (side == -1) … … 3042 3085 const float epsilon) const 3043 3086 { 3087 #if 0 3088 // trivial cases 3089 const int cf = Side(splitPlane, epsilon); 3090 3091 if (cf == -1) 3092 { 3093 back = *this; 3094 return false; 3095 } 3096 else if (cf == 1) 3097 { 3098 front = *this; 3099 return false; 3100 } 3101 #endif 3102 3044 3103 // get cross section of new polygon 3045 3104 Polygon3 *planePoly = box.CrossSection(splitPlane); 3046 //Vector3 ndummy = planePoly->GetSupportingPlane().mNormal;3105 3047 3106 // split polygon with all other polygons 3048 3107 planePoly = SplitPolygon(planePoly, epsilon); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h
r697 r710 30 30 {}; 31 31 32 // copy constructor copying the polygon array 32 /** copy constructor copying the polygon array. 33 The polygons are deeply copied. 34 */ 33 35 BspNodeGeometry(const BspNodeGeometry &rhs); 34 35 //BspNodeGeometry(const PolygonContainer &polys); 36 /** This operator uses a deep copy to copy the polygons. 37 */ 38 BspNodeGeometry& operator=(const BspNodeGeometry& p); 39 40 /** Builds node geometry using this polygons. 41 @NOTE The polygons are NOT duplicated, only 42 a shallow copy is used. 43 */ 44 BspNodeGeometry(const PolygonContainer &polys); 36 45 37 46 ~BspNodeGeometry(); … … 67 76 -1 if geometry in back of plane 68 77 */ 69 int Side(const Plane3 &plane ) const;78 int Side(const Plane3 &plane, const float eps = 0.0f) const; 70 79 71 80 /** Splits the polygon and returns the part of the polygon inside of the node geometry. … … 97 106 const PolygonContainer &GetPolys(); 98 107 108 /** Adds polygon and plane equation to this geometry. 109 */ 99 110 void Add(Polygon3 *p, const Plane3 &plane); 100 111 -
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; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r706 r710 348 348 int maxPvsSize) const; 349 349 350 /** sets validy of all viewcells */ 350 /** sets validy of all viewcells 351 */ 351 352 virtual void SetValidity( 352 353 int minPvsSize, … … 355 356 356 357 /** set valid viewcells in the range of pvs. sorts the viewcells 357 according to the pvs and then pickups those in the ranges */ 358 359 360 void SetValidityPercentage(const float minValid, const float maxValid); 358 according to the pvs and then pickups those in the ranges 359 */ 360 void SetValidityPercentage(const float minValid, const float maxValid); 361 361 362 362 int CountValidViewcells() const; … … 413 413 /** Returns true if this (logical) view cell is equal to a spatial node. 414 414 */ 415 virtual bool EqualToSpatialNode(ViewCell *viewCell) const { return false;}415 virtual bool EqualToSpatialNode(ViewCell *viewCell) const; 416 416 417 417 /** Sets current view cells set to active, i.e., the sampling is done in this view cell set. … … 433 433 @returns number of view cells found 434 434 */ 435 virtual int ComputeBoxIntersections(const AxisAlignedBox3 &box, ViewCellContainer &viewCells) const {return 0;}; 435 virtual int ComputeBoxIntersections(const AxisAlignedBox3 &box, 436 ViewCellContainer &viewCells) const; 436 437 437 438 virtual void TestFilter(const ObjectContainer &objects) {}; … … 511 512 ViewCellsTree *mViewCellsTree; 512 513 513 //bool mSampleEmptyViewCells;514 bool mPruneEmptyViewCells; 514 515 515 516 /// maximum number of samples taken for construction of the view cells -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r708 r710 464 464 465 465 // first node is kd node, i.e. an axis aligned box 466 if ( 0)466 if (1) 467 467 tData.mIsKdNode = true; 468 468 else … … 731 731 ++ mBspStats.polySplits; 732 732 733 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && splitAxis < 3);733 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && (splitAxis < 3)); 734 734 735 735 // how often was max cost ratio missed in this branch? … … 852 852 ++ mBspStats.polySplits; 853 853 854 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && splitAxis < 3);854 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && (splitAxis < 3)); 855 855 856 856 // how often was max cost ratio missed in this branch? … … 901 901 BspLeaf *leaf = dynamic_cast<BspLeaf *>(newNode); 902 902 BspViewCell *viewCell = new BspViewCell(); 903 904 905 903 904 leaf->SetViewCell(viewCell); 905 906 906 //-- update pvs 907 907 int conSamp = 0; … … 1132 1132 1133 1133 1134 void VspBspTree::SortSplitCandidates(const RayInfoContainer &rays, const int axis) 1134 void VspBspTree::SortSplitCandidates(const RayInfoContainer &rays, 1135 const int axis, 1136 float minBand, 1137 float maxBand) 1135 1138 { 1136 1139 mSplitCandidates->clear(); … … 1147 1150 mSplitCandidates->reserve(requestedSize); 1148 1151 1152 float pos; 1153 1154 // float values => don't compare with exact values 1155 if (0) 1156 { 1157 minBand += Limits::Small; 1158 maxBand -= Limits::Small; 1159 } 1160 1149 1161 // insert all queries 1150 1162 for (RayInfoContainer::const_iterator ri = rays.begin(); ri < rays.end(); ++ ri) 1151 1163 { 1152 1164 const bool positive = (*ri).mRay->HasPosDir(axis); 1153 mSplitCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMin : SortableEntry::ERayMax, 1154 (*ri).ExtrapOrigin(axis), (*ri).mRay)); 1155 1156 mSplitCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMax : SortableEntry::ERayMin, 1157 (*ri).ExtrapTermination(axis), (*ri).mRay)); 1165 1166 pos = (*ri).ExtrapOrigin(axis); 1167 // clamp to min / max band 1168 if (0) ClipValue(pos, minBand, maxBand); 1169 1170 mSplitCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMin : SortableEntry::ERayMax, 1171 pos, (*ri).mRay)); 1172 1173 pos = (*ri).ExtrapTermination(axis); 1174 // clamp to min / max band 1175 if (0) ClipValue(pos, minBand, maxBand); 1176 1177 mSplitCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMax : SortableEntry::ERayMin, 1178 pos, (*ri).mRay)); 1158 1179 } 1159 1180 … … 1165 1186 const AxisAlignedBox3 &box, 1166 1187 const int pvsSize, 1167 const int &axis,1188 const int axis, 1168 1189 float &position) 1169 1190 { 1170 SortSplitCandidates(rays, axis); 1191 const float minBox = box.Min(axis); 1192 const float maxBox = box.Max(axis); 1193 const float sizeBox = maxBox - minBox; 1194 1195 const float minBand = minBox + 0.1f * sizeBox; 1196 const float maxBand = minBox + 0.9f * sizeBox; 1197 1198 SortSplitCandidates(rays, axis, minBand, maxBand); 1171 1199 1172 1200 // go through the lists, count the number of objects left and right … … 1179 1207 int pvsFront = pvsr; 1180 1208 1181 float minBox = box.Min(axis);1182 float maxBox = box.Max(axis);1183 float sizeBox = maxBox - minBox;1184 1185 float minBand = minBox + 0.1f * (maxBox - minBox);1186 float maxBand = minBox + 0.9f * (maxBox - minBox);1187 1188 1209 float sum = (float)pvsSize * sizeBox; 1189 1210 float minSum = 1e20f; 1211 1212 // if no border can be found, take mid split 1213 position = minBox + 0.5f * sizeBox; 1190 1214 1191 1215 Intersectable::NewMail(); … … 1273 1297 1274 1298 // Note: sufficient to compare size of bounding boxes of front and back side? 1275 if (( *ci).value > minBand && (*ci).value < maxBand)1299 if (((*ci).value >= minBand) && ((*ci).value <= maxBand)) 1276 1300 { 1277 1301 sum = pvsl * ((*ci).value - minBox) + pvsr * (maxBox - (*ci).value); … … 1284 1308 minSum = sum; 1285 1309 position = (*ci).value; 1286 1310 1287 1311 pvsBack = pvsl; 1288 1312 pvsFront = pvsr; … … 1290 1314 } 1291 1315 } 1316 1317 //Debug << "pos: " << position << " sizebox: " << sizeBox << " pvs: " << pvsSize << endl; 1292 1318 1293 1319 // -- compute cost 1294 1295 1320 const int lowerPvsLimit = mViewCellsManager->GetMinPvsSize(); 1296 1321 const int upperPvsLimit = mViewCellsManager->GetMaxPvsSize(); … … 1324 1349 float &pFront, 1325 1350 float &pBack, 1326 const bool useKdSplit)1351 const bool isKdNode) 1327 1352 { 1328 1353 float nPosition[3]; … … 1344 1369 // create bounding box of node geometry 1345 1370 AxisAlignedBox3 box; 1346 box.Initialize(); 1347 1371 1348 1372 //TODO: for kd split geometry already is box => only take minmax vertices 1349 1373 if (1) 1350 1374 { 1351 PolygonContainer::const_iterator it, it_end = tData.mGeometry->GetPolys().end(); 1352 1353 for(it = tData.mGeometry->GetPolys().begin(); it < it_end; ++ it) 1354 box.Include(*(*it)); 1375 tData.mGeometry->GetBoundingBox(box); 1355 1376 } 1356 1377 else 1357 1378 { 1379 box.Initialize(); 1358 1380 RayInfoContainer::const_iterator ri, ri_end = tData.mRays->end(); 1359 1381 … … 1383 1405 if (!mUseCostHeuristics) 1384 1406 { 1385 nFrontGeom[axis] = new BspNodeGeometry();1386 nBackGeom[axis] = new BspNodeGeometry();1387 1388 1407 nPosition[axis] = (box.Min()[axis] + box.Max()[axis]) * 0.5f; 1389 1408 Vector3 normal(0,0,0); normal[axis] = 1.0f; 1390 1409 1391 1410 // allows faster split because we have axis aligned kd tree boxes 1392 if (0 && useKdSplit)1411 if (0 && isKdNode) 1393 1412 { 1394 1413 nCostRatio[axis] = EvalAxisAlignedSplitCost(tData, … … 1401 1420 Vector3 pos; 1402 1421 1422 // create back geometry from box 1403 1423 pos = box.Max(); pos[axis] = nPosition[axis]; 1404 1424 AxisAlignedBox3 bBox(box.Min(), pos); 1405 // TODO 1406 #if 0 1407 bBox.ExtractPolys(nBackGeom[axis]->GetPolys()); 1408 #endif 1425 PolygonContainer fPolys; 1426 bBox.ExtractPolys(fPolys); 1427 1428 nBackGeom[axis] = new BspNodeGeometry(fPolys); 1429 1430 // create front geometry from box 1409 1431 pos = box.Min(); pos[axis] = nPosition[axis]; 1410 1432 AxisAlignedBox3 fBox(pos, box.Max()); 1411 // TODO 1412 #if 0 1413 fBox.ExtractPolys(nFrontGeom[axis]->GetPolys());1414 #endif 1433 1434 PolygonContainer bPolys; 1435 fBox.ExtractPolys(bPolys); 1436 nFrontGeom[axis] = new BspNodeGeometry(bPolys); 1415 1437 } 1416 1438 else 1417 1439 { 1440 nFrontGeom[axis] = new BspNodeGeometry(); 1441 nBackGeom[axis] = new BspNodeGeometry(); 1442 1418 1443 nCostRatio[axis] = 1419 1444 EvalSplitPlaneCost(Plane3(normal, nPosition[axis]), … … 1978 2003 1979 2004 const int pvsSize = data.mPvs; 1980 2005 //cout << "here433" << endl; 1981 2006 RayInfoContainer::const_iterator rit, rit_end = data.mRays->end(); 1982 2007 … … 2832 2857 2833 2858 2834 int VspBspTree::FindApproximateNeighbors(BspNode *n, vector<BspLeaf *> &neighbors, 2859 int VspBspTree::FindApproximateNeighbors(BspNode *n, 2860 vector<BspLeaf *> &neighbors, 2835 2861 const bool onlyUnmailed) const 2836 2862 { … … 2900 2926 nodeStack.push(bspNodePair(interior->GetBack(), bGeom)); 2901 2927 DEL_PTR(fGeom); 2902 }2928 } 2903 2929 else 2904 2930 { … … 3442 3468 3443 3469 vector<BspLeaf *> neighbors; 3470 3471 // appoximate neighbor search has slightl relaxed constraints 3444 3472 if (1) 3445 3473 FindNeighbors(leaf, neighbors, true); 3446 3474 else 3447 3475 FindApproximateNeighbors(leaf, neighbors, true); 3476 3448 3477 vector<BspLeaf *>::const_iterator nit, nit_end = neighbors.end(); 3449 3478 … … 3458 3487 // in the tree? 3459 3488 if (mEmptyViewCellsMergeAllowed || 3460 !leaf->GetViewCell()->GetPvs().Empty() || !(*nit)->GetViewCell()->GetPvs().Empty() || 3489 !leaf->GetViewCell()->GetPvs().Empty() || 3490 !(*nit)->GetViewCell()->GetPvs().Empty() || 3461 3491 leaf->IsSibling(*nit)) 3462 3492 { -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
r697 r710 535 535 @param splitCandidates returns sorted list of split candidates 536 536 */ 537 void SortSplitCandidates(const RayInfoContainer &rays, const int axis); 537 void SortSplitCandidates(const RayInfoContainer &rays, 538 const int axis, 539 float minBand, 540 float maxBand); 538 541 539 542 /** Computes best cost for axis aligned planes. … … 542 545 const AxisAlignedBox3 &box, 543 546 const int pvsSize, 544 const int &axis,547 const int axis, 545 548 float &position); 546 549
Note: See TracChangeset
for help on using the changeset viewer.