Changeset 1586 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 10/09/06 15:57:28 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1584 r1586 911 911 cout << "compute new statistics ... " << endl; 912 912 913 ///////////////7 913 914 //-- propagate pvs or pvs size information 915 914 916 ObjectPvs pvs; 915 917 UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs); 916 918 919 /////////// 917 920 //-- output stats 918 921 sprintf(str, "-%09d-eval.log", castSamples); … … 1128 1131 ) const 1129 1132 { 1130 if (!vc->IsLeaf() && vc->GetMergeCost() < 0.0f) { 1131 ViewCellInterior *vci = (ViewCellInterior *) vc; 1132 ViewCellContainer::const_iterator it, it_end = vci->mChildren.end(); 1133 1134 for (it = vci->mChildren.begin(); it != it_end; ++ it) 1135 DeleteLocalMergeTree(*it); 1136 vci->mChildren.clear(); 1137 delete vci; 1133 if (!vc->IsLeaf() && vc->GetMergeCost() < 0.0f) 1134 { 1135 ViewCellInterior *vci = (ViewCellInterior *) vc; 1136 ViewCellContainer::const_iterator it, it_end = vci->mChildren.end(); 1137 1138 for (it = vci->mChildren.begin(); it != it_end; ++ it) 1139 DeleteLocalMergeTree(*it); 1140 1141 vci->mChildren.clear(); 1142 1143 delete vci; 1138 1144 } 1139 1145 } … … 1489 1495 //-- extrude new vertices for top of prism 1490 1496 1491 Vector3 triNorm = baseTri.GetNormal();1497 const Vector3 triNorm = baseTri.GetNormal(); 1492 1498 Triangle3 topTri; 1493 1499 … … 2236 2242 if (viewSpaceFilterSize >= 0.0f) { 2237 2243 2238 bool usePrVS = false;2244 const bool usePrVS = false; 2239 2245 2240 2246 if (!usePrVS) { … … 2351 2357 2352 2358 // $$ warning collect objects takes only unmailed ones! 2353 kdTree->CollectObjects(box, 2354 objects); 2359 kdTree->CollectObjects(box, objects); 2355 2360 // cout<<"collected objects="<<objects.size()<<endl; 2356 2361 ObjectContainer::const_iterator noi = objects.begin(); 2357 for (; noi != objects.end(); ++noi) { 2358 Intersectable *o = *noi; 2359 // $$ JB warning: pdfs are not correct at this point! 2360 nPvs.AddSample(o, Limits::Small); 2361 nPvsSize++; 2362 for (; noi != objects.end(); ++ noi) 2363 { 2364 Intersectable *o = *noi; 2365 // $$ JB warning: pdfs are not correct at this point! 2366 nPvs.AddSample(o, Limits::Small); 2367 nPvsSize ++; 2362 2368 } 2363 2369 } … … 2455 2461 } 2456 2462 2457 //-- interior node => propagate pvs up 2463 //////////////// 2464 //-- interior node => propagate pvs up the tree 2465 2458 2466 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(root); 2459 2467 interior->GetPvs().Clear(); … … 2467 2475 ObjectPvs objPvs; 2468 2476 2477 ////////////////// 2469 2478 //-- recursivly compute child pvss 2479 2470 2480 UpdatePvsForEvaluation(*vit, objPvs); 2471 2481 … … 2478 2488 2479 2489 //-- faster way of computing pvs: 2480 // construct merged pvs by adding 2481 // and only those of the next pvs which were not mailed. 2482 // note: sumpdf is not correct!! 2490 //-- construct merged pvs by adding 2491 //-- and only those of the next pvs which were not mailed. 2492 //-- note: sumpdf is not correct!! 2493 2483 2494 vector<ObjectPvs>::iterator oit = pvsList.begin(); 2484 2495 … … 2508 2519 UpdateScalarPvsSize(interior, pvs.CountObjectsInPvs(), pvs.GetSize()); 2509 2520 2510 2511 #else// really merge cells: slow put sumPdf is correct2521 #else 2522 // really merge cells: slow put sumPdf is correct 2512 2523 viewCellInterior->GetPvs().Merge(backVc->GetPvs()); 2513 2524 viewCellInterior->GetPvs().Merge(frontVc->GetPvs()); … … 2561 2572 2562 2573 const float prop = (float)limit / ((float)rays.size() + Limits::Small); 2574 2563 2575 for (it = rays.begin(); it != it_end; ++ it) 2564 2576 { … … 4046 4058 //////////// 4047 4059 //-- compression 4048 4060 //#if HAS_TO_BE_REDONE 4049 4061 if (ViewCellsTreeConstructed() && mCompressViewCells) 4050 4062 { 4051 int pvsEntries = mViewCellsTree-> GetStoredPvsEntriesNum(mViewCellsTree->GetRoot());4063 int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 4052 4064 Debug << "number of entries before compress: " << pvsEntries << endl; 4053 4065 4054 4066 mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 4055 4067 4056 pvsEntries = mViewCellsTree-> GetStoredPvsEntriesNum(mViewCellsTree->GetRoot());4068 pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 4057 4069 Debug << "number of entries after compress: " << pvsEntries << endl; 4058 4070 } 4059 4071 //#endif 4060 4072 4061 4073 // collapse sibling leaves that share the same view cell … … 4919 4931 4920 4932 4921 /////////// ////4933 /////////// 4922 4934 //-- compression 4923 4935 4936 //#if HAS_TO_BE_REDONE 4924 4937 if (ViewCellsTreeConstructed() && mCompressViewCells) 4925 4938 { 4926 int pvsEntries = mViewCellsTree-> GetStoredPvsEntriesNum(mViewCellsTree->GetRoot());4939 int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 4927 4940 Debug << "number of entries before compress: " << pvsEntries << endl; 4928 4941 4929 4942 mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 4930 4943 4931 pvsEntries = mViewCellsTree-> GetStoredPvsEntriesNum(mViewCellsTree->GetRoot());4944 pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 4932 4945 Debug << "number of entries after compress: " << pvsEntries << endl; 4933 4946 } 4947 //#endif 4934 4948 4935 4949 /////////////
Note: See TracChangeset
for help on using the changeset viewer.