Changeset 746


Ignore:
Timestamp:
04/11/06 15:33:37 (18 years ago)
Author:
bittner
Message:

visualization of the render cost and pvs sizes for viewcells

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

Legend:

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

    r744 r746  
    12721272                                        optFloat, 
    12731273                                        "view_cells_filter_width=", 
    1274                                         "10.0"); 
     1274                                        "200.0"); 
    12751275 
    12761276        RegisterOption("ViewCells.loadFromFile", 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r713 r746  
    5454  mWireFrame = false; 
    5555  environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 
    56   mSnapErrorFrames = false; 
    57   mSnapPrefix = ""; 
    58  
     56  mSnapErrorFrames = true; 
     57  mSnapPrefix = "snap/"; 
     58  mUseForcedColors = false; 
    5959} 
    6060 
     
    162162  int i = 0; 
    163163 
    164   if (!mUseFalseColors) 
     164  if (!mUseFalseColors && !mUseForcedColors) 
    165165        SetupMaterial(mesh->mMaterial); 
    166166   
     
    202202        wglGetProcAddress("glGetOcclusionQueryuivNV"); 
    203203 
    204         glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 
    205  
     204 
     205 
     206#if 0 
     207  GLfloat mat_ambient[]   = {  0.5, 0.5, 0.5, 1.0  }; 
     208  /*  mat_specular and mat_shininess are NOT default values     */ 
     209  GLfloat mat_diffuse[]   = {  1.0, 1.0, 1.0, 1.0  }; 
     210  GLfloat mat_specular[]  = {  0.3, 0.3, 0.3, 1.0  }; 
     211  GLfloat mat_shininess[] = {  1.0  }; 
     212   
     213  GLfloat light_ambient[]  = {  0.2, 0.2, 0.2, 1.0  }; 
     214  GLfloat light_diffuse[]  = {  0.4, 0.4, 0.4, 1.0  }; 
     215  GLfloat light_specular[] = {  0.3, 0.3, 0.3, 1.0  }; 
     216   
     217  GLfloat lmodel_ambient[] = {  0.3, 0.3, 0.3, 1.0  }; 
     218   
     219   
     220  // default Material 
     221  glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); 
     222  glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); 
     223  glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); 
     224  glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); 
     225 
     226  // a light 
     227  glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); 
     228  glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 
     229  glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 
     230   
     231  glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); 
     232  glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse); 
     233  glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular); 
     234   
     235  glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 
     236   
     237  glEnable(GL_LIGHTING); 
     238  glEnable(GL_LIGHT0); 
     239  glEnable(GL_LIGHT1); 
     240   
     241   
     242  // set position of the light 
     243  GLfloat infinite_light[] = {  1.0, 0.8, 1.0, 0.0  }; 
     244  glLightfv (GL_LIGHT0, GL_POSITION, infinite_light); 
     245   
     246  // set position of the light2 
     247  GLfloat infinite_light2[] = {  -0.3, 1.5, 1.0, 0.0  }; 
     248  glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 
     249   
     250  glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 
     251  //   glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR); 
     252  glEnable(GL_COLOR_MATERIAL); 
     253   
     254  glShadeModel( GL_FLAT ); 
     255   
     256  glDepthFunc( GL_LESS ); 
     257  glEnable( GL_DEPTH_TEST ); 
     258#endif 
     259 
     260  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); 
     261 
     262  glEnable( GL_NORMALIZE ); 
     263   
     264  glClearColor(0.0f, 0.0f, 1.0f, 1.0f); 
    206265} 
    207266 
     
    213272  if (mViewCellsManager) 
    214273        vc = mViewCellsManager->GetViewCells().size(); 
    215   s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f) viewcells:%04d", 
     274  int filter = 0; 
     275  if (mViewCellsManager) 
     276        filter = mViewCellsManager->GetMaxFilterSize(); 
     277 
     278  s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f) viewcells:%04d filter:%04d pvs:%04d error:%5.5f\%", 
    216279                        mFrame, 
    217280                        mViewPoint.x, 
     
    221284                        mViewDirection.y, 
    222285                        mViewDirection.z, 
    223                         vc 
     286                        vc, 
     287 
     288                        filter, 
     289                        mPvsSize, 
     290                        mRenderError*100.0f 
    224291                        ); 
     292   
     293  glColor3f(0.0f,0.0f,0.0f); 
    225294  renderText(0,20,s); 
     295   
     296  if (mShowRenderCost) { 
     297        static vector<float> costFunction; 
     298        static float maxCost = -1; 
     299        if (costFunction.size()==0) { 
     300          ViewCellsTree *tree = mViewCellsManager->GetViewCellsTree(); 
     301          if (tree) { 
     302                tree->GetCostFunction(costFunction); 
     303                maxCost = -1; 
     304                for (int i=0;  i < costFunction.size(); i++) { 
     305                  //              cout<<i<<":"<<costFunction[i]<<" "; 
     306                  if (costFunction[i] > maxCost) 
     307                        maxCost = costFunction[i]; 
     308                } 
     309          } 
     310        } 
     311 
     312         
     313        int currentPos = mViewCellsManager->GetViewCells().size(); 
     314        float currentCost=-1; 
     315 
     316        if (currentPos < costFunction.size()) 
     317          currentCost = costFunction[currentPos]; 
     318#if 0    
     319        cout<<"costFunction.size()="<<costFunction.size()<<endl; 
     320        cout<<"CP="<<currentPos<<endl; 
     321        cout<<"MC="<<maxCost<<endl; 
     322        cout<<"CC="<<currentCost<<endl; 
     323#endif 
     324        if (costFunction.size()) { 
     325          glDisable(GL_DEPTH_TEST); 
     326          // init ortographic projection 
     327          glMatrixMode(GL_PROJECTION); 
     328          glPushMatrix(); 
     329           
     330          glLoadIdentity(); 
     331          gluOrtho2D(0, 1.0f, 0, 1.0f); 
     332           
     333          glTranslatef(0.1f, 0.1f, 0.0f); 
     334          glScalef(0.8f, 0.8f, 1.0f); 
     335          glMatrixMode(GL_MODELVIEW); 
     336          glLoadIdentity(); 
     337           
     338          glColor3f(1.0f,0,0); 
     339          glBegin(GL_LINE_STRIP); 
     340          //      glVertex3f(0,0,0); 
     341           
     342          for (int i=0;  i < costFunction.size(); i++) { 
     343                float x =  i/(float)costFunction.size(); 
     344                float y = costFunction[i]/(maxCost*0.5f); 
     345                glVertex3f(x,y,0.0f); 
     346          } 
     347          glEnd(); 
     348           
     349          glColor3f(1.0f,0,0); 
     350          glBegin(GL_LINES); 
     351          float x =  currentPos/(float)costFunction.size(); 
     352          glVertex3f(x,0.0,0.0f); 
     353          glVertex3f(x,1.0f,0.0f); 
     354          glEnd(); 
     355           
     356          glColor3f(0.0f,0,0); 
     357          // show a grid 
     358          glBegin(GL_LINE_LOOP); 
     359          glVertex3f(0,0,0.0f); 
     360          glVertex3f(1,0,0.0f); 
     361          glVertex3f(1,1,0.0f); 
     362          glVertex3f(0,1,0.0f); 
     363          glEnd(); 
     364 
     365          glBegin(GL_LINES); 
     366          for (int i=0;  i < 50000 && i < costFunction.size(); i+=10000) { 
     367                float x =  i/(float)costFunction.size(); 
     368                glVertex3f(x,0.0,0.0f); 
     369                glVertex3f(x,1.0f,0.0f); 
     370          } 
     371 
     372          for (int i=0;  i < maxCost; i+=100) { 
     373                float y = i/(maxCost*0.5f); 
     374                glVertex3f(0,y,0.0f); 
     375                glVertex3f(1,y,0.0f); 
     376          } 
     377 
     378          glEnd(); 
     379 
     380           
     381          // restore the projection matrix 
     382          glMatrixMode(GL_PROJECTION); 
     383          glPopMatrix(); 
     384          glMatrixMode(GL_MODELVIEW); 
     385          glEnable(GL_DEPTH_TEST); 
     386 
     387        } 
     388  } 
    226389} 
    227390 
     
    365528 
    366529        glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE); 
    367  
     530         
    368531        // Render PVS 
    369532        std::map<Intersectable *, 
     
    467630} 
    468631 
     632void 
     633GlRendererWidget::RenderPvs() 
     634{ 
     635  SetupCamera(); 
     636  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
     637   
     638  ViewCell *viewcell; 
     639  //  viewcell = mViewCellsManager->GetViewCell(mViewPoint); 
     640 
     641  PrVs prvs; 
     642  //  mViewCellsManager->SetMaxFilterSize(1); 
     643  mViewCellsManager->GetPrVS(mViewPoint, prvs); 
     644  viewcell = prvs.mViewCell; 
     645   
     646  if (viewcell) { 
     647        ObjectPvs &pvs = viewcell->GetPvs(); 
     648 
     649        // read back the texture 
     650        std::map<Intersectable *, 
     651          PvsData<Intersectable *>, 
     652          LtSample<Intersectable *> >::const_iterator it = pvs.mEntries.begin(); 
     653 
     654        mPvsSize = pvs.mEntries.size(); 
     655           
     656        for (; it != pvs.mEntries.end(); ++ it) { 
     657          Intersectable *object = (*it).first; 
     658          float visibility = log10((*it).second.mSumPdf + 1)/5.0f; 
     659          glColor3f(visibility, 0.0f, 0.0f); 
     660          mUseForcedColors = true; 
     661          RenderIntersectable(object); 
     662          mUseForcedColors = false; 
     663        } 
     664 
     665        if (mRenderFilter) { 
     666          mWireFrame = true; 
     667          RenderIntersectable(viewcell); 
     668          mWireFrame = false; 
     669        } 
     670        mViewCellsManager->DeleteLocalMergeTree(viewcell); 
     671  } else { 
     672        ObjectContainer::const_iterator oi = mObjects.begin(); 
     673        for (; oi != mObjects.end(); oi++) 
     674          RenderIntersectable(*oi); 
     675  } 
     676} 
     677 
    469678float 
    470679GlRendererWidget::RenderErrors() 
     
    520729          PvsData<Intersectable *>, 
    521730          LtSample<Intersectable *> >::const_iterator it = viewcell->GetPvs().mEntries.begin(); 
    522          
     731 
     732        mPvsSize = viewcell->GetPvs().mEntries.size(); 
     733 
    523734        for (; it != viewcell->GetPvs().mEntries.end(); ++ it) { 
    524735          Intersectable *object = (*it).first; 
     
    540751                  diff.setPixel(x, y, qRgba(255,128,128,255)); 
    541752                  errorPixels++; 
    542                    
    543753                } 
    544754        pErrorPixels = ((float)errorPixels)/(im1.height()*im1.width()); 
     
    556766  // now render im1 
    557767  if (viewcell) { 
    558         if (1 || mTopView) { 
     768        if (0 && mTopView) { 
    559769          mWireFrame = true; 
    560770          RenderIntersectable(viewcell); 
     
    608818        mViewCellsManager->DeleteLocalMergeTree(viewcell); 
    609819 
     820  mRenderError = pErrorPixels; 
    610821  return pErrorPixels; 
    611822} 
     
    673884          mPvsErrorBuffer[i].mPvsSize = pvsSize; 
    674885 
     886          emit UpdatePvsErrorItem(i, 
     887                                                          mPvsErrorBuffer[i]); 
     888           
    675889          cout<<"("<<i<<","<<mPvsErrorBuffer[i].mError<<")"; 
    676890          //      swapBuffers(); 
     
    762976   
    763977  if (!mRenderViewCells) { 
    764         RenderErrors(); 
     978        if (mRenderErrors) 
     979          RenderErrors(); 
     980        else 
     981          RenderPvs(); 
    765982        RenderInfo(); 
    766983  } else { 
    767984        RenderViewCells(); 
    768  
     985         
    769986        mWireFrame = true; 
    770987        RenderScene(); 
    771988        mWireFrame = false; 
     989         
    772990        RenderInfo(); 
    773991  } 
     
    8541072  vl->addWidget(slider); 
    8551073  slider->show(); 
    856   slider->setRange(1, 200); 
     1074  slider->setRange(1, 10000); 
    8571075  slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 
    8581076  slider->setValue(200); 
     
    8841102  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowViewCells(bool))); 
    8851103 
     1104  cb = new QCheckBox("Show render cost", hbox); 
     1105  hlayout->addWidget(cb); 
     1106  cb->setChecked(false); 
     1107  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRenderCost(bool))); 
     1108 
     1109  cb = new QCheckBox("Show pvs sizes", hbox); 
     1110  hlayout->addWidget(cb); 
     1111  cb->setChecked(false); 
     1112  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool))); 
     1113 
    8861114  vbox->resize(800,100); 
    8871115 
     
    8921120  vl = new QVBoxLayout; 
    8931121  vbox->setLayout(vl); 
    894    
     1122 
     1123 
     1124 
    8951125  slider = new QSlider(Qt::Horizontal, vbox); 
    8961126  vbox->layout()->addWidget(slider); 
     
    9021132  connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetSceneCut(int))); 
    9031133 
     1134  cb = new QCheckBox("Render errors", vbox); 
     1135  vbox->layout()->addWidget(cb); 
     1136  cb->setChecked(true); 
     1137  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderErrors(bool))); 
     1138 
     1139  cb = new QCheckBox("Render filter", vbox); 
     1140  vbox->layout()->addWidget(cb); 
     1141  cb->setChecked(true); 
     1142  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderFilter(bool))); 
    9041143 
    9051144  cb = new QCheckBox("Cut view cells", vbox); 
     
    9221161   
    9231162  connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetTopDistance(int))); 
    924  
    925  
    926  
    9271163   
    9281164  cb = new QCheckBox("Top View", vbox); 
     
    9301166  cb->setChecked(false); 
    9311167  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetTopView(bool))); 
    932    
     1168 
     1169  vbox = new QGroupBox("PVS Errors", this); 
     1170  layout()->addWidget(vbox); 
     1171 
     1172  vl = new QVBoxLayout; 
     1173  vbox->setLayout(vl); 
     1174 
     1175  mPvsErrorWidget = new QListWidget(vbox); 
     1176  vbox->layout()->addWidget(mPvsErrorWidget); 
     1177   
     1178  connect(mPvsErrorWidget, 
     1179                  SIGNAL(doubleClicked(const QModelIndex &)), 
     1180                  this, 
     1181                  SLOT(PvsErrorClicked(const QModelIndex &))); 
     1182   
     1183  QPushButton *button = new QPushButton("Next Error Frame", vbox); 
     1184  vbox->layout()->addWidget(button); 
     1185  connect(button, SIGNAL(clicked(void)), SLOT(FocusNextPvsErrorFrame(void))); 
     1186 
    9331187  setWindowTitle("Preprocessor Control Widget"); 
    9341188  adjustSize(); 
     1189} 
     1190 
     1191 
     1192 
     1193void 
     1194RendererControlWidget::FocusNextPvsErrorFrame(void) 
     1195{ 
     1196   
     1197   
     1198} 
     1199 
     1200void 
     1201RendererControlWidget::UpdatePvsErrorItem(int row, 
     1202                                                                                  GlRendererBuffer::PvsErrorEntry &pvsErrorEntry) 
     1203{ 
     1204 
     1205  QListWidgetItem *i = mPvsErrorWidget->item(row); 
     1206  QString s; 
     1207  s.sprintf("%5.5f", pvsErrorEntry.mError); 
     1208  if (i) { 
     1209        i->setText(s); 
     1210  } else { 
     1211        new QListWidgetItem(s, mPvsErrorWidget); 
     1212  } 
     1213  mPvsErrorWidget->update(); 
    9351214} 
    9361215 
     
    9501229  mCutViewCells = false; 
    9511230  mCutScene = false; 
    952    
    953   RendererControlWidget *cw = new RendererControlWidget(NULL); 
    954   connect(cw, SIGNAL(SetViewCellGranularity(int)), this, SLOT(SetViewCellGranularity(int))); 
    955   connect(cw, SIGNAL(SetSceneCut(int)), this, SLOT(SetSceneCut(int))); 
    956   connect(cw, SIGNAL(SetTopDistance(int)), this, SLOT(SetTopDistance(int))); 
    957  
    958   //connect(cw, SIGNAL(SetViewCellGranularity(int)), this, SLOT(SetMaxFilterSize(int))); 
    959   //  connect(cw, SIGNAL(SetVisibilityFilterSize(int)), this, SLOT(SetVisibilityFilterSize(int))); 
    960   //connect(cw, SIGNAL(SetVisibilityFilterSize(int)), this, SLOT(SetViewCellGranularity(int))); 
    961  
    962   connect(cw, SIGNAL(SetShowViewCells(bool)), this, SLOT(SetShowViewCells(bool))); 
    963   connect(cw, SIGNAL(SetTopView(bool)), this, SLOT(SetTopView(bool))); 
    964   connect(cw, SIGNAL(SetCutViewCells(bool)), this, SLOT(SetCutViewCells(bool))); 
    965   connect(cw, SIGNAL(SetCutScene(bool)), this, SLOT(SetCutScene(bool))); 
    966    
    967   cw->show(); 
     1231  mRenderErrors = true; 
     1232  mRenderFilter = true; 
     1233  mShowRenderCost = false; 
     1234  mShowPvsSizes = false; 
     1235 
     1236  mPvsSize = 0; 
     1237  mRenderError = 0.0f; 
     1238  mControlWidget = new RendererControlWidget(NULL); 
     1239   
     1240  connect(mControlWidget, SIGNAL(SetViewCellGranularity(int)), this, SLOT(SetViewCellGranularity(int))); 
     1241  connect(mControlWidget, SIGNAL(SetSceneCut(int)), this, SLOT(SetSceneCut(int))); 
     1242  connect(mControlWidget, SIGNAL(SetTopDistance(int)), this, SLOT(SetTopDistance(int))); 
     1243 
     1244  connect(mControlWidget, SIGNAL(SetVisibilityFilterSize(int)), this, SLOT(SetVisibilityFilterSize(int))); 
     1245 
     1246  connect(mControlWidget, SIGNAL(SetShowViewCells(bool)), this, SLOT(SetShowViewCells(bool))); 
     1247  connect(mControlWidget, SIGNAL(SetShowRenderCost(bool)), this, SLOT(SetShowRenderCost(bool))); 
     1248  connect(mControlWidget, SIGNAL(SetShowPvsSizes(bool)), this, SLOT(SetShowPvsSizes(bool))); 
     1249  connect(mControlWidget, SIGNAL(SetTopView(bool)), this, SLOT(SetTopView(bool))); 
     1250  connect(mControlWidget, SIGNAL(SetCutViewCells(bool)), this, SLOT(SetCutViewCells(bool))); 
     1251  connect(mControlWidget, SIGNAL(SetCutScene(bool)), this, SLOT(SetCutScene(bool))); 
     1252  connect(mControlWidget, SIGNAL(SetRenderErrors(bool)), this, SLOT(SetRenderErrors(bool))); 
     1253  connect(mControlWidget, SIGNAL(SetRenderFilter(bool)), this, SLOT(SetRenderFilter(bool))); 
     1254 
     1255   
     1256  mControlWidget->show(); 
    9681257} 
    9691258 
     
    9721261{ 
    9731262  if (mViewCellsManager)  
    974         mViewCellsManager->SetMaxFilterSize(number); 
    975   //  mViewCellsManager->CollectViewCells(number); 
     1263        //      mViewCellsManager->SetMaxFilterSize(number); 
     1264    mViewCellsManager->CollectViewCells(number); 
    9761265  updateGL(); 
    9771266} 
     
    10291318  int i; 
    10301319  ViewCellContainer &viewcells = mViewCellsManager->GetViewCells(); 
     1320  int maxPvs = -1; 
     1321  for (i=0; i < viewcells.size(); i++) { 
     1322        ViewCell *vc = viewcells[i]; 
     1323        int p = vc->GetPvs().GetSize(); 
     1324        if (p > maxPvs) 
     1325          maxPvs = p; 
     1326  } 
     1327 
     1328 
    10311329  for (i=0; i < viewcells.size(); i++) { 
    10321330        ViewCell *vc = viewcells[i]; 
    10331331        //      Mesh *m = vc->GetMesh(); 
    1034         RgbColor c = vc->GetColor(); 
     1332 
     1333 
     1334        RgbColor c; 
     1335 
     1336        if (!mShowPvsSizes)  
     1337          c = vc->GetColor(); 
     1338        else { 
     1339          float importance = (float)vc->GetPvs().GetSize() / (float)maxPvs; 
     1340          c = RgbColor(importance, 1.0f - importance, 0.0f); 
     1341        } 
    10351342        glColor3f(c.r, c.g, c.b); 
     1343         
    10361344        RenderViewCell(vc); 
    10371345  } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r713 r746  
    6868  int timerId; 
    6969  bool mUseFalseColors; 
     70  bool mUseForcedColors; 
    7071 
    7172  HaltonSequence halton; 
     
    117118 
    118119 
    119 class GlRendererBuffer : public QGLPixelBuffer, public GlRenderer 
    120 { 
     120class GlRendererBuffer : public QObject, public QGLPixelBuffer,  public GlRenderer 
     121{ 
     122Q_OBJECT 
    121123public: 
    122124        GlRendererBuffer(const int w, 
     
    175177        float mError; 
    176178        int mPvsSize; 
     179        Vector3 mPosition; 
     180        Vector3 mDirection; 
    177181  }; 
    178182   
     
    185189        void SetupProjectionForViewPoint(const Vector3 &viewPoint,  
    186190                                                                         const Beam &beam,  
     191 
    187192                                                                         Intersectable *sourceObject); 
     193 
     194public: 
     195  signals: 
     196        UpdatePvsErrorItem(int i, 
     197                                           GlRendererBuffer::PvsErrorEntry &); 
    188198}; 
    189199 
     
    193203  Q_OBJECT 
    194204public: 
     205 
     206  QListWidget *mPvsErrorWidget; 
     207 
    195208  RendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0); 
     209 
     210  public slots: 
     211 
     212  void FocusNextPvsErrorFrame(); 
     213  void UpdatePvsErrorItem(int i, 
     214                                                  GlRendererBuffer::PvsErrorEntry &); 
    196215 
    197216  signals: 
     
    202221  SetVisibilityFilterSize(int); 
    203222 
     223  SetRenderFilter(bool); 
     224  SetRenderErrors(bool); 
    204225  SetShowViewCells(bool); 
     226  SetShowRenderCost(bool); 
     227  SetShowPvsSizes(bool); 
    205228  SetTopView(bool); 
    206229  SetCutViewCells(bool); 
    207230  SetCutScene(bool); 
    208231 
    209  
     232   
    210233}; 
    211234 
     
    222245  bool mCutViewCells; 
    223246  bool mCutScene; 
    224    
     247  bool mRenderErrors; 
     248  bool mRenderFilter; 
     249  bool mShowRenderCost; 
     250  bool mShowPvsSizes; 
     251 
    225252  Plane3 mSceneCutPlane; 
    226253  float mTopDistance; 
     254 
     255  // some statistics 
     256  int mPvsSize; 
     257  float mRenderError; 
     258 
     259  RendererControlWidget *mControlWidget; 
    227260   
    228261  GlRendererWidget(SceneGraph *sceneGraph, 
     
    249282 
    250283  void keyPressEvent ( QKeyEvent * e ) ; 
    251    
     284 
     285  void 
     286  RenderPvs(); 
     287 
    252288  float 
    253289  RenderErrors(); 
     
    265301 
    266302 public slots: 
    267  void 
    268  SetViewCellGranularity(int number); 
    269  
     303 
     304 void SetRenderErrors(bool b) { 
     305   mRenderErrors = b; 
     306   updateGL(); 
     307 } 
     308 
     309 void SetRenderFilter(bool b) { 
     310   mRenderFilter = b; 
     311   updateGL(); 
     312 } 
     313 
     314   
     315  void 
     316  SetViewCellGranularity(int number); 
     317   
    270318  void 
    271319  SetVisibilityFilterSize(int number); 
    272  
     320   
    273321  void 
    274322  SetSceneCut(int cut); 
     
    281329        updateGL(); 
    282330  } 
    283    
     331 
     332  void SetShowRenderCost(bool b) { 
     333        mShowRenderCost = b; 
     334        updateGL(); 
     335  } 
     336 
     337  void SetShowPvsSizes(bool b) { 
     338        mShowPvsSizes = b; 
     339        updateGL(); 
     340  } 
     341 
    284342  void SetTopView(bool b) { 
    285343        mTopView = b; 
     
    295353        updateGL(); 
    296354  } 
     355 
    297356 
    298357}; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r718 r746  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.0) on: ?t 23. III 21:40:08 2006 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: út 11. IV 11:35:23 2006 
    44# Project:  preprocessor.pro 
    55# Template: app 
     
    6363        $(MAKE) -f $(MAKEFILE).Debug uninstall 
    6464 
    65 Makefile: preprocessor.pro  D:/Qt/4.1.0/mkspecs/win32-msvc.net\qmake.conf D:/Qt/4.1.0/mkspecs/qconfig.pri \ 
    66                 D:\Qt\4.1.0\mkspecs\features\qt_config.prf \ 
    67                 D:\Qt\4.1.0\mkspecs\features\exclusive_builds.prf \ 
    68                 D:\Qt\4.1.0\mkspecs\features\default_pre.prf \ 
    69                 D:\Qt\4.1.0\mkspecs\features\win32\default_pre.prf \ 
    70                 D:\Qt\4.1.0\mkspecs\features\release.prf \ 
    71                 D:\Qt\4.1.0\mkspecs\features\debug_and_release.prf \ 
    72                 D:\Qt\4.1.0\mkspecs\features\default_post.prf \ 
    73                 D:\Qt\4.1.0\mkspecs\features\qt.prf \ 
    74                 D:\Qt\4.1.0\mkspecs\features\win32\opengl.prf \ 
    75                 D:\Qt\4.1.0\mkspecs\features\moc.prf \ 
    76                 D:\Qt\4.1.0\mkspecs\features\win32\thread.prf \ 
    77                 D:\Qt\4.1.0\mkspecs\features\warn_off.prf \ 
    78                 D:\Qt\4.1.0\mkspecs\features\win32\console.prf \ 
    79                 D:\Qt\4.1.0\mkspecs\features\win32\rtti.prf \ 
    80                 D:\Qt\4.1.0\mkspecs\features\win32\exceptions.prf \ 
    81                 D:\Qt\4.1.0\mkspecs\features\win32\stl.prf \ 
    82                 D:\Qt\4.1.0\mkspecs\features\shared.prf \ 
    83                 D:\Qt\4.1.0\mkspecs\features\resources.prf \ 
    84                 D:\Qt\4.1.0\mkspecs\features\uic.prf 
     65Makefile: preprocessor.pro  C:/Qt/4.1.2/mkspecs/win32-msvc.net\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \ 
     66                C:\Qt\4.1.2\mkspecs\features\qt_config.prf \ 
     67                C:\Qt\4.1.2\mkspecs\features\exclusive_builds.prf \ 
     68                C:\Qt\4.1.2\mkspecs\features\default_pre.prf \ 
     69                C:\Qt\4.1.2\mkspecs\features\win32\default_pre.prf \ 
     70                C:\Qt\4.1.2\mkspecs\features\release.prf \ 
     71                C:\Qt\4.1.2\mkspecs\features\debug_and_release.prf \ 
     72                C:\Qt\4.1.2\mkspecs\features\default_post.prf \ 
     73                C:\Qt\4.1.2\mkspecs\features\qt.prf \ 
     74                C:\Qt\4.1.2\mkspecs\features\win32\opengl.prf \ 
     75                C:\Qt\4.1.2\mkspecs\features\moc.prf \ 
     76                C:\Qt\4.1.2\mkspecs\features\win32\thread.prf \ 
     77                C:\Qt\4.1.2\mkspecs\features\warn_off.prf \ 
     78                C:\Qt\4.1.2\mkspecs\features\win32\console.prf \ 
     79                C:\Qt\4.1.2\mkspecs\features\win32\rtti.prf \ 
     80                C:\Qt\4.1.2\mkspecs\features\win32\exceptions.prf \ 
     81                C:\Qt\4.1.2\mkspecs\features\win32\stl.prf \ 
     82                C:\Qt\4.1.2\mkspecs\features\shared.prf \ 
     83                C:\Qt\4.1.2\mkspecs\features\resources.prf \ 
     84                C:\Qt\4.1.2\mkspecs\features\uic.prf 
    8585        $(QMAKE) -win32 -o Makefile preprocessor.pro 
    86 D:/Qt/4.1.0/mkspecs/qconfig.pri: 
    87 D:\Qt\4.1.0\mkspecs\features\qt_config.prf: 
    88 D:\Qt\4.1.0\mkspecs\features\exclusive_builds.prf: 
    89 D:\Qt\4.1.0\mkspecs\features\default_pre.prf: 
    90 D:\Qt\4.1.0\mkspecs\features\win32\default_pre.prf: 
    91 D:\Qt\4.1.0\mkspecs\features\release.prf: 
    92 D:\Qt\4.1.0\mkspecs\features\debug_and_release.prf: 
    93 D:\Qt\4.1.0\mkspecs\features\default_post.prf: 
    94 D:\Qt\4.1.0\mkspecs\features\qt.prf: 
    95 D:\Qt\4.1.0\mkspecs\features\win32\opengl.prf: 
    96 D:\Qt\4.1.0\mkspecs\features\moc.prf: 
    97 D:\Qt\4.1.0\mkspecs\features\win32\thread.prf: 
    98 D:\Qt\4.1.0\mkspecs\features\warn_off.prf: 
    99 D:\Qt\4.1.0\mkspecs\features\win32\console.prf: 
    100 D:\Qt\4.1.0\mkspecs\features\win32\rtti.prf: 
    101 D:\Qt\4.1.0\mkspecs\features\win32\exceptions.prf: 
    102 D:\Qt\4.1.0\mkspecs\features\win32\stl.prf: 
    103 D:\Qt\4.1.0\mkspecs\features\shared.prf: 
    104 D:\Qt\4.1.0\mkspecs\features\resources.prf: 
    105 D:\Qt\4.1.0\mkspecs\features\uic.prf: 
     86C:/Qt/4.1.2/mkspecs/qconfig.pri: 
     87C:\Qt\4.1.2\mkspecs\features\qt_config.prf: 
     88C:\Qt\4.1.2\mkspecs\features\exclusive_builds.prf: 
     89C:\Qt\4.1.2\mkspecs\features\default_pre.prf: 
     90C:\Qt\4.1.2\mkspecs\features\win32\default_pre.prf: 
     91C:\Qt\4.1.2\mkspecs\features\release.prf: 
     92C:\Qt\4.1.2\mkspecs\features\debug_and_release.prf: 
     93C:\Qt\4.1.2\mkspecs\features\default_post.prf: 
     94C:\Qt\4.1.2\mkspecs\features\qt.prf: 
     95C:\Qt\4.1.2\mkspecs\features\win32\opengl.prf: 
     96C:\Qt\4.1.2\mkspecs\features\moc.prf: 
     97C:\Qt\4.1.2\mkspecs\features\win32\thread.prf: 
     98C:\Qt\4.1.2\mkspecs\features\warn_off.prf: 
     99C:\Qt\4.1.2\mkspecs\features\win32\console.prf: 
     100C:\Qt\4.1.2\mkspecs\features\win32\rtti.prf: 
     101C:\Qt\4.1.2\mkspecs\features\win32\exceptions.prf: 
     102C:\Qt\4.1.2\mkspecs\features\win32\stl.prf: 
     103C:\Qt\4.1.2\mkspecs\features\shared.prf: 
     104C:\Qt\4.1.2\mkspecs\features\resources.prf: 
     105C:\Qt\4.1.2\mkspecs\features\uic.prf: 
    106106qmake: qmake_all FORCE 
    107107        @$(QMAKE) -win32 -o Makefile preprocessor.pro 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r712 r746  
    242242                renderer = new GlRendererBuffer(1024, 768, mSceneGraph, mViewCellsManager, mKdTree); 
    243243                //              renderer->makeCurrent(); 
     244                 
    244245        } 
    245246         
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r685 r746  
    161161  bool mComputeVisibility; 
    162162 
     163  GlRendererBuffer *GetRenderer() { return renderer;} 
     164   
    163165protected: 
    164166 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp

    r718 r746  
    559559        Debug<<"Valid viewcells before set validity: "<<mViewCellsManager->CountValidViewcells()<<endl; 
    560560        // cull viewcells with PVS > median (0.5f) 
    561         //      mViewCellsManager->SetValidityPercentage(0, 0.5f);  
     561        mViewCellsManager->SetValidityPercentage(0, 0.5f);  
    562562        Debug<<"Valid viewcells after set validity: "<<mViewCellsManager->CountValidViewcells()<<endl; 
    563563         
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r744 r746  
    18131813        if (!vc->IsLeaf()) {     
    18141814          ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 
    1815           costFunction.push_back(interior->GetCost()); 
     1815          costFunction.push_back(interior->GetMergeCost()); 
    18161816           
    18171817          ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r736 r746  
    327327        /** Get costs resulting from each merge step. */ 
    328328        void GetCostFunction(vector<float> &costFunction); 
     329 
    329330   
    330331        /** Returns optimal set of view cells for a given number of view cells. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r744 r746  
    10441044                                                                                                const float width) const 
    10451045{ 
    1046         Vector3 min = viewPoint - width * 0.5f; 
    1047         Vector3 max = viewPoint + width * 0.5; 
    1048  
    1049         return AxisAlignedBox3(min, max); 
     1046  float w = Magnitude(mViewSpaceBox.Size())*width; 
     1047  Vector3 min = viewPoint - w * 0.5f; 
     1048  Vector3 max = viewPoint + w * 0.5f; 
     1049   
     1050  return AxisAlignedBox3(min, max); 
    10501051} 
    10511052 
     
    10531054void ViewCellsManager::GetPrVS(const Vector3 &viewPoint, PrVs &prvs) 
    10541055{ 
    1055         const AxisAlignedBox3 box = GetFilterBBox(viewPoint, mFilterWidth); 
    1056  
    1057         ViewCell *currentViewCell = GetViewCell(viewPoint); 
    1058  
     1056  const AxisAlignedBox3 box = GetFilterBBox(viewPoint, mFilterWidth); 
     1057         
     1058  ViewCell *currentViewCell = GetViewCell(viewPoint); 
     1059 
     1060  if (currentViewCell) { 
    10591061        ViewCellContainer viewCells; 
    10601062        ComputeBoxIntersections(box, viewCells); 
    1061  
     1063         
    10621064        ViewCell *root = ConstructLocalMergeTree2(currentViewCell, viewCells); 
    1063  
    10641065        prvs.mViewCell = root; 
    1065         //prvs.mPvs = root->GetPvs(); 
     1066  } else 
     1067        prvs.mViewCell = NULL; 
     1068  //prvs.mPvs = root->GetPvs(); 
    10661069} 
    10671070 
     
    45194522        Vector3 bsize = mViewSpaceBox.Size(); 
    45204523        const Vector3 viewPoint(mViewSpaceBox.Center()); 
    4521         const Vector3 width = Vector3(mFilterWidth); 
     4524        float w = Magnitude(mViewSpaceBox.Size())*mFilterWidth; 
     4525        const Vector3 width = Vector3(w); 
    45224526         
    45234527        PrVs testPrVs; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r735 r746  
    397397        void SetMaxFilterSize(const int size); 
    398398 
    399         /** Deletes interior nodes from the tree which have negative merge cost set (local merge)  
    400         */ 
    401         void DeleteLocalMergeTree(ViewCell *vc) const; 
     399  int GetMaxFilterSize() { 
     400        return mMaxFilterSize; 
     401  } 
     402 
     403  /** deletes interior nodes from the tree which have negative merge cost set (local merge) */ 
     404  void 
     405  DeleteLocalMergeTree(ViewCell *vc 
     406                                           ) const; 
    402407   
    403408        /** Evaluautes histogram for a given number of view cells. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r718 r746  
    1010# filename ../data/vienna/vienna-simple.x3d 
    1111#filename ../data/vienna/vienna-buildings.x3d 
    12 #filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d 
    13 #;../data/vienna/vienna-plane.x3d 
     12#filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-plane.x3d;../data/vienna/vienna-roads.x3d 
    1413# filename ../data/vienna/viewcells-25-sel.x3d 
    15 #filename ../data/atlanta/atlanta2.x3d 
     14filename ../data/atlanta/atlanta2.x3d 
    1615#filename ../data/soda/soda.dat 
    17 filename ../data/soda/soda5.dat 
     16#filename ../data/soda/soda5.dat 
    1817} 
    1918 
     
    2524#       type vss 
    2625        type rss 
    27         detectEmptyViewSpace true 
    28         pvsRenderErrorSamples 5000 
    29 #       pvsRenderErrorSamples 1000 
     26        detectEmptyViewSpace false 
     27#       pvsRenderErrorSamples 1 
     28        pvsRenderErrorSamples 1000 
    3029        quitOnFinish true 
    3130        computeVisibility true 
     
    3635        samplesPerPass  100000 
    3736        initialSamples 500000 
    38         vssSamples 2000000 
     37        vssSamples 1000000 
    3938        vssSamplesPerPass 200000 
    4039        useImportanceSampling true 
     
    7877        samplesPerPass 500000 
    7978        initialSamples 500000 
    80         vssSamples 20000000 
     79        vssSamples 30000000 
    8180        vssSamplesPerPass 1000000 
    82         useImportanceSampling true 
    83  
    84         directionalSampling true 
     81        useImportanceSampling false 
     82 
     83        directionalSampling false 
    8584        objectBasedSampling false 
    8685 
     
    8887                pvs false 
    8988                rssTree false 
    90                 rays true 
     89                rays false 
    9190                numRays 5000 
    9291        } 
     
    104103 
    105104        maxDepth        40 
    106         minPvs          1 
    107         minRays         50 
     105        minPvs          3 
     106# before vienna test it was: 
     107#       minRays 50 
     108#       splitType heuristic 
     109 
     110        minRays         100 
    108111        minSize         0.001 
    109112        maxCostRatio 1.0 
     
    113116        maxStaticMemory 100 
    114117 
    115 #       splitType regular 
     118        splitType regular 
    116119#       splitType heuristic 
    117         splitType hybrid 
     120#       splitType hybrid 
    118121        splitUseOnlyDrivingAxis false 
    119122        importanceBasedCost false 
     
    178181 
    179182        Filter { 
    180                 maxSize 20 
    181                 width  200.0 
     183                maxSize 5 
     184                width  0.05 
    182185        } 
    183186 
    184187        #number of active view cells 
    185         active 4000 
     188        active 15000 
    186189        maxStaticMemory 40 
    187190 
     
    255258#       filename ../data/soda/soda5-viewcells.xml 
    256259#       filename ../scripts/viewcells_atlanta.xml 
    257         filename ../data/soda/soda5-viewcells2.xml 
     260#       filename ../data/soda/soda5-viewcells2.xml 
     261        filename ../data/atlanta/viewcells_atlanta3.xml 
     262#       filename ../data/vienna/viewcells_vienna.xml 
    258263} 
    259264 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r693 r746  
    109109        rendererWidget->resize(640, 480); 
    110110        rendererWidget->show(); 
     111 
     112        if (p->GetRenderer()) { 
     113 
     114          cout<<"CONNECTING"<<endl; 
     115          QObject::connect(p->GetRenderer(), 
     116                                           SIGNAL(UpdatePvsErrorItem(int i, 
     117                                                                                                 GlRendererBuffer::PvsErrorEntry &)), 
     118                                           rendererWidget->mControlWidget, 
     119                                           SLOT(UpdatePvsErrorItem(int i, 
     120                                                                                           GlRendererBuffer::PvsErrorEntry &))); 
     121          cout<<"CONNECTED"<<endl; 
     122        } 
     123         
    111124        pt->start(QThread::LowPriority); 
     125         
     126         
    112127  } else{ 
    113128        // just call the mail method -> will be executed in the main thread 
Note: See TracChangeset for help on using the changeset viewer.