Changeset 2566


Ignore:
Timestamp:
12/11/07 17:00:08 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
5 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); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2564 r2566  
    115115  void SetShowPvsSizes(bool); 
    116116  void SetShowPiercingRays(bool); 
     117  void SetShowWeightedRays(bool); 
    117118  void SetTopView(bool); 
    118119  void SetCutViewCells(bool); 
     
    144145        bool mShowRenderCost; 
    145146        bool mShowPiercingRays; 
     147        bool mShowWeightedRays; 
    146148        bool mShowRays; 
    147149 
     
    163165 
    164166        unsigned int mIndexBufferSize; 
     167 
     168        Vector3 mDummyViewPoint; 
    165169 
    166170        QtRendererControlWidget *mControlWidget; 
     
    316320        void SetShowPiercingRays(bool b) { 
    317321                mShowPiercingRays = b; 
     322                updateGL(); 
     323        } 
     324 
     325        void SetShowWeightedRays(bool b) { 
     326                mShowWeightedRays = b; 
    318327                updateGL(); 
    319328        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp

    r2564 r2566  
    5555        //glDisable(GL_DEPTH_TEST); 
    5656 
     57        mRenderer->mDummyViewPoint = mDummyViewPoint; 
    5758        glColor3f(0.8f, 0.8f, 0.8f); 
    5859        mRenderer->RenderPvs(); 
     
    108109        glLoadIdentity(); 
    109110 
    110         float m[4][4]; 
     111        //float m[4][4]; 
     112        Matrix4x4 m; 
    111113 
    112114        glLoadIdentity(); 
    113115        gluLookAt(0.0, 0.0, 1.0,  /* eye is at (0,0,30) */ 
    114                 0.0, 0.0, 0.0,      /* center is at (0,0,0) */ 
    115                 0.0, 1.0, 0.);      /* up is in positive Y direction */ 
    116  
    117         build_rotmatrix(m, manipulatorLastQuat); 
    118         glMultMatrixf(&m[0][0]); 
    119  
    120         float s = scale*20.0f/Magnitude(mRenderer->mSceneGraph->GetBox().Diagonal()); 
     116                      0.0, 0.0, 0.0,  /* center is at (0,0,0) */ 
     117                      0.0, 1.0, 0.);  /* up is in positive Y direction */ 
     118 
     119        build_rotmatrix(m.x, manipulatorLastQuat); 
     120        glMultMatrixf((float *)m.x); 
     121 
     122        float s = scale * 20.0f / Magnitude(mRenderer->mSceneGraph->GetBox().Diagonal()); 
    121123        glScalef(s, s, s); 
    122124 
     
    124126        glTranslatef(t.x, t.y, t.z); 
    125127 
     128        mDummyViewPoint = -t; 
     129        mDummyViewPoint /= s; 
     130 
     131        //glGetFloatv(GL_MODELVIEW_MATRIX, m1); 
     132 
     133        m.Invert(); 
     134 
     135        mDummyViewPoint = m * mDummyViewPoint; 
    126136        RenderScene(); 
    127137} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.h

    r2562 r2566  
    33 
    44#include <QtOpenGL> 
    5  
     5#include "Vector3.h" 
    66 
    77namespace GtpVisibilityPreprocessor  
     
    2222 
    2323        QtGlViewer(QWidget *parent, 
    24                 QtGlRendererWidget *renderer); 
     24                       QtGlRendererWidget *renderer); 
    2525 
    2626        virtual ~QtGlViewer(){}; 
     
    4141        void mouseMoveEvent(QMouseEvent *event); 
    4242 
    43         void keyPressEvent ( QKeyEvent * e ); 
     43        void keyPressEvent(QKeyEvent * e); 
    4444 
    4545        bool mWireframe; 
    4646 
    4747        int timerId; 
     48 
     49        Vector3 mDummyViewPoint; 
    4850 
    4951private: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r2548 r2566  
    750750        Vector3 origin, termination, direction;  
    751751 
    752         float radius = 0.5f *  
     752        const float radius = 0.5f *  
    753753                Magnitude(mPreprocessor.mViewCellsManager->GetViewSpaceBox().Size()); 
    754754 
Note: See TracChangeset for help on using the changeset viewer.