Ignore:
Timestamp:
01/10/08 02:43:33 (16 years ago)
Author:
mattausch
Message:

worked on ray viz

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
5 edited

Legend:

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

    r2586 r2587  
    1313#include "BvHierarchy.h" 
    1414#include "KdTree.h" 
     15#include "SamplingStrategy.h" 
     16 
    1517 
    1618#ifdef USE_CG 
     
    200202 
    201203 
    202 void GlRenderer::RenderRays(const VssRayContainer &rays) 
     204void GlRenderer::RenderRays(const VssRayContainer &rays, int colorType) 
    203205{ 
    204206        VssRayContainer::const_iterator it = rays.begin(), it_end = rays.end(); 
     
    206208        glBegin(GL_LINES); 
    207209         
     210        float importance; 
     211 
    208212        for (; it != it_end; ++it)  
    209213        { 
    210214                VssRay *ray = *it; 
    211                 const float importance = log10(1e3*ray->mWeightedPvsContribution)/3.0f; 
    212                  
    213                 //glColor3f(1.0f, 0.0f, 0.0f); 
    214                 glColor3f(importance, importance, importance); 
     215 
     216                switch (colorType) 
     217                { 
     218                case 0: 
     219                        glColor3f(1.0f, 0.0f, 0.0f); 
     220                        break; 
     221 
     222                case 1: 
     223                        importance = 1.0f * ray->Length() /  Magnitude(mViewCellsManager->GetViewSpaceBox().Diagonal()); 
     224                        glColor3f(importance, importance, importance); 
     225                        break; 
     226 
     227                case 2: 
     228                        importance = log10(1e3 * ray->mPvsContribution) / 3.0f; 
     229                        glColor3f(importance, importance, importance); 
     230                        break; 
     231 
     232                case 3: 
     233                        { 
     234                                // nested switches ok? 
     235                                switch (ray->mDistribution) 
     236                                { 
     237                                case SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION: 
     238                                        glColor3f(1, 0, 0); 
     239                                        break; 
     240                                case SamplingStrategy::MUTATION_BASED_DISTRIBUTION: 
     241                                        glColor3f(0, 1, 0); 
     242                                        break; 
     243                                case SamplingStrategy::DIRECTION_BASED_DISTRIBUTION: 
     244                                        glColor3f(0, 1, 1); 
     245                                        break; 
     246                                        case SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION: 
     247                                        glColor3f(1, 1, 0); 
     248                                        break; 
     249                                } 
     250                        } 
     251                }                
     252 
    215253                glVertex3fv(&ray->mOrigin.x); 
    216254                glVertex3fv(&ray->mTermination.x); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r2543 r2587  
    129129 
    130130  void 
    131   RenderRays(const VssRayContainer &rays); 
     131  RenderRays(const VssRayContainer &rays, int colorType = 0); 
    132132 
    133133  void 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r2584 r2587  
    411411                        <File 
    412412                                RelativePath=".\HashPvs.h"> 
     413                        </File> 
     414                        <File 
     415                                RelativePath=".\HavranRayCaster.cpp"> 
     416                        </File> 
     417                        <File 
     418                                RelativePath=".\HavranRayCaster.h"> 
    413419                        </File> 
    414420                        <File 
     
    10531059                        </File> 
    10541060                        <File 
     1061                                RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
     1062                        </File> 
     1063                        <File 
    10551064                                RelativePath=".\sparsehash\src\windows\hash_fun.h"> 
    10561065                        </File> 
    10571066                        <File 
    1058                                 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
    1059                         </File> 
    1060                         <File 
    10611067                                RelativePath=".\sparsehash\src\windows\hash_map.h"> 
    10621068                        </File> 
     
    10751081                        <File 
    10761082                                RelativePath=".\sparsehash\src\windows\stl_hash_fun.h"> 
     1083                        </File> 
     1084                </Filter> 
     1085                <Filter 
     1086                        Name="havran" 
     1087                        Filter=""> 
     1088                        <File 
     1089                                RelativePath=".\havran\allocgo2.cpp"> 
     1090                        </File> 
     1091                        <File 
     1092                                RelativePath=".\havran\allocgo2.h"> 
     1093                        </File> 
     1094                        <File 
     1095                                RelativePath=".\havran\configh.h"> 
     1096                        </File> 
     1097                        <File 
     1098                                RelativePath=".\havran\ktb.cpp"> 
     1099                        </File> 
     1100                        <File 
     1101                                RelativePath=".\havran\ktb.h"> 
     1102                        </File> 
     1103                        <File 
     1104                                RelativePath=".\havran\ktb8b.cpp"> 
     1105                        </File> 
     1106                        <File 
     1107                                RelativePath=".\havran\ktb8b.h"> 
     1108                        </File> 
     1109                        <File 
     1110                                RelativePath=".\havran\ktbai.cpp"> 
     1111                        </File> 
     1112                        <File 
     1113                                RelativePath=".\havran\ktbai.h"> 
     1114                        </File> 
     1115                        <File 
     1116                                RelativePath=".\havran\ktball.cpp"> 
     1117                        </File> 
     1118                        <File 
     1119                                RelativePath=".\havran\ktball.h"> 
     1120                        </File> 
     1121                        <File 
     1122                                RelativePath=".\havran\ktbconf.h"> 
     1123                        </File> 
     1124                        <File 
     1125                                RelativePath=".\havran\ktbftrav.cpp"> 
     1126                        </File> 
     1127                        <File 
     1128                                RelativePath=".\havran\ktbtrav.cpp"> 
     1129                        </File> 
     1130                        <File 
     1131                                RelativePath=".\havran\ktbtrav.h"> 
     1132                        </File> 
     1133                        <File 
     1134                                RelativePath=".\havran\raypack.h"> 
     1135                        </File> 
     1136                        <File 
     1137                                RelativePath=".\havran\sbbox.cpp"> 
     1138                        </File> 
     1139                        <File 
     1140                                RelativePath=".\havran\sbbox.h"> 
     1141                        </File> 
     1142                        <File 
     1143                                RelativePath=".\havran\subdivm.h"> 
     1144                        </File> 
     1145                        <File 
     1146                                RelativePath=".\havran\timer.cpp"> 
     1147                        </File> 
     1148                        <File 
     1149                                RelativePath=".\havran\timer.h"> 
    10771150                        </File> 
    10781151                </Filter> 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2584 r2587  
    717717                if (1 && mShowRays)  
    718718                { 
    719                         RenderRays(mViewCellsManager->mVizBuffer.GetRays()); 
     719                        RenderRays(mViewCellsManager->mVizBuffer.GetRays(), mRayVisualizationMethod); 
    720720                } 
    721721        } 
     
    880880        mSpatialFilterSize = 0.01; 
    881881        mPvsSize = 0; 
     882        mRayVisualizationMethod = 0; 
    882883        mRenderError = 0.0f; 
    883884        mShowRays = false; 
     
    925926        connect(mControlWidget, SIGNAL(SetShowWeightedTriangles(bool)), this, SLOT(SetShowWeightedTriangles(bool))); 
    926927 
     928        connect(mControlWidget, SIGNAL(UseConstColorForRayViz(bool)), this, SLOT(UseConstColorForRayViz(bool))); 
     929        connect(mControlWidget, SIGNAL(UseRayLengthForRayViz(bool)), this, SLOT(UseRayLengthForRayViz(bool))); 
     930        connect(mControlWidget, SIGNAL(SetShowContribution(bool)), this, SLOT(SetShowContribution(bool))); 
     931        connect(mControlWidget, SIGNAL(SetShowDistribution(bool)), this, SLOT(SetShowDistribution(bool))); 
     932 
     933 
    927934        connect(mControlWidget, 
    928935                SIGNAL(SetShowRays(bool)), 
     
    15431550        QRadioButton *rb1, *rb2, *rb3, *rb4, *rb5; 
    15441551         
     1552        rb1 = new QRadioButton("wireframe", parent); 
     1553        rb1->setText("wireframe"); 
     1554        connect(rb1, SIGNAL(toggled(bool)), SIGNAL(SetShowWireFrame(bool))); 
     1555 
    15451556        // Create a check box to be in the group box 
    1546         rb1 = new QRadioButton("piercing rays", parent); 
    1547         rb1->setText("piercing rays"); 
     1557        rb2 = new QRadioButton("piercing rays", parent); 
     1558        rb2->setText("piercing rays"); 
    15481559        //vl->addWidget(rb1); 
    1549         connect(rb1, SIGNAL(toggled(bool)), SIGNAL(SetShowPiercingRays(bool))); 
    1550  
    1551         rb2 = new QRadioButton("pvs size", parent); 
    1552         rb2->setText("pvs size"); 
    1553         connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool))); 
    1554  
    1555         rb3 = new QRadioButton("wireframe", parent); 
    1556         rb3->setText("wireframe"); 
     1560        connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowPiercingRays(bool))); 
     1561 
     1562        rb3 = new QRadioButton("pvs size", parent); 
     1563        rb3->setText("pvs size"); 
     1564        connect(rb3, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool))); 
    15571565         
    15581566        rb4 = new QRadioButton("weighted rays", parent); 
     
    15651573 
    15661574        QGroupBox *groupBox = new QGroupBox("Visualization options"); 
    1567  
    1568         QVBoxLayout *vbox2 = new QVBoxLayout; 
    1569      
    1570         vbox2->addWidget(rb3); 
    1571         vbox2->addWidget(rb1); 
    1572         vbox2->addWidget(rb2); 
    1573         vbox2->addWidget(rb4); 
    1574         vbox2->addWidget(rb5); 
    1575          
    1576         rb3->setChecked(true); 
    1577  
    1578         vbox2->addStretch(1); 
    1579         groupBox->setLayout(vbox2); 
    1580  
    1581         return groupBox; 
    1582 } 
    1583  
    1584  
    1585  
    1586 QGroupBox *QtRendererControlWidget::CreateRenderCostPanel(QWidget *parent) 
    1587 { 
    1588         QRadioButton *rb1, *rb2, *rb3; 
    1589          
    1590         // Create a check box to be in the group box 
    1591         rb1 = new QRadioButton("triangles", parent); 
    1592         rb1->setText("triangles"); 
    1593         //vl->addWidget(rb1); 
    1594         connect(rb1, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedTriangles(bool))); 
    1595  
    1596         rb2 = new QRadioButton("distance weighted pvs", parent); 
    1597         rb2->setText("distance weighted"); 
    1598         connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowDistanceWeightedPvs(bool))); 
    1599  
    1600         rb3 = new QRadioButton("distance weighted triangles", parent); 
    1601         rb3->setText("distance weighted triangles"); 
    1602         connect(rb3, SIGNAL(toggled(bool)), SIGNAL(SetShowDistanceWeightedTriangles(bool))); 
    1603  
    1604         QGroupBox *groupBox = new QGroupBox("Render cost options"); 
    16051575 
    16061576        QVBoxLayout *vbox2 = new QVBoxLayout; 
     
    16091579        vbox2->addWidget(rb2); 
    16101580        vbox2->addWidget(rb3); 
    1611          
    1612         rb2->setChecked(true); 
     1581        vbox2->addWidget(rb4); 
     1582        vbox2->addWidget(rb5); 
     1583         
     1584        rb1->setChecked(true); 
     1585 
     1586        vbox2->addStretch(1); 
     1587        groupBox->setLayout(vbox2); 
     1588 
     1589        return groupBox; 
     1590} 
     1591 
     1592 
     1593 
     1594QGroupBox *QtRendererControlWidget::CreateRenderCostPanel(QWidget *parent) 
     1595{ 
     1596        QRadioButton *rb1, *rb2, *rb3; 
     1597         
     1598        // Create a check box to be in the group box 
     1599        rb1 = new QRadioButton("triangles", parent); 
     1600        rb1->setText("triangles"); 
     1601        connect(rb1, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedTriangles(bool))); 
     1602 
     1603        rb2 = new QRadioButton("distance weighted pvs", parent); 
     1604        rb2->setText("distance weighted"); 
     1605        connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowDistanceWeightedPvs(bool))); 
     1606 
     1607        rb3 = new QRadioButton("distance weighted triangles", parent); 
     1608        rb3->setText("distance weighted triangles"); 
     1609        connect(rb3, SIGNAL(toggled(bool)), SIGNAL(SetShowDistanceWeightedTriangles(bool))); 
     1610 
     1611        QGroupBox *groupBox = new QGroupBox("Render cost options"); 
     1612 
     1613        QVBoxLayout *vbox2 = new QVBoxLayout; 
     1614     
     1615        vbox2->addWidget(rb1); 
     1616        vbox2->addWidget(rb2); 
     1617        vbox2->addWidget(rb3); 
     1618         
     1619        rb1->setChecked(true); 
     1620 
     1621        vbox2->addStretch(1); 
     1622        groupBox->setLayout(vbox2); 
     1623 
     1624        return groupBox; 
     1625} 
     1626 
     1627 
     1628QGroupBox *QtRendererControlWidget::CreateRayVisualizationPanel(QWidget *parent) 
     1629{ 
     1630        QRadioButton *rb1, *rb2, *rb3, *rb4; 
     1631         
     1632        // Create a check box to be in the group box 
     1633        rb1 = new QRadioButton("const color", parent); 
     1634        rb1->setText("const color"); 
     1635        //vl->addWidget(rb1); 
     1636        connect(rb1, SIGNAL(toggled(bool)), SIGNAL(UseConstColorForRayViz(bool))); 
     1637 
     1638        rb2 = new QRadioButton("ray length", parent); 
     1639        rb2->setText("ray length"); 
     1640        connect(rb2, SIGNAL(toggled(bool)), SIGNAL(UseRayLengthForRayViz(bool))); 
     1641         
     1642        rb3 = new QRadioButton("contribution", parent); 
     1643        rb3->setText("contribution"); 
     1644        connect(rb3, SIGNAL(toggled(bool)), SIGNAL(SetShowContribution(bool))); 
     1645         
     1646        rb4 = new QRadioButton("distribution", parent); 
     1647        rb4->setText("distribution"); 
     1648        connect(rb4, SIGNAL(toggled(bool)), SIGNAL(SetShowDistribution(bool))); 
     1649 
     1650        QGroupBox *groupBox = new QGroupBox("Ray visualization options"); 
     1651        QVBoxLayout *vbox2 = new QVBoxLayout; 
     1652     
     1653        vbox2->addWidget(rb1); 
     1654        vbox2->addWidget(rb2); 
     1655        vbox2->addWidget(rb3); 
     1656        vbox2->addWidget(rb4); 
     1657         
     1658        rb1->setChecked(true); 
    16131659 
    16141660        vbox2->addStretch(1); 
     
    17401786        QGroupBox *groupBox2 = CreateRenderCostPanel(hbox); 
    17411787        vh->addWidget(groupBox2, 0, 0); 
     1788 
     1789         
     1790        QGroupBox *groupBox3 = CreateRayVisualizationPanel(hbox); 
     1791        vh->addWidget(groupBox3, 0, 0); 
    17421792 
    17431793        ////////////////////////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2584 r2587  
    9898   
    9999  QGroupBox *CreateRenderCostPanel(QWidget *parent); 
     100  QGroupBox *CreateRayVisualizationPanel(QWidget *parent); 
    100101 
    101102 
     
    141142  void SetShowWeightedTriangles(bool); 
    142143  void SetShowDistanceWeightedPvs(bool); 
     144 
     145  void UseConstColorForRayViz(bool); 
     146  void UseRayLengthForRayViz(bool); 
     147  void SetShowContribution(bool); 
     148  void SetShowDistribution(bool); 
    143149}; 
    144150 
     
    195201        Vector3 mDummyViewPoint; 
    196202 
     203        int mRayVisualizationMethod; 
     204 
    197205        QtRendererControlWidget *mControlWidget; 
    198206 
     
    430438                mShowWeightedTriangles = b; 
    431439                updateGL(); 
     440        } 
     441 
     442        void UseConstColorForRayViz(bool b) 
     443        { 
     444                mRayVisualizationMethod = 0; 
     445        } 
     446     
     447        void UseRayLengthForRayViz(bool b) 
     448        { 
     449                mRayVisualizationMethod = 1; 
     450        } 
     451 
     452        void SetShowContribution(bool b) 
     453        { 
     454                mRayVisualizationMethod = 2; 
     455        } 
     456     
     457        void SetShowDistribution(bool b) 
     458        { 
     459                mRayVisualizationMethod = 3; 
    432460        } 
    433461 
Note: See TracChangeset for help on using the changeset viewer.