Ignore:
Timestamp:
01/19/08 05:28:24 (16 years ago)
Author:
mattausch
Message:

did some stuff for the visualization

Location:
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
Files:
3 edited

Legend:

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

    r2614 r2615  
    8888                                                                           KdTree *tree): 
    8989  QGLPixelBuffer(QSize(w, h)), 
    90   //QGLWidget(NULL, w, h), 
    9190  GlRendererBuffer(sceneGraph, viewcells, tree) 
    9291{ 
     
    380379        glNormalPointer(GL_FLOAT, 0, (char *)arrayPtr + offset * sizeof(Vector3)); 
    381380        glDrawElements(GL_TRIANGLES, mIndexBufferSize, GL_UNSIGNED_INT, mIndices); 
    382  
     381#if DYNAMIC_OBJECTS_HACK 
    383382        // handle dynamic objects 
    384383        DynamicObjectsContainer::const_iterator dit, dit_end = mDynamicObjects.end(); 
    385384 
     385 
    386386        for (dit = mDynamicObjects.begin(); dit != dit_end; ++ dit) 
    387387        { 
     388#if USE_TRANSFORMED_MESH_INSTANCE_HACK 
    388389                //cerr << "here45\n****"<<endl; 
    389390                RenderIntersectable(*dit); 
    390         } 
     391#else 
     392                RenderDynamicObject(*dit); 
     393#endif 
     394        } 
     395#endif 
    391396} 
    392397 
     
    400405 
    401406        mPvsSize = mPvsCache.mPvs.GetSize(); 
    402  
     407#if DYNAMIC_OBJECTS_HACK 
    403408        mDynamicObjects.clear(); 
    404  
     409#endif 
    405410        ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 
    406411 
     
    416421                        } 
    417422                        break; 
     423#if DYNAMIC_OBJECTS_HACK 
     424#if USE_TRANSFORMED_MESH_INSTANCE_HACK 
     425 
    418426                case Intersectable::TRANSFORMED_MESH_INSTANCE: 
    419427                        mDynamicObjects.push_back(static_cast<TransformedMeshInstance *>(obj)); 
    420428                        break; 
     429 
     430#else 
     431                case Intersectable::SCENEGRAPHLEAF_INTERSECTABLE: 
     432                        mDynamicObjects.push_back(static_cast<SceneGraphLeafIntersectable *>(obj)->GetItem()); 
     433                        break; 
     434#endif 
     435#endif 
    421436                default: 
    422437                        cerr << "PreparePvs: type " << Intersectable::GetTypeName(obj) << " not handled yet" << endl; 
     
    513528                                //mPvsCache.mPvs = pvs; 
    514529                                //mMutex.unlock(); 
     530                                cout << "pvs size: " << mPvsCache.mPvs.GetSize() << endl; 
    515531                        } 
    516532                        else 
     
    667683                mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY / 2.0; 
    668684        }  
     685#if DYNAMIC_OBJECTS_HACK 
    669686        else if (e->modifiers() & Qt::AltModifier) 
    670687        { 
     
    673690                        Matrix4x4 tm; 
    674691                        TransformedMeshInstance *tmi; 
     692#if USE_TRANSFORMED_MESH_INSTANCE_HACK 
    675693 
    676694                        switch (mTrafoType) 
     
    703721 
    704722                        tmi->ApplyWorldTransform(tm); 
     723#endif 
    705724                        updateGL(); 
    706725                } 
    707726        } 
     727#endif 
    708728        else 
    709729        { 
     
    10011021        connect(mControlWidget, SIGNAL(SetScale(bool)), this, SLOT(SetScale(bool))); 
    10021022         
    1003         // setting the size here 
    1004         resize(800, 600); 
     1023        setWindowTitle("PVS Visualization"); 
     1024 
     1025        // setting the main window size here 
     1026        //resize(800, 600); 
     1027        //resize(640, 480); 
     1028        //resize(512, 384); 
     1029        //resize(512, 320); 
     1030        resize(640, 400); 
     1031         
    10051032        mControlWidget->show(); 
    10061033} 
     
    13091336        while (pit.HasMoreEntries())     
    13101337        { 
     1338                KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next()); 
     1339 
    13111340                if (mShowDistanceWeightedPvs) 
    13121341                { 
    1313                         KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next()); 
    13141342                        const AxisAlignedBox3 box = kdObj->GetBox(); 
    13151343 
     
    13191347                else if (mShowDistanceWeightedTriangles) 
    13201348                { 
    1321                         KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next()); 
    13221349                        const AxisAlignedBox3 box = kdObj->GetBox(); 
    13231350 
     
    13271354                else //if (mShowWeightedTriangles) 
    13281355                { 
    1329                         KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next()); 
    13301356                        renderCost += kdObj->ComputeNumTriangles(); 
    13311357                } 
     
    14361462 
    14371463        ComputeMaxValues(viewcells, maxPvs, maxPiercingRays, maxRelativeRays, maxRcCost); 
    1438  
     1464        // matt: temp hack 
     1465        //maxRcCost = 200.0f; 
     1466        //cout << "maxRcCost: " << maxRcCost << endl; 
    14391467        int i; 
    14401468 
     
    14881516        else // using specialised colors 
    14891517        { 
    1490          
    1491  
    14921518                if (!mShowComparison) 
    14931519                        AssignImportanceByRelativeValue(viewcells, maxPvs, maxPiercingRays, maxRelativeRays, maxRcCost); 
     
    15571583                        importance = rcCost / maxRcCost; 
    15581584                } 
    1559  
     1585if (importance > 1.0f) importance = 1.0f; 
    15601586                // c = RgbColor(importance, 1.0f - importance, 0.0f); 
    15611587                c = RainbowColorMapping(importance); 
     
    16581684        connect(rb5, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedCost(bool))); 
    16591685 
    1660         QGroupBox *groupBox = new QGroupBox("Visualization options"); 
     1686        QGroupBox *groupBox = new QGroupBox("PVS Visualization"); 
    16611687 
    16621688        QVBoxLayout *vbox2 = new QVBoxLayout; 
     
    17711797 
    17721798         
    1773         QGroupBox *groupBox = new QGroupBox("Ray visualization options"); 
     1799        QGroupBox *groupBox = new QGroupBox("Ray visualization"); 
    17741800        QVBoxLayout *vbox2 = new QVBoxLayout; 
    17751801     
     
    18161842        QVBoxLayout *vl = new QVBoxLayout; 
    18171843        setLayout(vl); 
    1818  
    1819         QWidget *vbox = new QGroupBox("ViewCells", this); 
    1820         layout()->addWidget(vbox); 
    1821  
    1822         vl = new QVBoxLayout; 
    1823         vbox->setLayout(vl); 
     1844         
     1845        //QWidget *vbox; 
     1846 
     1847        //vbox = new QGroupBox("Render Controls", this); 
     1848        //layout()->addWidget(vbox); 
     1849        //vl = new QVBoxLayout; 
     1850        //vbox->setLayout(vl); 
    18241851 
    18251852        QLabel *label; 
     
    18301857 
    18311858        label = new QLabel("Granularity"); 
    1832         vbox->layout()->addWidget(label); 
     1859        //vbox->layout()->addWidget(label); 
     1860        vl->addWidget(label); 
    18331861 
    18341862        slider = new QSlider(Qt::Horizontal, vbox); 
     
    18441872 
    18451873        label = new QLabel("Transfer function"); 
    1846         vbox->layout()->addWidget(label); 
     1874        vl->addWidget(label); 
    18471875 
    18481876        slider = new QSlider(Qt::Horizontal, vbox); 
     
    18591887 
    18601888        button = new QPushButton("Update all PVSs", vbox); 
    1861         vbox->layout()->addWidget(button); 
     1889        vl->addWidget(button); 
    18621890        connect(button, SIGNAL(clicked()), SLOT(UpdateAllPvs())); 
    18631891 
     
    18651893 
    18661894        label = new QLabel("Filter size"); 
    1867         vbox->layout()->addWidget(label); 
     1895        vl->addWidget(label); 
    18681896 
    18691897        slider = new QSlider(Qt::Horizontal, vbox); 
    1870         vbox->layout()->addWidget(slider); 
     1898        vl->addWidget(slider); 
    18711899        slider->show(); 
    18721900        slider->setRange(1, 100); 
     
    18791907 
    18801908 
    1881         ////////////////////////////////////////// 
    1882  
    1883         label = new QLabel("Spatial Filter size"); 
    1884         vbox->layout()->addWidget(label); 
    1885  
    1886         slider = new QSlider(Qt::Horizontal, vbox); 
    1887         vbox->layout()->addWidget(slider); 
    1888         slider->show(); 
    1889         slider->setRange(1, 100); 
    1890         slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 
    1891         slider->setValue(10); 
    1892  
    1893         connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetSpatialFilterSize(int))); 
    1894  
    1895  
     1909         
    18961910        /////////////////////////////////// 
    18971911 
    18981912 
    1899         QWidget *hbox = new QWidget(vbox); 
     1913        QWidget *hbox = new QWidget();//vbox); 
    19001914        vl->addWidget(hbox); 
    19011915        QHBoxLayout *hlayout = new QHBoxLayout; 
     
    19061920        cb->setChecked(false); 
    19071921        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowViewCells(bool))); 
    1908  
     1922         
     1923        cb = new QCheckBox("Render errors", hbox); 
     1924        hlayout->layout()->addWidget(cb); 
     1925        cb->setChecked(false); 
     1926        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderErrors(bool))); 
     1927 
     1928#if REMOVE_TEMPORARY 
    19091929        cb = new QCheckBox("Render cost curve", hbox); 
    19101930        hlayout->addWidget(cb); 
    19111931        cb->setChecked(false); 
    19121932        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRenderCost(bool))); 
    1913  
     1933#endif 
    19141934        cb = new QCheckBox("Show rays", hbox); 
    19151935        hlayout->addWidget(cb); 
    19161936        cb->setChecked(false); 
    19171937        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRays(bool))); 
    1918          
     1938#if REMOVE_TEMPORARY     
    19191939        cb = new QCheckBox("Show Comparison", hbox); 
    19201940        hlayout->addWidget(cb); 
    19211941        cb->setChecked(false); 
    19221942        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowComparison(bool))); 
    1923  
     1943#endif 
    19241944 
    19251945        ////////////////// 
     
    19341954        QGroupBox *groupBox = CreateVisualizationPanel(hbox); 
    19351955        vh->addWidget(groupBox, 0, 0); 
    1936  
     1956#if REMOVE_TEMPORARY 
    19371957        QGroupBox *groupBox2 = CreateRenderCostPanel(hbox); 
    19381958        vh->addWidget(groupBox2, 0, 0); 
    1939          
     1959#endif 
    19401960        QGroupBox *groupBox3 = CreateRayVisualizationPanel(hbox); 
    19411961        vh->addWidget(groupBox3, 0, 0); 
     
    19481968 
    19491969        /*cb = new QRadiobox("Top View", vbox); 
    1950         vbox->layout()->addWidget(cb); 
     1970        vl->addWidget(cb); 
    19511971        cb->setChecked(false); 
    19521972        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetTopView(bool))); 
    19531973*/ 
    19541974 
    1955         vbox->resize(800,150); 
     1975        //vbox->resize(800,150); 
     1976        QWidget *vbox; 
    19561977 
    19571978        vbox = new QGroupBox("Rendering", this); 
     
    20222043 
    20232044        /////////////////////////////////////////// 
    2024  
     2045#if REMOVE_TEMPORARY 
    20252046        cb = new QCheckBox("Transparency", vbox); 
    20262047        vbox->layout()->addWidget(cb); 
     
    20382059        slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 
    20392060        slider->setValue(0); 
    2040  
     2061#endif 
    20412062        connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetTransparency(int))); 
    20422063 
     
    20482069        cb->setChecked(false); 
    20492070        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetCutScene(bool))); 
    2050 #endif 
     2071 
    20512072        cb = new QCheckBox("Render boxes", vbox); 
    20522073        vbox->layout()->addWidget(cb); 
     
    20582079        cb->setChecked(false); 
    20592080        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderVisibilityEstimates(bool))); 
    2060  
    2061  
    2062         cb = new QCheckBox("Render errors", vbox); 
    2063         vbox->layout()->addWidget(cb); 
    2064         cb->setChecked(false); 
    2065         connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderErrors(bool))); 
     2081#endif 
    20662082 
    20672083        bool tmp; 
     
    20812097        cb->setChecked(tmp); 
    20822098        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetUseSpatialFilter(bool))); 
    2083  
     2099#if REMOVE_TEMPORARY 
    20842100        cb = new QCheckBox("Render filter", vbox); 
    20852101        vbox->layout()->addWidget(cb); 
     
    21132129        vbox->layout()->addWidget(button); 
    21142130        connect(button, SIGNAL(clicked()), SIGNAL(LoadObject())); 
    2115  
     2131#endif 
    21162132        /*cb = new QCheckBox("Stats", vbox); 
    21172133        vbox->layout()->addWidget(cb); 
     
    21422158        //connect(button, SIGNAL(clicked(void)), SLOT(StoreStatistics(void))); 
    21432159        //mHidingCost = 0.1f; 
     2160////////////////////////////////////////// 
     2161 
     2162        label = new QLabel("Spatial Filter size"); 
     2163        vbox->layout()->addWidget(label); 
     2164 
     2165        slider = new QSlider(Qt::Horizontal, vbox); 
     2166        vbox->layout()->addWidget(slider); 
     2167        slider->show(); 
     2168        slider->setRange(1, 100); 
     2169        slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 
     2170        slider->setValue(10); 
     2171 
     2172        connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetSpatialFilterSize(int))); 
     2173 
    21442174 
    21452175        setWindowTitle("Preprocessor Control Widget"); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2614 r2615  
    232232 
    233233        bool mUseRandomColorPerPvsObject; 
    234  
     234#if DYNAMIC_OBJECTS_HACK 
    235235        DynamicObjectsContainer mDynamicObjects; 
    236  
     236#endif 
    237237        QtGlRendererWidget(SceneGraph *sceneGraph, 
    238238                               ViewCellsManager *viewcells, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp

    r2614 r2615  
    3131        mModelMatrix = IdentityMatrix(); 
    3232 
     33        //setWindowTitle("PVS visualization"); 
     34        setWindowTitle("Global View Cell Visualization"); 
     35 
    3336        trackball(manipulatorLastQuat, 0.0f, 0.0f, 0.0f, 0.0f); 
    3437        //connect(renderer, SIGNAL(PvsUpdated()), this, SLOT(updateGL())); 
     
    4649QSize QtGlViewer::sizeHint() const  
    4750{ 
    48         return QSize(640, 480); 
     51        // set viewer size here 
     52        return QSize(512, 320); 
     53 
     54        //return QSize(512, 384); 
     55        //return QSize(640, 480); 
    4956} 
    5057   
     
    228235{ 
    229236  switch (e->key()) { 
     237  case Qt::Key_V: 
     238                mRenderer->mRenderViewCells = !mRenderer->mRenderViewCells; 
     239                updateGL(); 
     240                break; 
     241 
    230242  case Qt::Key_W: 
    231243                mWireframe = !mWireframe; 
    232244                updateGL(); 
     245                break; 
     246 
    233247  default: 
    234248                e->ignore(); 
Note: See TracChangeset for help on using the changeset viewer.