Ignore:
Timestamp:
12/11/07 17:00:08 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2565 r2566  
    865865        mShowPvsSizes = false; 
    866866        mShowPiercingRays = false; 
     867        mShowWeightedRays = false; 
     868 
    867869        mSpatialFilterSize = 0.01; 
    868870        mPvsSize = 0; 
     
    902904        connect(mControlWidget, SIGNAL(SetRenderBoxes(bool)), this, SLOT(SetRenderBoxes(bool))); 
    903905        connect(mControlWidget, SIGNAL(SetRenderFilter(bool)), this, SLOT(SetRenderFilter(bool))); 
    904         connect(mControlWidget, SIGNAL(SetRenderVisibilityEstimates(bool)), 
    905                 this, SLOT(SetRenderVisibilityEstimates(bool))); 
     906        connect(mControlWidget, SIGNAL(SetRenderVisibilityEstimates(bool)), this, SLOT(SetRenderVisibilityEstimates(bool))); 
    906907        connect(mControlWidget, SIGNAL(SetUseFilter(bool)), this, SLOT(SetUseFilter(bool))); 
    907         connect(mControlWidget, SIGNAL(SetUseSpatialFilter(bool)), 
    908                 this, SLOT(SetUseSpatialFilter(bool))); 
     908        connect(mControlWidget, SIGNAL(SetUseSpatialFilter(bool)), this, SLOT(SetUseSpatialFilter(bool))); 
    909909        connect(mControlWidget, SIGNAL(SetShowPiercingRays(bool)), this, SLOT(SetShowPiercingRays(bool))); 
     910        connect(mControlWidget, SIGNAL(SetShowWeightedRays(bool)), this, SLOT(SetShowWeightedRays(bool))); 
    910911 
    911912        connect(mControlWidget, 
     
    11981199        ViewCellContainer &viewcells = mViewCellsManager->GetViewCells(); 
    11991200        int maxPvs = -1; 
    1200         int maxPiercingRays = 1; // for savety 
     1201        int maxPiercingRays = 1; // not zero for savety 
     1202        float maxRelativeRays = Limits::Small; // not zero for savety 
    12011203 
    12021204        for (i = 0; i < viewcells.size(); ++ i)  
     
    12131215                if (piercingRays > maxPiercingRays) 
    12141216                        maxPiercingRays = piercingRays; 
    1215         } 
    1216  
    1217         if (!mShowPvsSizes && !mShowPiercingRays) 
     1217 
     1218                const float relativeArea = vc->GetBox().SurfaceArea() / mViewCellsManager->GetViewSpaceBox().SurfaceArea(); 
     1219 
     1220                if ((float)piercingRays / relativeArea > maxRelativeRays) 
     1221                        maxRelativeRays = (float)piercingRays / relativeArea; 
     1222        } 
     1223 
     1224        if (!mShowPvsSizes && !mShowPiercingRays && !mShowWeightedRays) 
    12181225        { 
    12191226                for (i = 0; i < viewcells.size(); ++ i)  
     
    12601267                        { 
    12611268                                ViewCell *vc = viewcells[i]; 
    1262                                 const Vector3 dummyViewPoint(0.0, 0.0, 1.0); 
    1263                                 const float dist = SqrDistance(dummyViewPoint, vc->GetBox().Center()); 
     1269 
     1270                                const float dist = SqrDistance(mDummyViewPoint, vc->GetBox().Center()); 
    12641271 
    12651272                                vc->SetDistance(dist); 
     
    12691276                } 
    12701277 
    1271                 RgbColor c; 
    1272  
    1273         for (i = 0; i < viewcells.size(); ++ i)  
     1278                for (i = 0; i < viewcells.size(); ++ i)  
    12741279                { 
     1280                        RgbColor c; 
    12751281            ViewCell *vc = viewcells[i]; 
    12761282                         
     
    12831289                                        ((float)vc->GetNumPiercingRays() / (float)maxPiercingRays); 
    12841290                        } 
    1285                         else 
     1291                        else if (mShowWeightedRays) // relative number of rays 
     1292                        { 
     1293                                // importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 
     1294                                float relativeArea = vc->GetBox().SurfaceArea() / mViewCellsManager->GetViewSpaceBox().SurfaceArea(); 
     1295 
     1296                                if (relativeArea < Limits::Small) 
     1297                                        relativeArea = Limits::Small; 
     1298 
     1299                                importance = mTransferFunction * ((float)vc->GetNumPiercingRays() / relativeArea) / maxRelativeRays; 
     1300                        } 
     1301                        else // pvs size 
    12861302                        { 
    12871303                                //importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 
    12881304                                importance = mTransferFunction * 
    12891305                                        ((float)vc->GetPvs().GetSize() / (float)maxPvs); 
    1290                                 // c = RgbColor(importance, 1.0f - importance, 0.0f); 
    1291                                 c = RainbowColorMapping(5.0f * importance); 
    12921306                        } 
    12931307 
     
    14521466 
    14531467 
    1454         QRadioButton *rb1, *rb2, *rb3; 
     1468        QRadioButton *rb1, *rb2, *rb3, *rb4; 
    14551469 
    14561470        // Create a check box to be in the group box 
     
    14681482        rb3 = new QRadioButton("wireframe", hbox); 
    14691483        rb3->setText("wireframe"); 
     1484         
     1485        rb4 = new QRadioButton("weighted rays", hbox); 
     1486        rb4->setText("weighted rays"); 
     1487        connect(rb4, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedRays(bool))); 
     1488 
    14701489        //vl->addWidget(rb2); 
    14711490        //connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool))); 
     
    14781497        vbox2->addWidget(rb1); 
    14791498        vbox2->addWidget(rb2); 
    1480         rb2->setChecked(true); 
     1499        vbox2->addWidget(rb4); 
     1500        rb3->setChecked(true); 
    14811501 
    14821502        vbox2->addStretch(1); 
Note: See TracChangeset for help on using the changeset viewer.