Ignore:
Timestamp:
03/20/06 00:11:27 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r708 r710  
    1616#include "RssPreprocessor.h" 
    1717 
    18 #define SAMPLE_AFTER_SUBDIVISION 1 
     18#define SAMPLE_AFTER_SUBDIVISION 0 
    1919#define TEST_EMPTY_VIEW_CELLS 0 
    2020 
     
    6262        environment->GetFloatValue("ViewCells.maxPvsRatio", mMaxPvsRatio); 
    6363         
    64         bool emptyViewCells = false; 
    65         environment->GetBoolValue("ViewCells.pruneEmptyViewCells", emptyViewCells); 
    66         mMinPvsSize = emptyViewCells ? 1 : 0; 
     64        environment->GetBoolValue("ViewCells.pruneEmptyViewCells", mPruneEmptyViewCells); 
     65 
     66        // HACK 
     67        if (0) 
     68                mMinPvsSize = mPruneEmptyViewCells ? 1 : 0; 
     69        else 
     70                mMinPvsSize = 0; 
    6771 
    6872        environment->GetBoolValue("ViewCells.processOnlyValidViewCells", mOnlyValidViewCells); 
     
    8589        environment->GetIntValue("ViewCells.Filter.maxSize", mMaxFilterSize); 
    8690        environment->GetFloatValue("ViewCells.Filter.width", mFilterWidth); 
    87 //mSampleEmptyViewCells = true; 
     91 
    8892        char buf[100]; 
    8993        environment->GetStringValue("ViewCells.samplingType", buf); 
     
    112116 
    113117 
     118 
    114119        Debug << "***********View Cells options ****************" << endl; 
    115120        Debug << "color code: " << mColorCode << endl; 
     
    119124        Debug << "max pvs ratio: " << mMaxPvsRatio << endl; 
    120125         
    121         Debug << "prune empty view cells: " << emptyViewCells << endl; 
     126        Debug << "prune empty view cells: " << mPruneEmptyViewCells << endl; 
    122127         
    123128        Debug << "process only valid view cells: " << mOnlyValidViewCells << endl; 
     
    137142        Debug << "show visualization: " << mShowVisualization << endl; 
    138143        Debug << "filter width: " << mFilterWidth << endl; 
    139  
     144        Debug << "sample after subdivision: " << SAMPLE_AFTER_SUBDIVISION << endl; 
    140145        Debug << endl; 
    141146} 
     
    427432 
    428433        // needed to fix empty view cells 
    429     SetValidity(0, 99999999999); 
     434    //SetValidity(0, 99999999999); 
    430435 
    431436        if (mEvaluateViewCells) 
     
    618623{ 
    619624 
    620   if ((vc->GetPvs().GetSize() > maxPvsSize) || 
    621           (vc->GetPvs().GetSize() < minPvsSize)) 
    622         { 
    623           return false; 
    624         } 
    625  
    626   return true; 
    627 } 
    628  
     625        if ((vc->GetPvs().GetSize() > maxPvsSize) || 
     626                (vc->GetPvs().GetSize() < minPvsSize)) 
     627        { 
     628                return false; 
     629        } 
     630 
     631        return true; 
     632} 
     633 
     634 
     635bool ViewCellsManager::EqualToSpatialNode(ViewCell *viewCell) const  
     636{  
     637        return false; 
     638} 
     639 
     640int ViewCellsManager::ComputeBoxIntersections(const AxisAlignedBox3 &box,  
     641                                                                                          ViewCellContainer &viewCells) const 
     642{ 
     643        return 0; 
     644}; 
    629645 
    630646AxisAlignedBox3 ViewCellsManager::GetFilterBBox(const Vector3 &viewPoint,  
     
    944960        // generate parent view cell 
    945961        ViewCellInterior *vc = new ViewCellInterior();//GenerateViewCell(); 
    946          
     962 
    947963        vc->GetPvs() = left->GetPvs(); 
    948  
    949964        // merge pvs 
    950965        vc->GetPvs().Merge(right->GetPvs()); 
     
    961976        } 
    962977 
    963         vc->SetupChildLink(left); 
    964         vc->SetupChildLink(right); 
    965          
     978        // set only links to child (not from child to parent, maybe not wished!!) 
     979        vc->mChildren.push_back(left); 
     980        vc->mChildren.push_back(right); 
     981 
    966982        return vc; 
    967983} 
     
    978994                // merge pvs 
    979995                vc->GetPvs().Merge((*it)->GetPvs()); 
    980  
    981                 vc->SetupChildLink(*it); 
     996                vc->mChildren.push_back(*it); 
     997                //vc->SetupChildLink(*it); 
    982998        } 
    983999 
     
    29022918                                                                                                 const VssRayContainer &rays) 
    29032919{ 
     2920        mMaxPvsSize = (int)(mMaxPvsRatio * (float)objects.size()); 
     2921 
    29042922        // if view cells were already constructed 
    29052923        if (ViewCellsConstructed()) 
     
    29232941        Debug << "saved rays: " << (int)savedRays.size() << endl; 
    29242942 
    2925         mMaxPvsSize = (int)(mMaxPvsRatio * (float)objects.size()); 
    29262943 
    29272944        //TODO: remove 
     
    29682985                                                                                        const ObjectContainer &objects) 
    29692986{ 
    2970         //-- post processing of bsp view cells 
    29712987    int vcSize = 0; 
    29722988        int pvsSize = 0; 
    29732989 
    29742990        //-- merge view cells 
    2975          
    29762991        cout << "starting merge using " << mPostProcessSamples << " samples ... " << endl; 
    29772992        long startTime = GetTime(); 
     
    29812996        { 
    29822997                // TODO: should be done BEFORE the ray casting 
     2998                // compute tree by merging the nodes based on cost heuristics 
    29832999                mViewCellsTree->ConstructMergeTree(rays, objects); 
    29843000        } 
    29853001        else 
    29863002        { 
    2987                 mViewCellsTree->SetRoot(ConstructSpatialMergeTree(mVspBspTree->GetRoot())); 
     3003                // compute tree by merging the nodes of the spatial hierarchy 
     3004                ViewCell *root = ConstructSpatialMergeTree(mVspBspTree->GetRoot()); 
     3005                mViewCellsTree->SetRoot(root); 
    29883006        } 
    29893007 
     
    31623180        } 
    31633181 
    3164  
    31653182        // check if new view cells turned invalid 
    3166         Debug << "setting validity, min: " << mMinPvsSize << " max: " << mMaxPvsSize << endl; 
    3167         cout << "setting validity, min: " << mMinPvsSize << " max: " << mMaxPvsSize << endl; 
    3168         SetValidity(mMinPvsSize, mMaxPvsSize);  
     3183        int minPvs, maxPvs; 
     3184 
     3185        if (0) 
     3186        { 
     3187                minPvs = mMinPvsSize; 
     3188                maxPvs = mMaxPvsSize; 
     3189        } 
     3190        else 
     3191        { 
     3192                minPvs = mPruneEmptyViewCells ? 1 : 0; 
     3193                maxPvs = mMaxPvsSize; 
     3194        } 
     3195        Debug << "setting validity, min: " << minPvs << " max: " << maxPvs << endl; 
     3196        cout << "setting validity, min: " << minPvs << " max: " << maxPvs << endl; 
     3197         
     3198        SetValidity(minPvs, maxPvs);  
     3199 
    31693200        // update valid view space according to valid view cells 
    31703201        if (0) 
     
    31903221        MergeViewCells(postProcessRays, objects); 
    31913222         
    3192  
    31933223        // only for testing 
    31943224        TestSubdivision(); 
     
    37493779                        mVspBspTree->ConstructGeometry(leaf, geom); 
    37503780 
    3751                         const int cf = Polygon3::ClassifyPlane(geom.GetPolys(), *clipPlane, 0.00000001f); 
    3752  
    3753                         if (cf == Polygon3::BACK_SIDE) 
     3781                        const float eps = 0.00000001f; 
     3782                        const int cf = geom.Side(*clipPlane, eps); 
     3783 
     3784                        if (cf == -1) 
    37543785                        { 
    37553786                                exporter->ExportPolygons(geom.GetPolys()); 
    37563787                        } 
    3757                         else if (cf == Polygon3::SPLIT) 
     3788                        else if (cf == 0) 
    37583789                        { 
    37593790                                geom.SplitGeometry(front, 
     
    37613792                                                                   *clipPlane, 
    37623793                                                                   mViewSpaceBox,  
    3763                                                                    0.00000001f); 
     3794                                                                   eps); 
    37643795         
    37653796                                //Debug << "geo size: " << geom.Size() << endl; 
Note: See TracChangeset for help on using the changeset viewer.