Changeset 1581


Ignore:
Timestamp:
10/07/06 22:54:13 (18 years ago)
Author:
bittner
Message:

Qtglwidget changes - second view + trackball - ray casting seems not functional

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
2 added
18 edited

Legend:

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

    r1486 r1581  
    302302  const float dirEps = 1e-8f; 
    303303  register float minx, maxx; 
    304   ray.ComputeInvertedDir(); 
    305304   
    306305  if (fabs(ray.dir.x) < dirEps) { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r1146 r1581  
    1010#include "KdTree.h" 
    1111#include "Environment.h" 
     12#include "Triangle3.h" 
     13#include "IntersectableWrapper.h" 
    1214 
    1315//#include <Cg/cg.h> 
     
    9294 
    9395void 
     96GlRenderer::RenderTriangle(TriangleIntersectable *object) 
     97{ 
     98  Triangle3 &t = object->GetItem(); 
     99  glBegin(GL_TRIANGLES); 
     100  glVertex3f(t.mVertices[0].x, t.mVertices[0].y, t.mVertices[0].z); 
     101  glVertex3f(t.mVertices[1].x, t.mVertices[1].y, t.mVertices[1].z); 
     102  glVertex3f(t.mVertices[2].x, t.mVertices[2].y, t.mVertices[2].z); 
     103  glEnd(); 
     104} 
     105 
     106void 
    94107GlRenderer::RenderIntersectable(Intersectable *object) 
    95108{ 
     
    105118        break; 
    106119  case Intersectable::VIEW_CELL: 
    107           RenderViewCell(dynamic_cast<ViewCell *>(object)); 
    108           break; 
     120        RenderViewCell(dynamic_cast<ViewCell *>(object)); 
     121        break; 
    109122  case Intersectable::TRANSFORMED_MESH_INSTANCE: 
    110           RenderTransformedMeshInstance(dynamic_cast<TransformedMeshInstance *>(object)); 
    111           break; 
     123        RenderTransformedMeshInstance(dynamic_cast<TransformedMeshInstance *>(object)); 
     124        break; 
     125  case Intersectable::TRIANGLE_INTERSECTABLE: 
     126        RenderTriangle(dynamic_cast<TriangleIntersectable *>(object)); 
     127        break; 
    112128  default: 
    113129        cerr<<"Rendering this object not yet implemented\n"; 
     
    118134} 
    119135 
     136void 
     137GlRenderer::RenderRays(const VssRayContainer &rays) 
     138{ 
     139  VssRayContainer::const_iterator it = rays.begin(), it_end = rays.end(); 
     140 
     141  glBegin(GL_LINES); 
     142  for (; it != it_end; ++it) { 
     143        VssRay *ray = *it; 
     144        float importance = log10(1e3*ray->mWeightedPvsContribution)/3.0f; 
     145        //      cout<<"w="<<ray->mWeightedPvsContribution<<" r="<<ray->mWeightedPvsContribution; 
     146        glColor3f(importance, importance, importance); 
     147        glVertex3fv(&ray->mOrigin.x); 
     148        glVertex3fv(&ray->mTermination.x); 
     149  } 
     150  glEnd(); 
     151} 
    120152 
    121153void 
     
    310342  glMatrixMode(GL_MODELVIEW); 
    311343} 
     344 
     345 
    312346 
    313347void 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r1387 r1581  
    2424class OcclusionQuery; 
    2525class TransformedMeshInstance; 
     26class TriangleIntersectable; 
    2627 
    2728struct VssRayContainer; 
     
    99100  void SetupMaterial(Material *m); 
    100101  virtual void SetupCamera(); 
    101    
     102 
     103  void 
     104  RenderRays(const VssRayContainer &rays); 
     105 
     106  void 
     107  RenderTriangle(TriangleIntersectable *object); 
     108 
    102109  bool 
    103110  RenderScene(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h

    r1344 r1581  
    3131        */ 
    3232        T GetItem() const; 
    33  
    3433        /** See get. 
    3534        */ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r1579 r1581  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.2) on: pá 6. X 16:24:14 2006 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: so 7. X 21:56:30 2006 
    44# Project:  preprocessor.pro 
    55# Template: app 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1570 r1581  
    428428        if (mLoadViewCells) 
    429429        {        
    430                 Environment::GetSingleton()->GetStringValue("ViewCells.filename", buf); 
    431                 cout << "loading view cells from " << buf << endl; 
    432                  
    433                 mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, true); 
    434  
    435                 if (!mViewCellsManager) 
    436                         return false; 
     430          Environment::GetSingleton()->GetStringValue("ViewCells.filename", buf); 
     431          cout << "loading view cells from " << buf << endl; 
     432           
     433          mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, true); 
     434           
     435          if (!mViewCellsManager) 
     436                return false; 
    437437        } 
    438438        else 
     
    488488 
    489489        mViewCellsManager->SetRenderer(mRenderSimulator); 
    490  
     490         
    491491        if (mUseGlRenderer || mUseGlDebugger) 
    492         { 
     492          { 
    493493                // NOTE: render texture should be power of 2 and square 
    494494                // renderer must be initialised 
    495495                // $$matt 
    496 //              renderer = new GlRendererBuffer(1024, 768, mSceneGraph, mViewCellsManager, mKdTree); 
     496                //              renderer = new GlRendererBuffer(1024, 768, mSceneGraph, mViewCellsManager, mKdTree); 
    497497                //              renderer->makeCurrent(); 
    498498                 
    499         } 
    500          
     499          } 
     500 
     501        mViewCellsManager->SetPreprocessor(this); 
    501502        return true; 
    502503} 
     
    505506bool Preprocessor::ConstructViewCells() 
    506507{ 
    507         // construct view cells using it's own set of samples 
    508         mViewCellsManager->Construct(this); 
    509  
    510         // visualizations and statistics 
    511         Debug << "finished view cells:" << endl; 
    512         mViewCellsManager->PrintStatistics(Debug); 
    513              
    514         return true; 
     508  // construct view cells using it's own set of samples 
     509  mViewCellsManager->Construct(this); 
     510   
     511  // visualizations and statistics 
     512  Debug << "finished view cells:" << endl; 
     513  mViewCellsManager->PrintStatistics(Debug); 
     514   
     515  return true; 
    515516} 
    516517 
     
    900901        } 
    901902 
     903        if (i % 10000 == 0) 
     904                cout<<"."; 
     905 
    902906#if DEBUB_RAYCAST 
    903907        long t2 = GetTime(); 
    904         if (i % 10000 == 0) 
    905                 cout<<"."; 
    906  
    907908        if (castDoubleRays) 
    908909                cout << 2 * rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp

    r1457 r1581  
    2424  Camera camera; 
    2525   
    26   if (0) 
     26  if (1) 
    2727        { 
    2828                // camera.LookAtBox(mPreprocessor->mKdTree->GetBox()); 
     
    3636        }  
    3737   
    38   if (0) { 
     38  if (2) { 
    3939        camera.LookInBox(mPreprocessor->mKdTree->GetBox()); 
    4040        camera.SetPosition(camera.mPosition + Vector3(-250,0,-550)); 
     
    4242  } 
    4343 
    44   if (0) { 
     44  if (3) { 
    4545        camera.SetPosition( mPreprocessor->mKdTree->GetBox().Center() - Vector3(0,-100,0) ); 
    4646        camera.SetDirection(Vector3(1, 0, 0)); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp

    r1387 r1581  
    1010#include "KdTree.h" 
    1111#include "Environment.h" 
     12#include "RssPreprocessor.h" 
     13#include "RssTree.h" 
     14#include "Trackball.h" 
     15 
     16 
    1217#include <Cg/cg.h> 
    1318#include <Cg/cgGL.h> 
     
    1722namespace GtpVisibilityPreprocessor { 
    1823 
     24 
     25#define CAMERA_VIEW_WIDTH 0.5f 
     26   
    1927class ViewCellsManager; 
    2028 
     
    380388  makeCurrent(); 
    381389 
    382  
    383390  SetupProjection(GetWidth(), GetHeight()); 
    384  
    385391   
    386392  for (int i=0; i < mPvsStatFrames; i++) { 
     
    797803         
    798804        glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, depthMapSize,  
    799                 depthMapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); 
     805                                 depthMapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); 
     806 
    800807        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 
    801808        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 
     
    906913 
    907914void 
    908 QtGlRendererWidget::SetupProjection(const int w, const int h, const float angle) 
    909 { 
    910   if (!mTopView) 
    911         GlRenderer::SetupProjection(w, h, angle); 
    912   else { 
    913         glViewport(0, 0, w, h); 
     915QtGlRendererWidget::SetupCameraProjection(const int w, const int h, const float angle) 
     916{ 
     917  if (!mTopView) { 
     918        int ww = w*CAMERA_VIEW_WIDTH; 
     919        int hh = h; 
     920        glViewport(0, 0, ww, hh); 
    914921        glMatrixMode(GL_PROJECTION); 
    915922        glLoadIdentity(); 
    916         gluPerspective(50.0, 1.0, 0.1, 20.0*Magnitude(mSceneGraph->GetBox().Diagonal())); 
     923        gluPerspective(angle, ww/(float)hh, 0.1, 2.0*Magnitude(mSceneGraph->GetBox().Diagonal())); 
    917924        glMatrixMode(GL_MODELVIEW); 
    918   } 
     925  } else { 
     926        int ww = w*CAMERA_VIEW_WIDTH; 
     927        int hh = h; 
     928        glViewport(0, 0, ww, hh); 
     929        glMatrixMode(GL_PROJECTION); 
     930        glLoadIdentity(); 
     931        gluPerspective(50.0, ww/(float)hh, 0.1, 20.0*Magnitude(mSceneGraph->GetBox().Diagonal())); 
     932        glMatrixMode(GL_MODELVIEW); 
     933  } 
     934} 
     935 
     936void 
     937QtGlRendererWidget::SetupManipulatorProjection(const int w, const int h, const float angle) 
     938{ 
     939  int ww = w*(1.0f - CAMERA_VIEW_WIDTH); 
     940  int hh = h; 
     941  glViewport(w - ww, 0, ww, hh); 
     942  glMatrixMode(GL_PROJECTION); 
     943  glLoadIdentity(); 
     944  gluPerspective(angle, ww/(float)hh, 1.0f, 40.0f); 
     945  glMatrixMode(GL_MODELVIEW); 
    919946} 
    920947 
     
    922949QtGlRendererWidget::RenderPvs() 
    923950{ 
    924   SetupCamera(); 
    925   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
     951   
    926952   
    927953  ViewCell *viewcell = NULL; 
     
    9871013  mUseFalseColors = true; 
    9881014 
    989   SetupCamera(); 
    9901015  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    9911016   
     
    11251150  int x = e->pos().x(); 
    11261151  int y = e->pos().y(); 
    1127    
    1128   if (e->modifiers() & Qt::ControlModifier) { 
    1129         mViewPoint.y += (y-mousePoint.y)*MOVE_SENSITIVITY/2.0; 
    1130         mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY/2.0; 
     1152 
     1153  int diffx = -(mousePoint.x - x); 
     1154  int diffy = -(mousePoint.y - y); 
     1155   
     1156  if (x < width()*CAMERA_VIEW_WIDTH) { 
     1157        if (e->modifiers() & Qt::ControlModifier) { 
     1158          mViewPoint.y += (y-mousePoint.y)*MOVE_SENSITIVITY/2.0; 
     1159          mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY/2.0; 
     1160        } else { 
     1161          mViewPoint += mViewDirection*((mousePoint.y - y)*MOVE_SENSITIVITY); 
     1162          float adiff = TURN_ANGLE*(x - mousePoint.x)*-TURN_SENSITIVITY; 
     1163          float angle = atan2(mViewDirection.x, mViewDirection.z); 
     1164          mViewDirection.x = sin(angle+adiff); 
     1165          mViewDirection.z = cos(angle+adiff); 
     1166        } 
    11311167  } else { 
    1132         mViewPoint += mViewDirection*((mousePoint.y - y)*MOVE_SENSITIVITY); 
    1133         float adiff = TURN_ANGLE*(x - mousePoint.x)*-TURN_SENSITIVITY; 
    1134         float angle = atan2(mViewDirection.x, mViewDirection.z); 
    1135         mViewDirection.x = sin(angle+adiff); 
    1136         mViewDirection.z = cos(angle+adiff); 
     1168        float W = width()*(1.0f-CAMERA_VIEW_WIDTH); 
     1169        float H = height(); 
     1170        int xx = x - width()*CAMERA_VIEW_WIDTH; 
     1171        int mxx = mousePoint.x - width()*CAMERA_VIEW_WIDTH; 
     1172    if (e->modifiers() & Qt::ControlModifier) { 
     1173          mManipulatorScale = mManipulatorScale * (1.0 + (((float) (-diffy)) / H)); 
     1174        } else { 
     1175          float quat[4]; 
     1176          trackball(quat, 
     1177                                (2.0 * mxx - W) / W, 
     1178                                (H - 2.0 * mousePoint.y) / H, 
     1179                                (2.0 * xx - W) / W, 
     1180                                (H - 2.0 * y) / H 
     1181                                ); 
     1182          add_quats(quat, mManipulatorLastQuat, mManipulatorLastQuat); 
     1183        } 
    11371184  } 
    11381185   
     
    11531200QtGlRendererWidget::resizeGL(int w, int h) 
    11541201{ 
    1155   SetupProjection(w, h); 
     1202  SetupCameraProjection(w, h); 
    11561203  updateGL(); 
    11571204} 
     
    11621209  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    11631210 
    1164    
    1165   if (!mRenderViewCells) { 
    1166         if (mRenderErrors) 
     1211  if (1) { 
     1212        SetupCameraProjection(width(), height()); 
     1213        SetupCamera(); 
     1214         
     1215        if (mRenderErrors) { 
    11671216          RenderErrors(); 
    1168         else 
     1217        } else { 
    11691218          RenderPvs(); 
     1219        } 
     1220         
    11701221        RenderInfo(); 
    1171   } else { 
    1172         RenderViewCells(); 
    1173          
    1174         mWireFrame = true; 
    1175         RenderScene(); 
    1176         mWireFrame = false; 
    1177          
    1178         RenderInfo(); 
    11791222  } 
    11801223 
    11811224  mFrame++; 
     1225 
     1226  if (1) { 
     1227        // render into the right side of the window buffer 
     1228        SetupManipulatorProjection(width(), height()); 
     1229        SetupManipulator(); 
     1230         
     1231         
     1232        if (mRenderViewCells)  
     1233          RenderViewCells(); 
     1234         
     1235        RenderPvs(); 
     1236         
     1237        if (0) { 
     1238          mWireFrame = true; 
     1239          RenderScene(); 
     1240          mWireFrame = false; 
     1241        } 
     1242         
     1243        if (mShowRays) { 
     1244          RssPreprocessor *p = (RssPreprocessor *)mViewCellsManager->GetPreprocessor(); 
     1245          VssRayContainer rays; 
     1246          p->mRssTree->CollectRays(rays, 10000); 
     1247          RenderRays(rays); 
     1248        } 
     1249         
     1250  } 
     1251  mFrame++; 
     1252   
    11821253} 
    11831254 
     
    12221293 
    12231294void 
     1295QtGlRendererWidget::SetupManipulator() 
     1296{ 
     1297  float m[4][4]; 
     1298 
     1299  glLoadIdentity(); 
     1300  gluLookAt(0.0, 0.0, 30.0,  /* eye is at (0,0,30) */ 
     1301                        0.0, 0.0, 0.0,      /* center is at (0,0,0) */ 
     1302                        0.0, 1.0, 0.);      /* up is in positive Y direction */ 
     1303   
     1304  build_rotmatrix(m, mManipulatorLastQuat); 
     1305  glMultMatrixf(&m[0][0]); 
     1306   
     1307  float scale = mManipulatorScale*20.0f/Magnitude(mSceneGraph->GetBox().Diagonal()); 
     1308  glScalef(scale, scale, scale); 
     1309   
     1310  Vector3 t = -mSceneGraph->GetBox().Center(); 
     1311  glTranslatef(t.x, t.y, t.z); 
     1312   
     1313} 
     1314 
     1315void 
    12241316QtGlRendererWidget::keyPressEvent ( QKeyEvent * e ) 
    12251317{ 
     
    12271319  case Qt::Key_T: 
    12281320        mTopView = !mTopView; 
    1229         SetupProjection(width(), height()); 
     1321        SetupCameraProjection(width(), height()); 
    12301322        updateGL(); 
    12311323        break; 
     
    12481340   
    12491341 
    1250 QtGlRendererWidget::QtGlRendererWidget(SceneGraph *sceneGraph, 
     1342QtGlRendererWidget::QtGlRendererWidget( 
     1343                                                                           SceneGraph *sceneGraph, 
    12511344                                                                           ViewCellsManager *viewcells, 
    12521345                                                                           KdTree *tree, 
     
    12651358  mRenderErrors = false; 
    12661359  mRenderFilter = true; 
    1267  
     1360  mManipulatorScale = 1.0f; 
     1361  trackball(mManipulatorLastQuat, 0.0f, 0.0f, 0.0f, 0.0f); 
    12681362  bool tmp; 
    12691363 
     
    12811375  mPvsSize = 0; 
    12821376  mRenderError = 0.0f; 
     1377  mShowRays = false; 
     1378   
    12831379  mControlWidget = new QtRendererControlWidget(NULL); 
    12841380   
     
    13021398                  this, SLOT(SetUseSpatialFilter(bool))); 
    13031399 
    1304    
     1400  connect(mControlWidget, 
     1401                  SIGNAL(SetShowRays(bool)), 
     1402                  this, 
     1403                  SLOT(SetShowRays(bool))); 
     1404 
     1405  resize(1000, 500); 
    13051406  mControlWidget->show(); 
    13061407} 
     
    13681469          // init ortographic projection 
    13691470          glMatrixMode(GL_PROJECTION); 
     1471 
     1472 
    13701473          glPushMatrix(); 
    13711474           
     
    14841587  mUseFalseColors = true; 
    14851588 
    1486   SetupCamera(); 
     1589  glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT); 
     1590   
    14871591  glEnable(GL_CULL_FACE); 
    14881592  //glDisable(GL_CULL_FACE); 
     
    15291633  } 
    15301634 
    1531   glDisable(GL_CLIP_PLANE0); 
     1635 
     1636  glPopAttrib(); 
    15321637 
    15331638} 
     
    16331738  cb->setChecked(false); 
    16341739  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool))); 
     1740 
     1741  cb = new QCheckBox("Show rays", hbox); 
     1742  hlayout->addWidget(cb); 
     1743  cb->setChecked(false); 
     1744  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRays(bool))); 
    16351745 
    16361746  vbox->resize(800,100); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h

    r1387 r1581  
    3131class TransformedMeshInstance; 
    3232 
     33 
    3334struct VssRayContainer; 
    3435struct PvsRenderStatistics;  
     
    149150  void SetSpatialFilterSize(int); 
    150151 
     152  void SetShowRays(bool); 
    151153  void SetRenderFilter(bool); 
    152154  void SetUseFilter(bool); 
     
    180182  bool mUseSpatialFilter; 
    181183  bool mShowRenderCost; 
    182    
     184  bool mShowRays; 
     185 
    183186  bool mShowPvsSizes; 
    184187  float mSpatialFilterSize; 
     
    191194  float mRenderError; 
    192195 
     196 
     197  float mManipulatorLastQuat[4]; 
     198  float mManipulatorScale; 
     199   
    193200  QtRendererControlWidget *mControlWidget; 
    194201   
     
    202209 
    203210  virtual void SetupCamera(); 
     211  // setup a transformation for manipulator 
     212  void 
     213  SetupManipulator(); 
    204214 
    205215  void initializeGL() { 
     
    229239  virtual int GetHeight() const { return height(); } 
    230240 
    231  virtual void 
    232   SetupProjection(const int w, const int h, const float angle = 70.0f); 
     241  // virtual void 
     242  //  SetupProjection(const int w, const int h, const float angle = 70.0f); 
     243 
     244  virtual void 
     245  SetupCameraProjection(const int w, const int h, const float angle = 70.0f); 
     246 
     247  virtual void 
     248  SetupManipulatorProjection(const int w, const int h, const float angle = 70.0f); 
    233249 
    234250  void 
     
    280296  void SetShowViewCells(bool b) { 
    281297        mRenderViewCells = b; 
     298        updateGL(); 
     299  } 
     300 
     301  void SetShowRays(bool b) { 
     302        mShowRays = b; 
    282303        updateGL(); 
    283304  } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp

    r1563 r1581  
    918918  } 
    919919           
     920 
     921  // do not delete rss tree now - can be used for visualization.. 
     922#if 0 
    920923  Debug<<"Deleting RSS tree...\n"; 
    921924  delete mRssTree; 
    922925  Debug<<"Done.\n"; 
    923  
     926#endif 
    924927 
    925928  //mViewCellsManager->ExportViewCells("visibility.xml", 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp

    r1563 r1581  
    28812881  int desired = min(number, (int)allRays.size()); 
    28822882  float prob = desired/(float)allRays.size(); 
     2883  //int skip = allRays.size()/desired; 
    28832884  while (rays.size() < desired) { 
    28842885        VssRayContainer::const_iterator it = allRays.begin(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h

    r1233 r1581  
    10131013                           ); 
    10141014 
    1015     int 
     1015  int 
    10161016  CollectRays(VssRayContainer &rays, 
    10171017                          const int number); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1580 r1581  
    18561856                        {                        
    18571857                                if (viewcell->GetPvs().GetSampleContribution( 
    1858                                                         ray.mTerminationObject, 
    1859                                                         ray.mPdf, 
    1860                                                         contribution)) 
    1861                                 { 
     1858                                                                                                                         ray.mTerminationObject, 
     1859                                                                                                                         ray.mPdf, 
     1860                                                                                                                         contribution)) 
     1861                                  { 
    18621862                                        ++ ray.mPvsContribution; 
    1863                                         ray.mRelativePvsContribution += contribution; 
    1864                                 } 
     1863                                  } 
     1864                                ray.mRelativePvsContribution += contribution; 
     1865                                 
    18651866                        } 
    18661867                         
    18671868#if SAMPLE_ORIGIN_OBJECTS 
    1868  
     1869                         
    18691870                        // for directional sampling it is important to count only contributions 
    18701871                        // made in one direction!!! 
    18711872                        // the other contributions of this sample will be counted for the oposite ray! 
    1872  
     1873                         
    18731874                        if (ray.mOriginObject &&  
    18741875                                viewcell->GetPvs().GetSampleContribution(ray.mOriginObject, 
    18751876                                                                                                                 ray.mPdf, 
    18761877                                                                                                                 contribution)) 
    1877                         { 
     1878                          { 
    18781879                                ++ ray.mPvsContribution; 
    1879                                 ray.mRelativePvsContribution += contribution; 
    1880                         } 
     1880                          } 
     1881                        ray.mRelativePvsContribution += contribution; 
    18811882#endif 
    18821883                } 
     
    55165517                        { 
    55175518                                ++ ray.mPvsContribution; 
    5518                                 ray.mRelativePvsContribution += contribution; 
    55195519                        } 
     5520                        ray.mRelativePvsContribution += contribution; 
    55205521#endif 
    55215522                } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1580 r1581  
    430430        bool GetExportPvs() const; 
    431431 
    432         ///////////////////////////// 
    433         // static members 
    434          
    435         /** Loads view cells from file. The view cells manager is created with  
    436                 respect to the loaded view cells. 
    437  
    438                 @param filename the filename of the view cells 
    439                 @param objects the scene objects 
    440                 @param finalizeViewCells if the view cells should be post processed, i.e. 
    441                         a mesh is created representing the geometry 
    442                 @param bconverter a conversion routine working with the similarities of bounding 
    443                 boxes: if there is a certain similarity of overlap between bounding boxes, two tested 
    444                 candidate objects are considered to be the same objects 
    445                 @returns the view cells manager if loading was successful, false otherwise 
    446         */ 
    447         static ViewCellsManager *LoadViewCells(const string &filename,  
    448                                                                                    ObjectContainer *objects,  
    449                                                                                    const bool finalizeViewCells, 
    450                                                                                    BoundingBoxConverter *bconverter = NULL); 
     432 
     433  Preprocessor *GetPreprocessor() { 
     434        return mPreprocessor; 
     435  } 
     436   
     437  void SetPreprocessor(Preprocessor *p) { 
     438        mPreprocessor = p; 
     439  } 
    451440 
    452441 
     
    731720 
    732721        ~BspViewCellsManager(); 
    733  
     722   
    734723        int ConstructSubdivision(const ObjectContainer &objects,  
    735724                                  const VssRayContainer &rays); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r1563 r1581  
    439439        if (element == "BoundingBox") 
    440440        { 
    441                 cout << "b"; 
     441          //            cout << "b"; 
    442442                StartBoundingBox(attributes); 
    443443        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r1579 r1581  
    1414# filename ../data/vienna/vienna-buildings.x3d 
    1515# filename ../data/vienna/city1500_flat_1.x3d 
    16 #filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d 
     16#filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 
    1717#;../data/vienna/vienna-plane.x3d;../data/vienna/vienna-roads.x3d 
    1818# filename ../data/vienna/viewcells-25-sel.x3d 
     
    4444        type rss 
    4545#       type render 
    46         detectEmptyViewSpace true 
     46        detectEmptyViewSpace false 
    4747#       pvsRenderErrorSamples 0 
    4848        pvsRenderErrorSamples 5000 
     
    5454        visibilityFile visibility.xml 
    5555        loadMeshes true 
     56        loadKdTree      false 
     57        exportKdTree false 
     58 
    5659} 
    5760 
     
    7376        samplesPerPass 1000 
    7477        initialSamples 1000000 
    75         vssSamples 10000000 
     78        vssSamples 50000000 
    7679        vssSamplesPerPass 1000000 
    7780        useImportanceSampling true 
     
    189192        exportToFile true 
    190193        loadFromFile true 
    191  
     194         
    192195        #type kdTree 
    193196        #type vspKdTree 
    194197        #type bspTree 
    195198        type vspBspTree 
     199        #type vspOspTree 
    196200        #type sceneDependent 
    197201         
     
    256260#       filename ../data/soda/soda5-viewcells.xml 
    257261#       filename ../scripts/viewcells_atlanta.xml 
    258 #       filename ../data/soda/soda-viewcells-5000.xml 
     262        filename ../data/soda/soda-viewcells-5000.xml 
    259263#       filename ../data/test1/test-viewcells.xml 
    260264 
    261265#       filename ../data/soda/soda5-viewcell-single.xm 
    262         filename ../data/soda/soda-viewcells-1000.xml.zip 
     266#       filename ../data/soda/soda-viewcells-1000.xml.zip 
    263267#       filename ../data/CityModel/CityModel-viewcells-5000.xml 
    264268#       filename ../data/City4M/City4M-viewcells-5000.xml 
    265269 
     270 
     271#       filename ../data/vienna/vsposp-seq-viewCells.xml.gz 
    266272 
    267273#       filename ../data/atlanta/viewcells_atlanta3.xml 
     
    338344#               minGlobalCostRatio      0.0001 
    339345# $$MAXVIEWCELLS 
    340                 maxViewCells            1 
     346                maxViewCells            1000 
    341347         
    342348 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1580 r1581  
    217217                                                                                                  preprocessor->mViewCellsManager, 
    218218                                                                                                  preprocessor->mKdTree); 
    219  
     219                   
    220220                  rendererWidget->Show(); 
    221221                  guiSupported = true;  
  • GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro

    r1579 r1581  
    117117BvHierarchy.cpp  \ 
    118118BoostPreprocessorThread.cpp InternalRayCaster.cpp IntelRayCaster.cpp \ 
    119 RayCaster.cpp PreprocessorFactory.cpp GvsPreprocessor.cpp 
     119RayCaster.cpp PreprocessorFactory.cpp GvsPreprocessor.cpp Trackball.cpp 
    120120 
    121121 
Note: See TracChangeset for help on using the changeset viewer.