Changeset 1707 for GTP/trunk/Lib/Vis
- Timestamp:
- 11/01/06 23:20:53 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/todo_i3d
r1685 r1707 1 1) implement the computed value for ratio drc /dmem2 2) try soda scene using more samples to avoid samples3 1 3) test object space subdivision as postprocess 4 2 do view space subdivison on objects … … 9 7 visibility based heuristics + sah for undersampling 10 8 9 check sah if implemented right!! (bounding volume!!) 10 11 11 4) implement full evaluation framework 12 12 13 13 5) rerun vienna tests 14 15 6) check if memory was computed right!! 16 17 7) include tree sizes in memory computation + plots 18 19 8) include cost of bvh in drc / rmem heuristics 20 21 9) check undersampling in visualization -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1705 r1707 1506 1506 1507 1507 1508 void BvHierarchy::CollectLeaves( vector<BvhLeaf *> &leaves) const1508 void BvHierarchy::CollectLeaves(BvhNode *root, vector<BvhLeaf *> &leaves) const 1509 1509 { 1510 1510 stack<BvhNode *> nodeStack; 1511 nodeStack.push( mRoot);1511 nodeStack.push(root); 1512 1512 1513 1513 while (!nodeStack.empty()) … … 1763 1763 1764 1764 1765 BvhIntersectable *BvHierarchy::GetOrCreateBvhIntersectable(Bvh Node*node)1765 BvhIntersectable *BvHierarchy::GetOrCreateBvhIntersectable(BvhLeaf *node) 1766 1766 { 1767 1767 // search nodes 1768 std::map<Bvh Node*, BvhIntersectable *>::const_iterator1768 std::map<BvhLeaf *, BvhIntersectable *>::const_iterator 1769 1769 it = mBvhIntersectables.find(node); 1770 1770 … … 2151 2151 2152 2152 2153 void BvHierarchy::SetActive(BvhNode *node) const 2154 { 2155 vector<BvhLeaf *> leaves; 2156 2157 // sets the pointers to the currently active view cells 2158 CollectLeaves(node, leaves); 2159 2160 vector<BvhLeaf *>::const_iterator bit, bit_end = leaves.end(); 2161 2162 for (bit = leaves.begin(); bit != bit_end; ++ bit) 2163 { 2164 (*bit)->SetActiveNode(node); 2165 } 2166 } 2167 2168 2153 2169 BvhNode *BvHierarchy::SubdivideAndCopy(SplitQueue &tQueue, 2154 2170 SubdivisionCandidate *splitCandidate) -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1706 r1707 310 310 virtual void CollectObjects(ObjectContainer &objects); 311 311 312 /** returns level of the hierarchy that is "active" right now.312 /** Returns level of the hierarchy that is "active" right now. 313 313 */ 314 314 BvhNode *GetActiveNode() 315 315 { 316 316 return mActiveNode; 317 } 318 319 /** Returns level of the hierarchy that is "active" right now. 320 */ 321 void SetActiveNode(BvhNode *node) 322 { 323 mActiveNode = node; 317 324 } 318 325 … … 331 338 SubdivisionCandidate *mSubdivisionCandidate; 332 339 333 340 /// the active node which will be accounted for in the pvs 334 341 BvhNode *mActiveNode; 335 342 }; 336 343 337 344 338 typedef map<Bvh Node*, BvhIntersectable *> BvhIntersectableMap;345 typedef map<BvhLeaf *, BvhIntersectable *> BvhIntersectableMap; 339 346 340 347 … … 516 523 bool computeSplitPlane = true); 517 524 518 /** Returns list of leaves with pvs smaller than 519 a certain threshold. 520 @param onlyUnmailed if only the unmailed leaves should be considered 521 @param maxPvs the maximal pvs of a leaf to be added (-1 means unlimited) 522 */ 523 void CollectLeaves(vector<BvhLeaf *> &leaves) const; 525 /** Returns vector of leaves. 526 */ 527 void CollectLeaves(BvhNode *root, vector<BvhLeaf *> &leaves) const; 524 528 525 529 /** Returns bounding box of the whole tree (= bbox of root node) … … 564 568 bool Export(OUT_STREAM &stream); 565 569 566 /** Returns or creates a new intersectable for use in a kdbased pvs.567 The OspTreeis responsible for destruction of the intersectable.568 */ 569 BvhIntersectable *GetOrCreateBvhIntersectable(Bvh Node*node);570 /** Returns or creates a new intersectable for use in a bv based pvs. 571 The hierarchy is responsible for destruction of the intersectable. 572 */ 573 BvhIntersectable *GetOrCreateBvhIntersectable(BvhLeaf *node); 570 574 571 575 /** Collects rays associated with the objects. … … 586 590 */ 587 591 ViewCellsTree *GetViewCellsTree() const { return mViewCellsTree; } 592 588 593 /** See Get 589 594 */ … … 593 598 */ 594 599 float GetMemUsage() const; 600 601 /** Sets this node to be an active node. 602 */ 603 void SetActive(BvhNode *node) const; 595 604 596 605 … … 603 612 604 613 static float EvalAbsCost(const ObjectContainer &objects); 614 605 615 606 616 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
r1701 r1707 110 110 { 111 111 vector<BvhLeaf *> leaves; 112 bvHierarchy.CollectLeaves( leaves);112 bvHierarchy.CollectLeaves(bvHierarchy.GetRoot(), leaves); 113 113 114 114 mUseForcedMaterial = true; -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1706 r1707 21 21 #include "OspTree.h" 22 22 #include "BvHierarchy.h" 23 #include "ViewCell.h" 23 24 24 25 … … 1683 1684 // reinstall old bv refs 1684 1685 vector<BvhLeaf *> leaves; 1685 mBvHierarchy->CollectLeaves( leaves);1686 mBvHierarchy->CollectLeaves(mBvHierarchy->GetRoot(), leaves); 1686 1687 vector<BvhLeaf *>::const_iterator bit, bit_end = leaves.end(); 1687 1688 … … 1788 1789 { 1789 1790 public: 1790 enum {VSP_NODE, BVH_NODE };1791 enum {VSP_NODE, BVH_NODE, VIEW_CELL}; 1791 1792 1792 1793 virtual float GetMergeCost() const = 0; … … 1850 1851 1851 1852 1853 class ViewCellWrapper: public HierarchyNodeWrapper 1854 { 1855 public: 1856 1857 ViewCellWrapper(ViewCell *vc): mViewCell(vc) {} 1858 1859 int Type() const { return VIEW_CELL; } 1860 1861 float GetMergeCost() const { return mViewCell->GetMergeCost(); }; 1862 1863 bool IsLeaf() const { return mViewCell->IsLeaf(); } 1864 1865 void PushChildren(HierarchyNodeQueue &tQueue) 1866 { 1867 if (!mViewCell->IsLeaf()) 1868 { 1869 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(mViewCell); 1870 1871 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1872 1873 for (it = interior->mChildren.begin(); it != it_end; ++ it) 1874 { 1875 tQueue.push(new ViewCellWrapper(*it)); 1876 } 1877 } 1878 } 1879 1880 ViewCell *mViewCell; 1881 }; 1882 1883 1852 1884 void HierarchyManager::CollectBestSet(const int maxSplits, 1853 1885 const float maxMemoryCost, 1854 vector<VspNode *> &vspNodes, 1886 // vector<VspNode *> &vspNodes, 1887 ViewCellContainer &viewCells, 1855 1888 vector<BvhNode *> &bvhNodes) 1856 1889 { 1857 1890 HierarchyNodeQueue tqueue; 1858 tqueue.push(new VspNodeWrapper(mVspTree->GetRoot())); 1891 //tqueue.push(new VspNodeWrapper(mVspTree->GetRoot())); 1892 tqueue.push(new ViewCellWrapper(mVspTree->mViewCellsTree->GetRoot())); 1859 1893 tqueue.push(new BvhNodeWrapper(mBvHierarchy->GetRoot())); 1860 1894 … … 1869 1903 // because of the priority queue, this will be the optimal set of v 1870 1904 if (nodeWrapper->IsLeaf() || 1871 ((v spNodes.size() + bvhNodes.size() + tqueue.size() + 1) >= maxSplits) ||1905 ((viewCells.size() + bvhNodes.size() + tqueue.size() + 1) >= maxSplits) || 1872 1906 (memCost > maxMemoryCost) 1873 1907 ) … … 1875 1909 if (nodeWrapper->Type() == HierarchyNodeWrapper::VSP_NODE) 1876 1910 { 1877 V spNodeWrapper *vspNodeWrapper = dynamic_cast<VspNodeWrapper *>(nodeWrapper);1878 v spNodes.push_back(vspNodeWrapper->mNode);1911 ViewCellWrapper *viewCellWrapper = dynamic_cast<ViewCellWrapper *>(nodeWrapper); 1912 viewCells.push_back(viewCellWrapper->mViewCell); 1879 1913 } 1880 1914 else … … 1900 1934 int &pvsEntries) 1901 1935 { 1936 //vector<VspNode *> vspNodes; 1937 ViewCellContainer viewCells; 1938 vector<BvhNode *> bvhNodes; 1939 1940 CollectBestSet(maxSplits, maxMemoryCost, viewCells, bvhNodes); 1941 1942 vector<BvhNode *>::const_iterator bit, bit_end = bvhNodes.end(); 1943 1944 for (bit = bvhNodes.begin(); bit != bit_end; ++ bit) 1945 { 1946 mBvHierarchy->SetActive(*bit); 1947 } 1948 1949 //vector<VspNode *>::const_iterator vit, vit_end = vspNodes.end(); 1950 1951 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 1952 1953 int numEntries = 0; 1954 float pvsCost = 0.0f; 1955 1956 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 1957 { 1958 ViewCell *vc = *vit; 1959 ObjectPvs pvs; 1960 mVspTree->mViewCellsTree->GetPvs(vc, pvs); 1961 1962 BvhNode::NewMail(); 1963 1964 // hack: should not be done here 1965 ObjectPvsMap::const_iterator oit, oit_end = pvs.mEntries.end(); 1966 1967 for (oit = pvs.mEntries.begin(); oit != oit_end; ++ oit) 1968 { 1969 BvhIntersectable *intersect = dynamic_cast<BvhIntersectable *>((*oit).first); 1970 BvhLeaf *leaf = intersect->GetItem(); 1971 BvhNode *activeNode = leaf->GetActiveNode(); 1972 1973 if (!activeNode->Mailed()) 1974 { 1975 activeNode->Mail(); 1976 1977 ++ numEntries; 1978 pvsCost += mBvHierarchy->EvalAbsCost(leaf->mObjects); 1979 } 1980 } 1981 } 1982 1902 1983 /*TraversalQueue tqueue; 1903 1984 tqueue.push(mRoot); -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1706 r1707 452 452 void CollectBestSet(const int maxSplits, 453 453 const float maxMemoryCost, 454 vector<VspNode *> &vspNodes, 454 //vector<VspNode *> &vspNodes, 455 ViewCellContainer &viewCells, 455 456 vector<BvhNode *> &bvhNodes); 456 457 -
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h
r1694 r1707 12 12 struct VssRayContainer; 13 13 class KdNode; 14 class BvhNode; 14 //class BvhNode; 15 class BvhLeaf; 16 class Ray; 17 15 18 struct Face; 16 class Ray;17 19 struct Triangle3; 18 class KdTree; 20 21 class KdTree; 19 22 20 23 … … 166 169 typedef map<KdNode *, KdIntersectable *> KdIntersectableMap; 167 170 168 class BvhIntersectable: public IntersectableWrapper<Bvh Node*>169 { 170 public: 171 BvhIntersectable(Bvh Node*item):172 IntersectableWrapper<Bvh Node*>(item) {}171 class BvhIntersectable: public IntersectableWrapper<BvhLeaf *> 172 { 173 public: 174 BvhIntersectable(BvhLeaf *item): 175 IntersectableWrapper<BvhLeaf *>(item) {} 173 176 174 177 int Type() const -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.cpp
r1703 r1707 79 79 We eliminate already accounted bvh nodes and objects using mailboxing. 80 80 */ 81 static int EvalBvhNodeContribution(BvhIntersectable *bvhobj)81 static float EvalBvhNodeContribution(BvhIntersectable *bvhobj) 82 82 { 83 BvhNode *node= bvhobj->GetItem(); 83 BvhLeaf *leaf = bvhobj->GetItem(); 84 BvhNode *node = leaf->GetActiveNode(); 84 85 85 86 // early exit 86 if (node ->IsLeaf())87 if (node == leaf) 87 88 { 88 89 // objects already accounted for 89 if ( node->Mailed())90 if (leaf->Mailed()) 90 91 return 0; 91 92 92 node->Mail(); 93 BvhLeaf *leaf = dynamic_cast<BvhLeaf *>(node); 94 return (int)leaf->mObjects.size(); 93 leaf->Mail(); 94 return BvHierarchy::EvalAbsCost(leaf->mObjects); 95 95 } 96 96 97 97 // compute leaf pvs 98 int pvs = 0;98 float pvs = 0; 99 99 stack<BvhNode *> tStack; 100 tStack.push( bvhobj->GetItem());100 tStack.push(node); 101 101 102 102 while (!tStack.empty()) 103 103 { 104 BvhNode *node = tStack.top();104 node = tStack.top(); 105 105 tStack.pop(); 106 106 … … 112 112 if (node->IsLeaf()) 113 113 { 114 BvhLeaf *leaf = dynamic_cast<BvhLeaf *>(node);114 leaf = dynamic_cast<BvhLeaf *>(node); 115 115 116 116 // add #objects exclusivly in this node … … 132 132 133 133 134 int ObjectPvs::CountObjectsInPvs() const134 float ObjectPvs::EvalPvsCost() const 135 135 { 136 int pvs = 0;136 float pvs = 0; 137 137 138 138 Intersectable::NewMail(); -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r1706 r1707 529 529 but the individual contributions of the entries are summed up. 530 530 */ 531 int CountObjectsInPvs() const;531 float EvalPvsCost() const; 532 532 }; 533 533 -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r1501 r1707 206 206 Name="VCLinkerTool" 207 207 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib" 208 OutputFile="../bin/release/Preprocessor .exe"208 OutputFile="../bin/release/Preprocessor2.exe" 209 209 LinkIncremental="1" 210 210 AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;"$(QTDIR)\lib";.\QtGlRenderer\Release" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1706 r1707 503 503 tstack.push(*it); 504 504 } 505 506 505 } 507 506 } … … 930 929 const int upper = mViewCellsManager->GetMaxPvsSize(); 931 930 932 const float penalty = EvalPvsPenalty((*vit)->GetPvs(). CountObjectsInPvs(), lower, upper);931 const float penalty = EvalPvsPenalty((*vit)->GetPvs().EvalPvsCost(), lower, upper); 933 932 934 933 mDeviation += fabs(mAvgRenderCost - penalty); … … 1023 1022 vc->Mail(); 1024 1023 1025 const int pvs1 = left->GetPvs().CountObjectsInPvs();1026 const int pvs2 = right->GetPvs().CountObjectsInPvs();1024 const float pvs1 = left->GetPvs().EvalPvsCost(); 1025 const float pvs2 = right->GetPvs().EvalPvsCost(); 1027 1026 1028 1027 … … 1030 1029 mMergedViewCells.push_back(vc); 1031 1030 1032 pvsDiff = vc->GetPvs(). CountObjectsInPvs() - pvs1 - pvs2;1031 pvsDiff = vc->GetPvs().EvalPvsCost() - pvs1 - pvs2; 1033 1032 1034 1033 … … 1038 1037 // set scalars 1039 1038 mViewCellsManager->UpdateScalarPvsSize(left, 1040 left->GetPvs(). CountObjectsInPvs(),1039 left->GetPvs().EvalPvsCost(), 1041 1040 left->GetPvs().GetSize()); 1042 1041 … … 1049 1048 // set scalars 1050 1049 mViewCellsManager->UpdateScalarPvsSize(right, 1051 right->GetPvs(). CountObjectsInPvs(),1050 right->GetPvs().EvalPvsCost(), 1052 1051 right->GetPvs().GetSize()); 1053 1052 … … 1336 1335 if (1) 1337 1336 { 1338 const float penalty = EvalPvsPenalty(vc->GetPvs(). CountObjectsInPvs(), lower, upper);1337 const float penalty = EvalPvsPenalty(vc->GetPvs().EvalPvsCost(), lower, upper); 1339 1338 return fabs(mAvgRenderCost - penalty) / (float)mNumActiveViewCells; 1340 1339 } … … 1349 1348 if (mUseAreaForPvs) 1350 1349 { 1351 return vc->GetPvs(). CountObjectsInPvs() * vc->GetArea();1352 } 1353 1354 return vc->GetPvs(). CountObjectsInPvs() * vc->GetVolume();1350 return vc->GetPvs().EvalPvsCost() * vc->GetArea(); 1351 } 1352 1353 return vc->GetPvs().EvalPvsCost() * vc->GetVolume(); 1355 1354 } 1356 1355 … … 1795 1794 if (vc->IsLeaf()) 1796 1795 { 1797 return vc->GetPvs(). CountObjectsInPvs();1798 } 1799 1800 // interior nodes: pvs is either stored as a scalar or1801 // has to be reconstructed from the leaves1796 return vc->GetPvs().EvalPvsCost(); 1797 } 1798 1799 // interior nodes: pvs is either stored as a 1800 // scalar or has to be reconstructed from the leaves 1802 1801 // the stored pvs size is the valid pvs size => just return scalar 1803 1802 if (vc->mPvsSizeValid) … … 1833 1832 } 1834 1833 1835 return newPvs. CountObjectsInPvs();1834 return newPvs.EvalPvsCost(); 1836 1835 } 1837 1836 … … 2002 2001 switch (mViewCellsStorage) 2003 2002 { 2004 case PVS_IN_LEAVES: //-- store pvs only in leaves 2003 case PVS_IN_LEAVES: 2004 // pvs is stored only in leaves 2005 2005 pvsSize = GetPvsSizeForLeafStorage(vc); 2006 2006 break; … … 2012 2012 // pvs is stored consistently in the tree up to the root 2013 2013 // just return pvs size 2014 pvsSize = vc->GetPvs(). CountObjectsInPvs();2014 pvsSize = vc->GetPvs().EvalPvsCost(); 2015 2015 break; 2016 2016 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
r1679 r1707 183 183 return a->mPvsSize < b->mPvsSize; 184 184 #else 185 return a->GetPvs(). CountObjectsInPvs() < b->GetPvs().CountObjectsInPvs();185 return a->GetPvs().EvalPvsCost() < b->GetPvs().EvalPvsCost(); 186 186 #endif 187 187 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r1686 r1707 2025 2025 << "#polygons: " << (int)data.mPolygons->size() << " (max: " << mTermMinPolys << "), " 2026 2026 << "#rays: " << (int)data.mRays->size() << " (max: " << mTermMinRays << "), " 2027 << "#pvs: " << leaf->GetViewCell()->GetPvs(). CountObjectsInPvs() << "=, "2027 << "#pvs: " << leaf->GetViewCell()->GetPvs().EvalPvsCost() << "=, " 2028 2028 << "#avg ray contrib (pvs): " << (float)data.mPvs / (float)data.mRays->size() << endl; 2029 2029 #endif -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1705 r1707 1077 1077 1078 1078 /// Returns index of the best view cells of the neighborhood 1079 int GetBestViewCellIdx(ViewCell *root, const ViewCellContainer &neighborhood)1079 static int GetBestViewCellIdx(ViewCell *root, const ViewCellContainer &neighborhood) 1080 1080 { 1081 1081 int bestViewCellIdx = 0; … … 1237 1237 { 1238 1238 1239 if ((vc->GetPvs(). CountObjectsInPvs() > maxPvsSize) ||1240 (vc->GetPvs(). CountObjectsInPvs() < minPvsSize))1239 if ((vc->GetPvs().EvalPvsCost() > maxPvsSize) || 1240 (vc->GetPvs().EvalPvsCost() < minPvsSize)) 1241 1241 { 1242 1242 return false; … … 1510 1510 { 1511 1511 ViewCell *vc = *it; 1512 totalRenderCost += vc->GetPvs(). CountObjectsInPvs() * vc->GetVolume();1513 totalPvs += (int)vc->GetPvs(). CountObjectsInPvs();1512 totalRenderCost += vc->GetPvs().EvalPvsCost() * vc->GetVolume(); 1513 totalPvs += (int)vc->GetPvs().EvalPvsCost(); 1514 1514 } 1515 1515 … … 1530 1530 ViewCell *vc = *it; 1531 1531 1532 float renderCost = vc->GetPvs(). CountObjectsInPvs() * vc->GetVolume();1532 float renderCost = vc->GetPvs().EvalPvsCost() * vc->GetVolume(); 1533 1533 float dev; 1534 1534 1535 1535 if (1) 1536 dev = fabs(avgRenderCost - (float)vc->GetPvs(). CountObjectsInPvs());1536 dev = fabs(avgRenderCost - (float)vc->GetPvs().EvalPvsCost()); 1537 1537 else 1538 1538 dev = fabs(expectedRenderCost - renderCost); … … 1643 1643 1644 1644 // update pvs size 1645 UpdateScalarPvsSize(vc, vc->GetPvs(). CountObjectsInPvs(), vc->GetPvs().GetSize());1645 UpdateScalarPvsSize(vc, vc->GetPvs().EvalPvsCost(), vc->GetPvs().GetSize()); 1646 1646 1647 1647 return vc; … … 2155 2155 2156 2156 2157 void ViewCellsManager::SetViewCellActive(ViewCell *vc) const 2158 { 2159 ViewCellContainer leaves; 2160 // sets the pointers to the currently active view cells 2161 mViewCellsTree->CollectLeaves(vc, leaves); 2162 2163 ViewCellContainer::const_iterator lit, lit_end = leaves.end(); 2164 for (lit = leaves.begin(); lit != lit_end; ++ lit) 2165 { 2166 dynamic_cast<ViewCellLeaf *>(*lit)->SetActiveViewCell(vc); 2167 } 2168 } 2169 2170 2157 2171 void ViewCellsManager::SetViewCellsActive() 2158 2172 { 2159 // collect leaf view cells and set the pointers to the currently2160 // active view cells2173 // collect leaf view cells and set the pointers to 2174 // the currently active view cells 2161 2175 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 2162 2176 2163 2177 for (it = mViewCells.begin(); it != it_end; ++ it) 2164 2178 { 2165 ViewCellContainer leaves; 2166 mViewCellsTree->CollectLeaves(*it, leaves); 2167 2168 ViewCellContainer::const_iterator lit, lit_end = leaves.end(); 2169 for (lit = mViewCells.begin(); lit != lit_end; ++ lit) 2170 { 2171 dynamic_cast<ViewCellLeaf *>(*lit)->SetActiveViewCell(*it); 2172 } 2179 SetViewCellActive(*it); 2173 2180 } 2174 2181 } … … 2570 2577 // we assume that pvs is explicitly stored in leaves 2571 2578 pvs = root->GetPvs(); 2572 UpdateScalarPvsSize(root, pvs. CountObjectsInPvs(), pvs.GetSize());2579 UpdateScalarPvsSize(root, pvs.EvalPvsCost(), pvs.GetSize()); 2573 2580 2574 2581 return; … … 2637 2644 2638 2645 // set new pvs size 2639 UpdateScalarPvsSize(interior, pvs. CountObjectsInPvs(), pvs.GetSize());2646 UpdateScalarPvsSize(interior, pvs.EvalPvsCost(), pvs.GetSize()); 2640 2647 2641 2648 #else … … 5720 5727 { 5721 5728 ViewCell *vc = *vit; 5722 int pvs = vc->GetPvs(). CountObjectsInPvs();5729 int pvs = vc->GetPvs().EvalPvsCost(); 5723 5730 float vol = vc->GetVolume(); 5724 5731 rc += pvs * vol; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1703 r1707 573 573 void ResetViewCells(); 574 574 575 /** Sets this view cell to active. 576 */ 577 void SetViewCellActive(ViewCell *vc) const; 578 575 579 /** Collects the view cells in the view cell container. 576 580 */ -
GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
r1571 r1707 222 222 223 223 mForcedMaterial.mDiffuseColor.b = 1.0f; 224 const float importance = (float)leaf->GetViewCell()->GetPvs(). CountObjectsInPvs() / (float)maxPvs;224 const float importance = (float)leaf->GetViewCell()->GetPvs().EvalPvsCost() / (float)maxPvs; 225 225 226 226 mForcedMaterial.mDiffuseColor.r = importance; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r1632 r1707 829 829 // update scalar pvs size lookup 830 830 ObjectPvs &pvs = viewCell->GetPvs(); 831 mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs. CountObjectsInPvs(), pvs.GetSize());831 mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs.EvalPvsCost(), pvs.GetSize()); 832 832 833 833 … … 974 974 ObjectPvs &pvs = viewCell->GetPvs(); 975 975 mViewCellsManager->UpdateScalarPvsSize(viewCell, 976 pvs. CountObjectsInPvs(),976 pvs.EvalPvsCost(), 977 977 pvs.GetSize()); 978 978 … … 2391 2391 if (leaf->TreeValid() && 2392 2392 (!onlyUnmailed || !leaf->Mailed()) && 2393 ((maxPvsSize < 0) || (leaf->GetViewCell()->GetPvs(). CountObjectsInPvs() <= maxPvsSize)))2393 ((maxPvsSize < 0) || (leaf->GetViewCell()->GetPvs().EvalPvsCost() <= maxPvsSize))) 2394 2394 { 2395 2395 leaves.push_back(leaf); … … 2468 2468 << "PVS: " << data.mPvs << " (min: " << mTermMinPvs << "), " 2469 2469 << "#rays: " << (int)data.mRays->size() << " (max: " << mTermMinRays << "), " 2470 << "#pvs: " << leaf->GetViewCell()->GetPvs(). CountObjectsInPvs() << "), "2470 << "#pvs: " << leaf->GetViewCell()->GetPvs().EvalPvsCost() << "), " 2471 2471 << "#avg ray contrib (pvs): " << (float)data.mPvs / (float)data.mRays->size() << endl; 2472 2472 #endif -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1698 r1707 654 654 // update scalar pvs size value 655 655 ObjectPvs &pvs = viewCell->GetPvs(); 656 mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs. CountObjectsInPvs(), pvs.GetSize());656 mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs.EvalPvsCost(), pvs.GetSize()); 657 657 658 658 mVspStats.contributingSamples += conSamp; … … 768 768 // update scalar pvs size value 769 769 ObjectPvs &pvs = viewCell->GetPvs(); 770 mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs. CountObjectsInPvs(), pvs.GetSize());770 mViewCellsManager->UpdateScalarPvsSize(viewCell, pvs.EvalPvsCost(), pvs.GetSize()); 771 771 772 772 mVspStats.contributingSamples += conSamp; … … 1803 1803 if (leaf->TreeValid() && 1804 1804 (!onlyUnmailed || !leaf->Mailed()) && 1805 ((maxPvsSize < 0) || (leaf->GetViewCell()->GetPvs(). CountObjectsInPvs() <= maxPvsSize)))1805 ((maxPvsSize < 0) || (leaf->GetViewCell()->GetPvs().EvalPvsCost() <= maxPvsSize))) 1806 1806 { 1807 1807 leaves.push_back(leaf); … … 1880 1880 << "PVS: " << data.mPvs << " (min: " << mTermMinPvs << "), " 1881 1881 << "#rays: " << (int)data.mRays->size() << " (max: " << mTermMinRays << "), " 1882 << "#pvs: " << leaf->GetViewCell()->GetPvs(). CountObjectsInPvs() << "), "1882 << "#pvs: " << leaf->GetViewCell()->GetPvs().EvalPvsCost() << "), " 1883 1883 << "#avg ray contrib (pvs): " << (float)data.mPvs / (float)data.mRays->size() << endl; 1884 1884 #endif -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
r1545 r1707 247 247 mForcedMaterial.mDiffuseColor.b = 1.0f; 248 248 const float importance = 249 (float)leaf->GetViewCell()->GetPvs(). CountObjectsInPvs() / (float)maxPvs;249 (float)leaf->GetViewCell()->GetPvs().EvalPvsCost() / (float)maxPvs; 250 250 251 251 mForcedMaterial.mDiffuseColor.r = importance;
Note: See TracChangeset
for help on using the changeset viewer.