Changeset 2210 for GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
- Timestamp:
- 03/08/07 13:23:13 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r2206 r2210 237 237 mRoot(NULL), 238 238 mTimeStamp(1), 239 mIsInitialSubdivision(false), 240 mCachedObjects(NULL) 239 mIsInitialSubdivision(false) 241 240 { 242 241 ReadEnvironment(); … … 394 393 mNodeTimer.Entry(); 395 394 395 /* 396 396 #if STORE_VIEWCELLS_WITH_BVH 397 AssociateViewCellsWithObjects(sc.m FrontObjects);398 AssociateViewCellsWithObjects(sc.m BackObjects);397 AssociateViewCellsWithObjects(sc.mSampledFrontObjects); 398 AssociateViewCellsWithObjects(sc.mSampledBackObjects); 399 399 #endif 400 */ 400 401 const BvhTraversalData &tData = sc.mParentData; 401 402 BvhLeaf *leaf = tData.mNode; … … 451 452 backData.mNode = back; 452 453 454 backData.mSampledObjects = new ObjectContainer(); 455 frontData.mSampledObjects = new ObjectContainer(); 456 457 *backData.mSampledObjects = sc.mSampledBackObjects; 458 *frontData.mSampledObjects = sc.mSampledFrontObjects; 459 453 460 back->mObjects = sc.mBackObjects; 454 461 front->mObjects = sc.mFrontObjects; … … 456 463 // if the number of rays is too low, no assumptions can be made 457 464 // (=> switch to surface area heuristics?) 458 frontData.mNumRays = CountRays(sc.m FrontObjects);459 backData.mNumRays = CountRays(sc.m BackObjects);465 frontData.mNumRays = CountRays(sc.mSampledFrontObjects); 466 backData.mNumRays = CountRays(sc.mSampledBackObjects); 460 467 461 468 AssociateObjectsWithLeaf(back); … … 465 472 //-- compute pvs correction to cope with undersampling 466 473 467 frontData.mPvs = (float) CountViewCells(front->mObjects);468 backData.mPvs = (float) CountViewCells(back->mObjects);474 frontData.mPvs = (float)sc.mNumFrontViewCells;//(float)CountViewCells(sc.mSampledFrontObjects); 475 backData.mPvs = (float)sc.mNumBackViewCells;//(float)CountViewCells(sc.mSampledBackObjects); 469 476 470 477 frontData.mCorrectedPvs = sc.mCorrectedFrontPvs; … … 474 481 // compute probability of this node being visible, 475 482 // i.e., volume of the view cells that can see this node 476 frontData.mVolume = EvalViewCellsVolume(sc.mFrontObjects) / GetViewSpaceVolume();477 backData.mVolume = EvalViewCellsVolume(sc.mBackObjects) / GetViewSpaceVolume();483 frontData.mVolume = sc.mVolumeFrontViewCells;//EvalViewCellsVolume(sc.mSampledFrontObjects) / GetViewSpaceVolume(); 484 backData.mVolume = sc.mVolumeBackViewCells;//EvalViewCellsVolume(sc.mSampledBackObjects) / GetViewSpaceVolume(); 478 485 479 486 frontData.mCorrectedVolume = sc.mCorrectedFrontVolume; … … 493 500 AssignSortedObjects(sc, frontData, backData); 494 501 } 495 502 /* 496 503 #if STORE_VIEWCELLS_WITH_BVH 497 ReleaseViewCells(sc.m FrontObjects);498 ReleaseViewCells(sc.m BackObjects);504 ReleaseViewCells(sc.mSampledFrontObjects); 505 ReleaseViewCells(sc.mSampledBackObjects); 499 506 #endif 500 507 */ 501 508 mNodeTimer.Exit(); 502 509 … … 637 644 #if STORE_VIEWCELLS_WITH_BVH 638 645 // fill view cells cache 639 AssociateViewCellsWithObjects(*splitCandidate.mParentData.mS ortedObjects[3]);646 AssociateViewCellsWithObjects(*splitCandidate.mParentData.mSampledObjects); 640 647 #endif 641 648 642 649 if (computeSplitPlane) 643 650 { 651 splitCandidate.mFrontObjects.clear(); 652 splitCandidate.mBackObjects.clear(); 653 splitCandidate.mSampledFrontObjects.clear(); 654 splitCandidate.mSampledBackObjects.clear(); 655 644 656 const bool sufficientSamples = 645 657 splitCandidate.mParentData.mNumRays > mMinRaysForVisibility; … … 663 675 splitCandidate.SetMaxCostMisses(maxCostRatioViolated ? 664 676 previousMisses + 1 : previousMisses); 665 } 677 678 StoreSampledObjects(splitCandidate.mSampledFrontObjects, splitCandidate.mFrontObjects); 679 StoreSampledObjects(splitCandidate.mSampledBackObjects, splitCandidate.mBackObjects); 680 } 681 666 682 mPlaneTimer.Exit(); 667 683 … … 672 688 673 689 // avg contribution of a ray to a pvs 674 const float pvs = (float)CountViewCells( leaf->mObjects);690 const float pvs = (float)CountViewCells(*tData.mSampledObjects); 675 691 const float avgRayContri = AvgRayContribution((int)pvs, tData.mNumRays); 676 692 … … 679 695 const float viewSpaceVol = GetViewSpaceVolume(); 680 696 681 const float oldVolume = EvalViewCellsVolume( leaf->mObjects) / viewSpaceVol;697 const float oldVolume = EvalViewCellsVolume(*tData.mSampledObjects) / viewSpaceVol; 682 698 const float oldRatio = (tData.mVolume) > 0 ? oldVolume / tData.mVolume : 1; 683 699 const float parentVol = tData.mCorrectedVolume * oldRatio; … … 685 701 // this leaf is a pvs entry in all the view cells 686 702 // that see one of the objects. 687 const float frontVol = EvalViewCellsVolume(splitCandidate.mFrontObjects) / viewSpaceVol; 688 const float backVol = EvalViewCellsVolume(splitCandidate.mBackObjects) / viewSpaceVol; 703 splitCandidate.mVolumeFrontViewCells = EvalViewCellsVolume(splitCandidate.mSampledFrontObjects) / viewSpaceVol; 704 splitCandidate.mVolumeBackViewCells = EvalViewCellsVolume(splitCandidate.mSampledBackObjects) / viewSpaceVol; 705 706 splitCandidate.mNumFrontViewCells = CountViewCells(splitCandidate.mSampledFrontObjects); 707 splitCandidate.mNumBackViewCells = CountViewCells(splitCandidate.mSampledBackObjects); 689 708 690 709 splitCandidate.mCorrectedFrontVolume = 691 mHierarchyManager->EvalCorrectedPvs( frontVol, parentVol, avgRayContri);710 mHierarchyManager->EvalCorrectedPvs(splitCandidate.mVolumeFrontViewCells, parentVol, avgRayContri); 692 711 693 712 splitCandidate.mCorrectedBackVolume = 694 mHierarchyManager->EvalCorrectedPvs( backVol, parentVol, avgRayContri);713 mHierarchyManager->EvalCorrectedPvs(splitCandidate.mVolumeBackViewCells, parentVol, avgRayContri); 695 714 696 715 const float relfrontCost = splitCandidate.mCorrectedFrontVolume * … … 707 726 708 727 // increase in pvs entries 709 const int pvsEntriesIncr = EvalPvsEntriesIncr(splitCandidate, avgRayContri); 728 const int pvsEntriesIncr = EvalPvsEntriesIncr(splitCandidate, 729 avgRayContri, 730 (int)pvs, 731 splitCandidate.mNumFrontViewCells, 732 splitCandidate.mNumBackViewCells); 733 710 734 splitCandidate.SetPvsEntriesIncr(pvsEntriesIncr); 711 735 … … 715 739 << " avg ray contri: " << avgRayContri << " ratio: " << oldRatio 716 740 << " parent: " << parentVol << " old vol: " << oldVolume 717 << " frontvol: " << frontVol<< " corr. " << splitCandidate.mCorrectedFrontVolume718 << " backvol: " << backVol<< " corr. " << splitCandidate.mCorrectedBackVolume << endl;741 << " frontvol: " << splitCandidate.mVolumeFrontViewCells << " corr. " << splitCandidate.mCorrectedFrontVolume 742 << " backvol: " << splitCandidate.mVolumeBackViewCells << " corr. " << splitCandidate.mCorrectedBackVolume << endl; 719 743 } 720 744 … … 733 757 734 758 #if STORE_VIEWCELLS_WITH_BVH 735 ReleaseViewCells(*splitCandidate.mParentData.mS ortedObjects[3]);759 ReleaseViewCells(*splitCandidate.mParentData.mSampledObjects); 736 760 #endif 737 761 … … 741 765 742 766 int BvHierarchy::EvalPvsEntriesIncr(BvhSubdivisionCandidate &splitCandidate, 743 const float avgRayContri) //const 744 { 745 const float oldPvsSize = (float)CountViewCells(splitCandidate.mParentData.mNode->mObjects); 767 const float avgRayContri, 768 const int numParentViewCells, 769 const int numFrontViewCells, 770 const int numBackViewCells) //const 771 { 772 const float oldPvsSize = (float)numParentViewCells;//CountViewCells(*splitCandidate.mParentData.mSampledObjects); 746 773 const float oldPvsRatio = (splitCandidate.mParentData.mPvs > 0) ? oldPvsSize / splitCandidate.mParentData.mPvs : 1; 747 774 748 775 const float parentPvs = splitCandidate.mParentData.mCorrectedPvs * oldPvsRatio; 749 776 750 const int frontViewCells = CountViewCells(splitCandidate.mFrontObjects);751 const int backViewCells = CountViewCells(splitCandidate.mBackObjects);777 const int frontViewCells = numFrontViewCells;//CountViewCells(splitCandidate.mSampledFrontObjects); 778 const int backViewCells = numBackViewCells;//CountViewCells(splitCandidate.mSampledBackObjects); 752 779 753 780 splitCandidate.mCorrectedFrontPvs = … … 976 1003 const float cost = (tData.mNode->GetBoundingBox().Size().DrivingAxis() == axis) ? -1.0f : 0.0f; 977 1004 #else 978 const float oldRenderCost = Eval RenderCost(tData.mNode->mObjects);1005 const float oldRenderCost = EvalAbsCost(tData.mLeaf->mObjects) / EvalProbability(tData.mSampledObjects); 979 1006 const float newRenderCost = EvalRenderCost(objectsFront) + EvalRenderCost(objectsBack); 980 1007 … … 1196 1223 Intersectable *obj = (*cit).mObject; 1197 1224 1198 const float renderCost = mViewCellsManager->EvalRenderCost(obj);1225 const float renderCost = ViewCellsManager::EvalRenderCost(obj); 1199 1226 1200 1227 objectsLeft += renderCost; … … 1329 1356 float volRight = totalVol; 1330 1357 1331 #if USE_BETTER_RENDERCOST_EST1358 #if 1//USE_BETTER_RENDERCOST_EST 1332 1359 const float nTotalObjects = EvalAbsCost(tData.mNode->mObjects); 1333 1360 float nObjectsLeft = 0; … … 1386 1413 nObjectsLeft += rc; 1387 1414 nObjectsRight -= rc; 1388 1389 // split is only valid if #objects on left and right is not zero 1390 const bool noValidSplit = ((nObjectsLeft <= Limits::Small) || 1391 (nObjectsRight <= Limits::Small)); 1415 1392 1416 #else 1393 1417 ++ nObjectsLeft; 1394 1418 -- nObjectsRight; 1395 1419 #endif 1420 1396 1421 // split is only valid if #objects on left and right is not zero 1397 const bool noValidSplit = !nObjectsLeft || !nObjectsRight; 1398 1399 #endif 1400 1422 const bool noValidSplit = (nObjectsRight <= Limits::Small); 1423 1401 1424 // the heuristics 1402 1425 const float sum = noValidSplit ? … … 1531 1554 1532 1555 1533 CollectViewCells( tData.mNode->mObjects,1556 CollectViewCells(*tData.mSampledObjects, 1534 1557 viewCells, 1535 1558 setCounter, … … 1851 1874 /////////////// 1852 1875 //-- render cost heuristics 1876 const float objRenderCost = EvalAbsCost(objects); 1853 1877 1854 1878 const float viewSpaceVol = mViewCellsManager->GetViewSpaceBox().GetVolume(); … … 1856 1880 // probability that view point lies in a view cell which sees this node 1857 1881 const float p = EvalViewCellsVolume(objects) / viewSpaceVol; 1858 const float objRenderCost = EvalAbsCost(objects);1859 1882 1860 1883 return objRenderCost * p; 1884 } 1885 1886 1887 float BvHierarchy::EvalProbability(const ObjectContainer &objects)// const 1888 { 1889 const float viewSpaceVol = mViewCellsManager->GetViewSpaceBox().GetVolume(); 1890 1891 // probability that view point lies in a view cell which sees this node 1892 return EvalViewCellsVolume(objects) / viewSpaceVol; 1861 1893 } 1862 1894 … … 1941 1973 1942 1974 1975 int BvHierarchy::CollectViewCells(const ObjectContainer &objects, 1976 ViewCellContainer &viewCells, 1977 const bool setCounter, 1978 const bool onlyUnmailedRays)// const 1979 { 1980 ViewCell::NewMail(); 1981 1982 ObjectContainer::const_iterator oit, oit_end = objects.end(); 1983 1984 // use mailing to avoid dublicates 1985 const bool useMailBoxing = true; 1986 1987 int numRays = 0; 1988 // loop through all object and collect view cell pvs of this node 1989 for (oit = objects.begin(); oit != oit_end; ++ oit) 1990 { 1991 // use mailing to avoid duplicates 1992 numRays += CollectViewCells(*oit, viewCells, useMailBoxing, setCounter, onlyUnmailedRays); 1993 } 1994 1995 return numRays; 1996 } 1997 1943 1998 1944 1999 #if STORE_VIEWCELLS_WITH_BVH … … 1953 2008 (*oit)->DelViewCells(); 1954 2009 } 1955 1956 DEL_PTR(mCachedObjects); 1957 } 1958 1959 1960 void BvHierarchy::AssociateViewCellsWithObjects(const ObjectContainer &objects)// const 2010 } 2011 2012 2013 void BvHierarchy::AssociateViewCellsWithObjects(const ObjectContainer &objects) const 1961 2014 { 1962 2015 ObjectContainer::const_iterator oit, oit_end = objects.end(); 1963 2016 1964 2017 const bool useMailBoxing = true; 1965 1966 mCachedObjects = new ObjectContainer(); 2018 VssRay::NewMail(); 1967 2019 1968 2020 for (oit = objects.begin(); oit != oit_end; ++ oit) 1969 2021 { 1970 if (!(*oit)->GetOrCreateRays()->empty())1971 {1972 2022 ViewCell::NewMail(); 1973 2023 // use mailing to avoid duplicates 1974 2024 AssociateViewCellsWithObject(*oit, useMailBoxing); 1975 1976 mCachedObjects->push_back(*oit);1977 }1978 2025 } 1979 2026 } … … 1982 2029 int BvHierarchy::AssociateViewCellsWithObject(Intersectable *obj, const bool useMailBoxing) const 1983 2030 { 2031 int nRays = 0; 2032 1984 2033 if (!obj->GetOrCreateViewCells()->empty()) 1985 2034 { 1986 cerr << "AssociateViewCellsWithObject: view cells cache error" << endl; 1987 exit(0); 2035 cerr << "AssociateViewCellsWithObject: view cells cache not working" << endl; 1988 2036 } 1989 2037 … … 2001 2049 // continue; 2002 2050 mHierarchyManager->mVspTree->GetViewCells(*ray, *objViewCells); 2003 } 2004 2005 return (int)vssRays->size(); 2051 2052 if (!useMailBoxing || !ray->Mailed()) 2053 { 2054 if (useMailBoxing) 2055 ray->Mail(); 2056 2057 ++ nRays; 2058 } 2059 } 2060 2061 return nRays; 2006 2062 } 2007 2063 … … 2014 2070 if (obj->GetOrCreateViewCells()->empty()) 2015 2071 { 2016 cerr << "h";//CountViewCells: view cells empty, view cells cache not working" << endl;2072 //cerr << "h";//CountViewCells: view cells empty, view cells cache not working" << endl; 2017 2073 return CountViewCellsFromRays(obj); 2018 2074 } … … 2177 2233 } 2178 2234 2179 2180 int BvHierarchy::CollectViewCells(const ObjectContainer &objects,2181 ViewCellContainer &viewCells,2182 const bool setCounter,2183 const bool onlyUnmailedRays)// const2184 {2185 ViewCell::NewMail();2186 2187 // use mailing to avoid dublicates2188 const bool useMailBoxing = true;2189 2190 int numRays = 0;2191 2192 if (mCachedObjects)2193 {2194 ObjectContainer::const_iterator oit, oit_end = mCachedObjects->end();2195 2196 // loop through all object and collect view cell pvs of this node2197 for (oit = mCachedObjects->begin(); oit != oit_end; ++ oit)2198 {2199 // use mailing to avoid duplicates2200 numRays += CollectViewCells(*oit, viewCells, useMailBoxing, setCounter, onlyUnmailedRays);2201 }2202 }2203 else2204 {2205 ObjectContainer::const_iterator oit, oit_end = objects.end();2206 2207 // loop through all object and collect view cell pvs of this node2208 for (oit = objects.begin(); oit != oit_end; ++ oit)2209 {2210 // use mailing to avoid duplicates2211 numRays += CollectViewCellsFromRays(*oit, viewCells, useMailBoxing, setCounter, onlyUnmailedRays);2212 }2213 }2214 2215 return numRays;2216 }2217 2218 2219 int BvHierarchy::CountViewCells(const ObjectContainer &objects)// const2220 {2221 int nViewCells = 0;2222 2223 ViewCell::NewMail();2224 2225 if (mCachedObjects)2226 {2227 ObjectContainer::const_iterator oit, oit_end = mCachedObjects->end();2228 2229 // loop through all object and collect view cell pvs of this node2230 for (oit = mCachedObjects->begin(); oit != oit_end; ++ oit)2231 {2232 // use mailing to avoid duplicates2233 nViewCells += CountViewCells(*oit);2234 }2235 }2236 else2237 {2238 ObjectContainer::const_iterator oit, oit_end = objects.end();2239 2240 // loop through all object and collect view cell pvs of this node2241 for (oit = objects.begin(); oit != oit_end; ++ oit)2242 {2243 nViewCells += CountViewCellsFromRays(*oit);2244 }2245 }2246 2247 return nViewCells;2248 }2249 2250 2251 2235 #else 2252 2253 int BvHierarchy::CollectViewCells(const ObjectContainer &objects,2254 ViewCellContainer &viewCells,2255 const bool setCounter,2256 const bool onlyUnmailedRays)// const2257 {2258 ViewCell::NewMail();2259 2260 ObjectContainer::const_iterator oit, oit_end = objects.end();2261 2262 // use mailing to avoid dublicates2263 const bool useMailBoxing = true;2264 2265 int numRays = 0;2266 // loop through all object and collect view cell pvs of this node2267 for (oit = objects.begin(); oit != oit_end; ++ oit)2268 {2269 // use mailing to avoid duplicates2270 numRays += CollectViewCells(*oit, viewCells, useMailBoxing, setCounter, onlyUnmailedRays);2271 }2272 2273 return numRays;2274 }2275 2276 2277 int BvHierarchy::CountViewCells(const ObjectContainer &objects)// const2278 {2279 int nViewCells = 0;2280 2281 ViewCell::NewMail();2282 ObjectContainer::const_iterator oit, oit_end = objects.end();2283 2284 // loop through all object and collect view cell pvs of this node2285 for (oit = objects.begin(); oit != oit_end; ++ oit)2286 {2287 nViewCells += CountViewCells(*oit);2288 }2289 2290 return nViewCells;2291 }2292 2293 2236 2294 2237 int BvHierarchy::CountViewCells(Intersectable *obj) //const … … 2377 2320 2378 2321 2322 int BvHierarchy::CountViewCells(const ObjectContainer &objects)// const 2323 { 2324 int nViewCells = 0; 2325 2326 ViewCell::NewMail(); 2327 ObjectContainer::const_iterator oit, oit_end = objects.end(); 2328 2329 // loop through all object and collect view cell pvs of this node 2330 for (oit = objects.begin(); oit != oit_end; ++ oit) 2331 { 2332 nViewCells += CountViewCells(*oit); 2333 } 2334 2335 return nViewCells; 2336 } 2337 2379 2338 2380 2339 void BvHierarchy::CollectDirtyCandidates(BvhSubdivisionCandidate *sc, … … 2387 2346 ViewCellContainer viewCells; 2388 2347 //ViewCell::NewMail(); 2389 int numRays = CollectViewCells( node->mObjects, viewCells, false, false);2348 int numRays = CollectViewCells(*tData.mSampledObjects, viewCells, false, false); 2390 2349 2391 2350 if (0) cout << "collected " << (int)viewCells.size() << " dirty candidates" << endl; … … 2435 2394 } 2436 2395 2437 2396 #if 0 2438 2397 BvhLeaf *BvHierarchy::GetLeaf(Intersectable *object, BvhNode *node) const 2439 2398 { 2440 // rather use the simpleversion2399 // hack: we use the simpler but faster version 2441 2400 if (!object) 2442 2401 return NULL; 2402 2443 2403 return object->mBvhLeaf; 2444 2404 2445 2405 /////////////////////////////////////// 2446 2406 // start from root of tree 2447 2407 /* 2448 2408 if (node == NULL) 2449 2409 node = mRoot; … … 2489 2449 2490 2450 return leaf; 2491 } 2492 2451 */ 2452 } 2453 #endif 2493 2454 2494 2455 bool BvHierarchy::Export(OUT_STREAM &stream) … … 2586 2547 2587 2548 2588 /* 2589 Mesh *BvHierarchy::MergeLeafToMesh() 2590 { 2591 vector<BvhLeaf *> leaves; 2592 CollectLeaves(leaves); 2593 2594 vector<BvhLeaf *>::const_iterator lit, lit_end = leaves.end(); 2595 2596 for (lit = leaves.begin(); lit != lit_end; ++ lit) 2597 { 2598 Mesh *mesh = MergeLeafToMesh(*lit); 2599 } 2600 }*/ 2549 void BvHierarchy::StoreSampledObjects(ObjectContainer &sampledObjects, const ObjectContainer &objects) 2550 { 2551 ObjectContainer::const_iterator oit, oit_end = objects.end(); 2552 2553 for (oit = objects.begin(); oit != objects.end(); ++ oit) 2554 { 2555 Intersectable *obj = *oit; 2556 2557 if (!obj->GetOrCreateRays()->empty()) 2558 { 2559 sampledObjects.push_back(obj); 2560 } 2561 } 2562 } 2601 2563 2602 2564 … … 2624 2586 //cout << "using " << nRays << " of " << (int)sampleRays.size() << " rays" << endl; 2625 2587 2588 ObjectContainer *sampledObjects = new ObjectContainer(); 2589 StoreSampledObjects(*sampledObjects, objects); 2590 2626 2591 #if STORE_VIEWCELLS_WITH_BVH 2627 AssociateViewCellsWithObjects( objects);2592 AssociateViewCellsWithObjects(*sampledObjects); 2628 2593 #endif 2629 2594 2630 2595 // probability that volume is "seen" from the view cells 2631 const float prop = EvalViewCellsVolume( objects) / GetViewSpaceVolume();2596 const float prop = EvalViewCellsVolume(*sampledObjects) / GetViewSpaceVolume(); 2632 2597 2633 2598 // create bvh traversal data … … 2640 2605 } 2641 2606 2607 oData.mSampledObjects = sampledObjects; 2608 2642 2609 /////////////////// 2643 2610 //-- add first candidate for object space partition 2644 2611 2645 2612 mTotalCost = EvalRenderCost(objects); 2646 mPvsEntries = CountViewCells( objects);2613 mPvsEntries = CountViewCells(*sampledObjects); 2647 2614 2648 2615 oData.mCorrectedPvs = oData.mPvs = (float)mPvsEntries; … … 2655 2622 2656 2623 #if STORE_VIEWCELLS_WITH_BVH 2657 ReleaseViewCells( objects);2624 ReleaseViewCells(*sampledObjects); 2658 2625 #endif 2659 2626 … … 2727 2694 } 2728 2695 2729 // last sorted list: by size2696 // next sorted list: by size (for initial criteria) 2730 2697 tData.mSortedObjects[3] = new ObjectContainer(); 2731 2698 tData.mSortedObjects[3]->reserve((int)objects.size()); … … 2734 2701 2735 2702 stable_sort(tData.mSortedObjects[3]->begin(), tData.mSortedObjects[3]->end(), smallerSize); 2736 //sort(tData.mSortedObjects[3]->begin(), tData.mSortedObjects[3]->end(), smallerSize);2737 2703 } 2738 2704 … … 2796 2762 mRoot = bvhleaf; 2797 2763 2764 ObjectContainer *sampledObjects = new ObjectContainer(); 2765 StoreSampledObjects(*sampledObjects, objects); 2766 2798 2767 #if STORE_VIEWCELLS_WITH_BVH 2799 AssociateViewCellsWithObjects( objects);2768 AssociateViewCellsWithObjects(*sampledObjects); 2800 2769 #endif 2801 2770 … … 2803 2772 // probability that volume is "seen" from the view cells 2804 2773 const float viewSpaceVol = mViewCellsManager->GetViewSpaceBox().GetVolume(); 2805 const float prop = EvalViewCellsVolume( objects);2806 2807 const int nRays = CountRays( objects);2774 const float prop = EvalViewCellsVolume(*sampledObjects); 2775 2776 const int nRays = CountRays(*sampledObjects); 2808 2777 BvhLeaf *bvhLeaf = static_cast<BvhLeaf *>(mRoot); 2809 2778 … … 2811 2780 BvhTraversalData oData(bvhLeaf, 0, prop, nRays); 2812 2781 2782 oData.mSampledObjects = sampledObjects; 2783 2813 2784 if (mUseGlobalSorting) 2814 2785 AssignInitialSortedObjectList(oData, objects); 2815 2786 2816 2787 #if STORE_VIEWCELLS_WITH_BVH 2817 ReleaseViewCells( objects);2788 ReleaseViewCells(*sampledObjects); 2818 2789 #endif 2819 2790 ///////////////////
Note: See TracChangeset
for help on using the changeset viewer.