Changeset 1686 for GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
- Timestamp:
- 10/27/06 03:05:49 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1684 r1686 131 131 } 132 132 133 133 134 void BvhLeaf::CollectObjects(ObjectContainer &objects) 134 135 { 135 ObjectContainer::const_iterator oit, oit_end = objects.end();136 for (oit = objects.begin(); oit != oit_end; ++ oit)136 ObjectContainer::const_iterator oit, oit_end = mObjects.end(); 137 for (oit = mObjects.begin(); oit != oit_end; ++ oit) 137 138 { 138 139 objects.push_back(*oit); … … 330 331 return nRays; 331 332 } 332 333 334 void BvHierarchy::UpdateNode(const BvhSubdivisionCandidate &sc)335 {336 BvhInterior *node = NULL;//sc->mParentData.mNode;337 //AssociateObjectsWithLeaf(node->GetBack());338 //AssociateObjectsWithLeaf(node->GetFront());339 340 node->mRenderCostDecr = sc.GetRenderCostDecrease();341 node->mPvsEntriesIncr = sc.GetPvsEntriesIncr();342 }343 333 344 334 … … 906 896 else 907 897 { 908 // just add up areas of the object bbs898 // just add up areas of the objects itself 909 899 // (as we are not sampling volumetric visibility, 910 900 // this should provide better heuristics 911 const float area = obox.SurfaceArea();901 const float area = //obox.SurfaceArea(); 912 902 913 903 al += area; … … 1905 1895 //-- add first candidate for object space partition 1906 1896 1907 BvhSubdivisionCandidate *oSubdivisionCandidate = 1908 new BvhSubdivisionCandidate(oData); 1909 1897 BvhSubdivisionCandidate *oSubdivisionCandidate = new BvhSubdivisionCandidate(oData); 1898 1899 // evaluate priority 1910 1900 EvalSubdivisionCandidate(*oSubdivisionCandidate); 1911 1901 bvhLeaf->SetSubdivisionCandidate(oSubdivisionCandidate); … … 2115 2105 float BvHierarchy::GetMemUsage() const 2116 2106 { 2117 return (float) 2118 (sizeof(BvHierarchy) 2119 + mBvhStats.Leaves() * sizeof(BvhLeaf) 2120 + mBvhStats.Interior() * sizeof(BvhInterior) 2121 ) / (1024.0f * 1024.0f); 2122 } 2123 2124 2125 SubdivisionCandidate *BvHierarchy::CreateSubdivisionCandidate(BvhInterior *oldNode) 2126 { 2127 return new BvhSubdivisionCandidate(BvhTraversalData()); 2128 } 2129 2130 2131 BvhNode *BvHierarchy::SubdivideAndCopy(SplitQueue &tQueue, 2132 SubdivisionCandidate *splitCandidate, 2133 const bool globalCriteriaMet, 2134 BvhNode *originalNode) 2135 { 2136 BvhSubdivisionCandidate *sc = dynamic_cast<BvhSubdivisionCandidate *>(splitCandidate); 2107 return (float)(sizeof(BvHierarchy) 2108 + mBvhStats.Leaves() * sizeof(BvhLeaf) 2109 + mBvhStats.Interior() * sizeof(BvhInterior) 2110 ) / float(1024 * 1024); 2111 } 2112 2113 2114 BvhNode *BvHierarchy::SubdivideAndCopy(SplitQueue &tQueue, 2115 SubdivisionCandidate *splitCandidate) 2116 { 2117 BvhSubdivisionCandidate *sc = 2118 dynamic_cast<BvhSubdivisionCandidate *>(splitCandidate); 2137 2119 BvhTraversalData &tData = sc->mParentData; 2138 2120 … … 2149 2131 2150 2132 BvhInterior *oldInterior = dynamic_cast<BvhInterior *>(oldNode); 2151 //sc->SetSplitPlane(oldInterior->mSplitPlane); 2152 2133 2153 2134 oldInterior->GetFront()->CollectObjects(sc->mFrontObjects); 2154 2135 oldInterior->GetBack()->CollectObjects(sc->mBackObjects); 2155 EvalSubdivisionCandidate(*sc); 2136 2137 // evaluate the changes in render cost and pvs entries 2138 EvalSubdivisionCandidate(*sc, false); 2156 2139 2157 2140 // create new interior node and two leaf node 2158 2141 currentNode = SubdivideNode(*sc, tFrontData, tBackData); 2159 2142 2160 // evaluate the changes in render cost and pvs entries2161 EvalSubdivisionCandidate(*sc, false);2162 2163 2143 currentNode->mRenderCostDecr = oldNode->mRenderCostDecr + sc->GetRenderCostDecrease(); 2164 2144 currentNode->mPvsEntriesIncr = oldNode->mPvsEntriesIncr + sc->GetPvsEntriesIncr();
Note: See TracChangeset
for help on using the changeset viewer.