Changeset 535 for trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
- Timestamp:
- 01/13/06 17:39:43 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r532 r535 29 29 const float VspBspTree::sBalancedRaysTable[] = {1, -1, 0, 0, 0}; 30 30 31 int BspMergeCandidate::sMaxPvsSize = 0; 31 32 32 33 int VspBspTree::sFrontId = 0; … … 311 312 312 313 mMaxPvs = (int)(mMaxPvsRatio * (float)numObj); 313 Debug << "maximal pvs where view cell is valid: " << mMaxPvs << endl; 314 315 Debug << "maximal pvs (i.e., view cell considered as valid: " << mMaxPvs << endl; 314 316 //-- store rays 315 317 for (rit = sampleRays.begin(); rit != rit_end; ++ rit) … … 424 426 (data.mArea <= mTermMinArea) || 425 427 (mStat.Leaves() >= mMaxViewCells) || 426 (data.GetAvgRayContribution() > =mTermMaxRayContribution) ||428 (data.GetAvgRayContribution() > mTermMaxRayContribution) || 427 429 (data.mDepth >= mTermMaxDepth)); 428 430 } … … 2159 2161 typedef pair<BspNode *, BspNodeGeometry *> bspNodePair; 2160 2162 2163 2161 2164 int VspBspTree::CastBeam(Beam &beam) 2162 2165 { … … 2176 2179 2177 2180 AxisAlignedBox3 box; 2178 geom->ComputeBoundingBox(box); 2179 2180 int side = beam.ComputeIntersection(box); 2181 box.Initialize(); 2182 geom->IncludeInBox(box); 2183 2184 Debug << "box:\n " << box << endl;; 2185 const int side = beam.ComputeIntersection(box); 2181 2186 2182 2187 switch (side) 2183 2188 { 2184 2189 case -1: 2190 Debug << "here999" << endl; 2185 2191 CollectViewCells(node, beam.mViewCells, true); 2186 2192 break; 2187 2193 case 0: 2194 2188 2195 if (node->IsLeaf()) 2189 2196 { 2190 BspLeaf *leaf = dynamic_cast<BspLeaf *>(leaf); 2197 Debug << "here2" << endl; 2198 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node); 2199 2191 2200 if (!leaf->GetViewCell()->Mailed() && leaf->TreeValid()) 2201 { 2202 leaf->GetViewCell()->Mail(); 2192 2203 beam.mViewCells.push_back(leaf->GetViewCell()); 2204 } 2193 2205 } 2194 2206 else 2195 2207 { 2208 Debug << "here77" << endl; 2196 2209 BspInterior *interior = dynamic_cast<BspInterior *>(node); 2210 2197 2211 BspNode *first = interior->GetBack(); 2198 2212 BspNode *second = interior->GetFront(); 2199 2213 2214 BspNodeGeometry *firstGeom = new BspNodeGeometry(); 2215 BspNodeGeometry *secondGeom = new BspNodeGeometry(); 2216 2217 ConstructGeometry(first, *firstGeom); 2218 ConstructGeometry(second, *secondGeom); 2219 2200 2220 // decide on the order of the nodes 2201 2221 if (DotProd(beam.mPlanes[0].mNormal, … … 2203 2223 { 2204 2224 swap(first, second); 2225 swap(firstGeom, secondGeom); 2205 2226 } 2206 2227 2207 BspNodeGeometry *leftGeom = new BspNodeGeometry(); 2208 BspNodeGeometry *rightGeom = new BspNodeGeometry(); 2209 2210 ConstructGeometry(first, *leftGeom); 2211 ConstructGeometry(second, *rightGeom); 2212 2213 nodeStack.push(bspNodePair(first, leftGeom)); 2214 nodeStack.push(bspNodePair(second, rightGeom)); 2228 nodeStack.push(bspNodePair(first, firstGeom)); 2229 nodeStack.push(bspNodePair(second, secondGeom)); 2215 2230 } 2231 2216 2232 break; 2233 Debug << "culling!!" << endl; 2217 2234 // default: cull 2218 2235 } 2236 Debug << "here4" << endl; 2219 2237 DEL_PTR(geom); 2238 2220 2239 } 2221 2240 … … 2471 2490 int VspBspTree::MergeViewCells(const VssRayContainer &rays) 2472 2491 { 2492 BspMergeCandidate::sMaxPvsSize = mMaxPvs; 2493 2473 2494 MergeStatistics mergeStats; 2474 2495 mergeStats.Start(); … … 2866 2887 2867 2888 mMergeCost = newCost - oldCost; 2868 // if (vcPvs > sMaxPvsSize) // strong penalty if pvs size too large2869 //mMergeCost += 1.0;2889 if (newPvs > sMaxPvsSize) // strong penalty if pvs size too large 2890 mMergeCost += 1.0; 2870 2891 } 2871 2892
Note: See TracChangeset
for help on using the changeset viewer.