Ignore:
Timestamp:
10/09/06 15:57:28 (18 years ago)
Author:
mattausch
Message:

resolved bug for object space distribution using triangles
fixed biasing bug for mesh::GetRandomSurfacePoint? method and
GetRandomVisibleSurfacePoint?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1584 r1586  
    911911                cout << "compute new statistics ... " << endl; 
    912912         
     913                ///////////////7 
    913914                //-- propagate pvs or pvs size information 
     915 
    914916                ObjectPvs pvs; 
    915917                UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs); 
    916918 
     919                /////////// 
    917920                //-- output stats 
    918921                sprintf(str, "-%09d-eval.log", castSamples); 
     
    11281131                                                                           ) const 
    11291132{ 
    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; 
    11381144  } 
    11391145} 
     
    14891495        //-- extrude new vertices for top of prism 
    14901496 
    1491         Vector3 triNorm = baseTri.GetNormal(); 
     1497        const Vector3 triNorm = baseTri.GetNormal(); 
    14921498        Triangle3 topTri; 
    14931499 
     
    22362242        if (viewSpaceFilterSize >= 0.0f) { 
    22372243 
    2238   bool usePrVS = false; 
     2244  const bool usePrVS = false; 
    22392245 
    22402246  if (!usePrVS) { 
     
    23512357 
    23522358        // $$ warning collect objects takes only unmailed ones! 
    2353         kdTree->CollectObjects(box, 
    2354                                                    objects); 
     2359        kdTree->CollectObjects(box, objects); 
    23552360        //      cout<<"collected objects="<<objects.size()<<endl; 
    23562361        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 ++; 
    23622368        } 
    23632369  } 
     
    24552461        } 
    24562462         
    2457         //-- interior node => propagate pvs up 
     2463        //////////////// 
     2464        //-- interior node => propagate pvs up the tree 
     2465 
    24582466        ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(root); 
    24592467        interior->GetPvs().Clear(); 
     
    24672475                ObjectPvs objPvs; 
    24682476                 
     2477                ////////////////// 
    24692478                //-- recursivly compute child pvss 
     2479 
    24702480                UpdatePvsForEvaluation(*vit, objPvs); 
    24712481 
     
    24782488 
    24792489        //-- 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 
    24832494        vector<ObjectPvs>::iterator oit = pvsList.begin(); 
    24842495 
     
    25082519        UpdateScalarPvsSize(interior, pvs.CountObjectsInPvs(), pvs.GetSize()); 
    25092520         
    2510  
    2511 #else // really merge cells: slow put sumPdf is correct 
     2521#else  
     2522        // really merge cells: slow put sumPdf is correct 
    25122523        viewCellInterior->GetPvs().Merge(backVc->GetPvs()); 
    25132524        viewCellInterior->GetPvs().Merge(frontVc->GetPvs()); 
     
    25612572 
    25622573        const float prop = (float)limit / ((float)rays.size() + Limits::Small); 
     2574 
    25632575        for (it = rays.begin(); it != it_end; ++ it) 
    25642576        { 
     
    40464058        //////////// 
    40474059        //-- compression 
    4048  
     4060//#if HAS_TO_BE_REDONE 
    40494061        if (ViewCellsTreeConstructed() && mCompressViewCells) 
    40504062        { 
    4051                 int pvsEntries = mViewCellsTree->GetStoredPvsEntriesNum(mViewCellsTree->GetRoot()); 
     4063                int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
    40524064                Debug << "number of entries before compress: " << pvsEntries << endl; 
    40534065 
    40544066                mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 
    40554067 
    4056                 pvsEntries = mViewCellsTree->GetStoredPvsEntriesNum(mViewCellsTree->GetRoot()); 
     4068                pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
    40574069                Debug << "number of entries after compress: " << pvsEntries << endl; 
    40584070        } 
    4059  
     4071//#endif 
    40604072 
    40614073        // collapse sibling leaves that share the same view cell 
     
    49194931         
    49204932 
    4921         /////////////// 
     4933        /////////// 
    49224934        //-- compression 
    49234935 
     4936//#if HAS_TO_BE_REDONE 
    49244937        if (ViewCellsTreeConstructed() && mCompressViewCells) 
    49254938        { 
    4926                 int pvsEntries = mViewCellsTree->GetStoredPvsEntriesNum(mViewCellsTree->GetRoot()); 
     4939                int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
    49274940                Debug << "number of entries before compress: " << pvsEntries << endl; 
    49284941 
    49294942                mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 
    49304943 
    4931                 pvsEntries = mViewCellsTree->GetStoredPvsEntriesNum(mViewCellsTree->GetRoot()); 
     4944                pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
    49324945                Debug << "number of entries after compress: " << pvsEntries << endl; 
    49334946        } 
     4947//#endif 
    49344948 
    49354949        ///////////// 
Note: See TracChangeset for help on using the changeset viewer.