Changeset 1613


Ignore:
Timestamp:
10/11/06 23:54:56 (18 years ago)
Author:
bittner
Message:

kd-tree hack active

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

Legend:

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

    r1579 r1613  
    17151715                                        "true"); 
    17161716 
     1717        RegisterOption("Preprocessor.delayVisibilityComputation", 
     1718                                   optBool, 
     1719                                   "preprocessor_delay_computation=", 
     1720                                   "true"); 
     1721 
    17171722        RegisterOption("Preprocessor.pvsRenderErrorSamples", 
    17181723                                   optInt, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h

    r1594 r1613  
    9898public: 
    9999   
    100         static int sMailId; 
    101         static int sReservedMailboxes; 
     100  static int sMailId; 
     101  static int sReservedMailboxes; 
    102102  int mMailbox; 
    103103   
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r1608 r1613  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.2) on: út 10. X 22:38:46 2006 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: st 11. X 21:13:40 2006 
    44# Project:  preprocessor.pro 
    55# Template: app 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1608 r1613  
    134134mPass(0), 
    135135mSceneGraph(NULL), 
    136 mRayCaster(NULL) 
     136mRayCaster(NULL), 
     137mStopComputation(false) 
    137138{ 
    138139        Environment::GetSingleton()->GetBoolValue("Preprocessor.useGlRenderer", mUseGlRenderer); 
     
    141142        renderer = NULL; 
    142143   
     144        Environment::GetSingleton()->GetBoolValue("Preprocessor.delayVisibilityComputation", 
     145                                                                                          mDelayVisibilityComputation); 
     146         
    143147        Environment::GetSingleton()->GetBoolValue("Preprocessor.useGlDebugger", mUseGlDebugger); 
    144148        Environment::GetSingleton()->GetBoolValue("Preprocessor.loadMeshes", mLoadMeshes); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r1564 r1613  
    202202 
    203203        int mPass; 
    204  
     204   
     205  bool mDelayVisibilityComputation; 
     206  bool mStopComputation; 
     207   
    205208protected: 
    206209 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp

    r1608 r1613  
    1313#include "RssTree.h" 
    1414#include "Trackball.h" 
     15#include "QtPreprocessorThread.h" 
    1516 
    1617 
     
    12531254        if (mShowRays) { 
    12541255          RssPreprocessor *p = (RssPreprocessor *)mViewCellsManager->GetPreprocessor(); 
    1255           VssRayContainer rays; 
    1256           p->mRssTree->CollectRays(rays, 10000); 
    1257           RenderRays(rays); 
     1256          if (p->mRssTree) { 
     1257                VssRayContainer rays; 
     1258                p->mRssTree->CollectRays(rays, 10000); 
     1259                RenderRays(rays); 
     1260          } 
    12581261        } 
    12591262 
     
    13651368  GlRendererWidget(sceneGraph, viewcells, tree), QGLWidget(parent, shareWidget, f) 
    13661369{ 
     1370  mPreprocessorThread = NULL; 
    13671371  mTopView = false; 
    13681372  mRenderViewCells = false; 
     
    13961400   
    13971401  connect(mControlWidget, SIGNAL(SetViewCellGranularity(int)), this, SLOT(SetViewCellGranularity(int))); 
     1402  connect(mControlWidget, SIGNAL(UpdateAllPvs()), this, SLOT(UpdateAllPvs())); 
     1403  connect(mControlWidget, SIGNAL(ComputeVisibility()), this, SLOT(ComputeVisibility())); 
     1404  connect(mControlWidget, SIGNAL(StopComputation()), this, SLOT(StopComputation())); 
     1405 
    13981406  connect(mControlWidget, SIGNAL(SetSceneCut(int)), this, SLOT(SetSceneCut(int))); 
    13991407  connect(mControlWidget, SIGNAL(SetTopDistance(int)), this, SLOT(SetTopDistance(int))); 
     
    14241432  resize(1000, 500); 
    14251433  mControlWidget->show(); 
     1434} 
     1435 
     1436void 
     1437QtGlRendererWidget::UpdateAllPvs() 
     1438{ 
     1439  // $$ does not work so far:( 
     1440  mViewCellsManager->UpdatePvsForEvaluation(); 
     1441  //    mViewCellsManager->FinalizeViewCells(false); 
     1442} 
     1443 
     1444void 
     1445QtGlRendererWidget::ComputeVisibility() 
     1446{ 
     1447  cerr<<"Compute Visibility called!\n"<<endl; 
     1448  if (!mPreprocessorThread->isRunning()) 
     1449        mPreprocessorThread->RunThread(); 
     1450} 
     1451 
     1452void 
     1453QtGlRendererWidget::StopComputation() 
     1454{ 
     1455  cerr<<"stop computation called!\n"<<endl; 
     1456  mViewCellsManager->GetPreprocessor()->mStopComputation = true; 
    14261457} 
    14271458 
     
    17631794  QLabel *label = new QLabel("Granularity"); 
    17641795  vbox->layout()->addWidget(label); 
    1765  
     1796   
    17661797  QSlider *slider = new QSlider(Qt::Horizontal, vbox); 
    17671798  vl->addWidget(slider); 
     
    17711802  slider->setValue(200); 
    17721803 
     1804   
    17731805  connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetViewCellGranularity(int))); 
    17741806 
     1807  { 
     1808        QPushButton *button = new QPushButton("Update all PVSs", vbox); 
     1809        vbox->layout()->addWidget(button); 
     1810        connect(button, SIGNAL(clicked()), SLOT(UpdateAllPvs())); 
     1811  } 
     1812   
     1813   
    17751814  label = new QLabel("Filter size"); 
    17761815  vbox->layout()->addWidget(label); 
     
    19101949  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetTopView(bool))); 
    19111950 
     1951 
     1952 
    19121953  vbox = new QGroupBox("PVS Errors", this); 
    19131954  layout()->addWidget(vbox); 
    1914  
     1955   
    19151956  vl = new QVBoxLayout; 
    19161957  vbox->setLayout(vl); 
    19171958 
    1918   mPvsErrorWidget = new QListWidget(vbox); 
    1919   vbox->layout()->addWidget(mPvsErrorWidget); 
    1920    
    1921   connect(mPvsErrorWidget, 
    1922                   SIGNAL(doubleClicked(const QModelIndex &)), 
    1923                   this, 
    1924                   SLOT(PvsErrorClicked(const QModelIndex &))); 
    1925    
    1926   QPushButton *button = new QPushButton("Next Error Frame", vbox); 
     1959  QPushButton *button = new QPushButton("Compute Visibility", vbox); 
    19271960  vbox->layout()->addWidget(button); 
    1928   connect(button, SIGNAL(clicked(void)), SLOT(FocusNextPvsErrorFrame(void))); 
    1929  
     1961  connect(button, SIGNAL(clicked()), SLOT(ComputeVisibility())); 
     1962 
     1963  button = new QPushButton("Stop Computation", vbox); 
     1964  vbox->layout()->addWidget(button); 
     1965  connect(button, SIGNAL(clicked()), SLOT(StopComputation())); 
     1966 
     1967 
     1968  if (0) { 
     1969        vbox = new QGroupBox("PVS Errors", this); 
     1970        layout()->addWidget(vbox); 
     1971         
     1972        vl = new QVBoxLayout; 
     1973        vbox->setLayout(vl); 
     1974         
     1975        mPvsErrorWidget = new QListWidget(vbox); 
     1976        vbox->layout()->addWidget(mPvsErrorWidget); 
     1977         
     1978        connect(mPvsErrorWidget, 
     1979                        SIGNAL(doubleClicked(const QModelIndex &)), 
     1980                        this, 
     1981                        SLOT(PvsErrorClicked(const QModelIndex &))); 
     1982         
     1983        QPushButton *button = new QPushButton("Next Error Frame", vbox); 
     1984        vbox->layout()->addWidget(button); 
     1985        connect(button, SIGNAL(clicked(void)), SLOT(FocusNextPvsErrorFrame(void))); 
     1986  } 
     1987   
    19301988  setWindowTitle("Preprocessor Control Widget"); 
    19311989  adjustSize(); 
    19321990} 
     1991 
    19331992 
    19341993 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h

    r1594 r1613  
    1313#include "GlRenderer.h" 
    1414#include "Beam.h" 
    15  
     15#include "QtPreprocessorThread.h" 
    1616class QWidget; 
     17//class QtPreprocessorThread; 
    1718 
    1819namespace GtpVisibilityPreprocessor { 
     
    143144 
    144145  signals: 
    145    
     146 
     147  void ComputeVisibility(); 
     148  void StopComputation(); 
     149  void UpdateAllPvs(); 
    146150  void SetViewCellGranularity(int); 
    147151  void SetSceneCut(int); 
     
    202206   
    203207  QtRendererControlWidget *mControlWidget; 
     208 
     209  QtPreprocessorThread *mPreprocessorThread; 
    204210   
    205211  QtGlRendererWidget(SceneGraph *sceneGraph, 
     
    211217  QtGlRendererWidget() {}; 
    212218 
     219  void SetThread(QtPreprocessorThread *t) { 
     220        mPreprocessorThread = t; 
     221  } 
    213222  void 
    214223  RenderRenderCost(); 
     
    263272 
    264273 public slots: 
     274 
     275 void UpdateAllPvs(); 
     276  void ComputeVisibility(); 
     277  void StopComputation(); 
    265278 
    266279 void SetRenderErrors(bool b) { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.h

    r1457 r1613  
    1010class Preprocessor; 
    1111 
    12 class QtPreprocessorThread : public PreprocessorThread, QThread 
     12class QtPreprocessorThread : public PreprocessorThread, public QThread 
    1313{ 
    1414public: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp

    r1585 r1613  
    627627           
    628628          // now evaluate the ratios for the next pass 
    629 #define TIMES 1 
    630  
    631 #if TIMES 
    632           ratios[0] = sqr(contributions[0]/times[0]); 
    633           ratios[1] = sqr(contributions[1]/times[1]); 
    634           ratios[2] = sqr(contributions[2]/times[2]); 
    635 #else 
    636           ratios[0] = sqr(contributions[0]/nrays[0]); 
    637           ratios[1] = sqr(contributions[1]/nrays[1]); 
    638           ratios[2] = sqr(contributions[2]/nrays[2]); 
    639 #endif 
    640           NormalizeRatios(ratios); 
     629#define TIME_WEIGHT 0.5f 
     630 
     631          ratios[0] = sqr(contributions[0]/(TIME_WEIGHT*times[0] + (1 - TIME_WEIGHT)*nrays[0])); 
     632          ratios[1] = sqr(contributions[1]/(TIME_WEIGHT*times[1] + (1 - TIME_WEIGHT)*nrays[1])); 
     633          ratios[2] = sqr(contributions[2]/(TIME_WEIGHT*times[2] + (1 - TIME_WEIGHT)*nrays[2])); 
     634 
     635                                          NormalizeRatios(ratios); 
    641636 
    642637          cout<<"New ratios: "<<ratios[0]<<" "<<ratios[1]<<" "<<ratios[2]<<endl; 
     
    772767        if (totalSamples >= mRssSamples + mInitialSamples) 
    773768          break; 
    774  
     769         
    775770         
    776771        rssPass++; 
    777772        mPass++; 
    778773        mRssTree->SetPass(mPass); 
     774 
     775         
    779776  } 
    780777   
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1608 r1613  
    3030 
    3131// $$JB HACK 
    32 #define USE_KD_PVS 0 
    33 #define KD_PVS_AREA 1e-4f 
     32#define USE_KD_PVS 1 
     33#define KD_PVS_AREA 1e-3f 
    3434 
    3535namespace GtpVisibilityPreprocessor { 
     
    230230        } 
    231231} 
     232 
    232233 
    233234 
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r1608 r1613  
    77 
    88#filename ../data/arena/export.obj 
    9  
    109# filename ../data/City4M/City4M.obj 
    1110# filename ../data/CityModel/CityModel.obj 
     
    1514# filename ../data/vienna/vienna-simple.x3d 
    1615# filename ../data/vienna/vienna-buildings.x3d 
    17 # filename ../data/vienna/city1500_flat_1.x3d 
    18 #filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 
    19  
    20 # ../data/vienna/vienna-plane.x3d; 
     16#filename ../data/vienna/city1500_flat_1.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 
     17filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 
     18 
     19#;../data/vienna/vienna-plane.x3d; 
    2120# filename ../data/vienna/viewcells-25-sel.x3d 
    2221#filename ../data/atlanta/atlanta2.x3d 
    23 filename ../data/soda/soda.dat 
     22# filename ../data/soda/soda.dat 
    2423#filename ../data/test1/test2.x3d 
    2524#filename ../data/soda/soda5.dat 
     
    3534 
    3635Preprocessor { 
     36        delayVisibilityComputation false 
    3737        # stored sample rays 
    3838        samplesFilename rays.out 
     
    7979        samplesPerPass 1000 
    8080        initialSamples 1000000 
    81         vssSamples 10000000 
    82         vssSamplesPerPass 1000000 
     81        vssSamples 20000000 
     82        vssSamplesPerPass 500000 
    8383        useImportanceSampling true 
    8484 
     
    148148                minCost 4 
    149149                maxDepth 30 
    150                 maxCostRatio 1.0 
     150                maxCostRatio 1.1 
    151151                ct_div_ci 0.5 
    152                 maxNodes 300000 
     152                maxNodes 500000 
    153153#500000  
    154154        } 
     
    192192        #type vspKdTree 
    193193        #type bspTree 
    194         type vspBspTree 
    195         #type vspOspTree 
     194        #type vspBspTree 
     195        type vspOspTree 
    196196        #type sceneDependent 
    197197         
     
    260260#       filename ../data/soda/soda5-viewcells.xml 
    261261#       filename ../scripts/viewcells_atlanta.xml 
    262         filename ../data/soda/soda-viewcells-5000.xml 
     262#       filename ../data/soda/soda-viewcells-5000.xml 
    263263#       filename ../data/test1/test-viewcells.xml 
    264264 
     
    280280#       filename ../data/vienna/vienna_simple-21-04-avs2-viewCells.xml 
    281281#       filename ../data/vienna/vienna-viewcells-5000.xml 
    282 #       filename ../data/vienna/vienna-viewcells-1000.xml.zip 
     282        filename ../data/vienna/vienna-viewcells-1000.xml.zip 
    283283#       filename ../data/vienna/vsposp-seq-viewCells.xml.gz 
    284284 
     
    383383        } 
    384384 
    385  
    386385        # random polygon       = 1 
    387386        # axis aligned         = 2 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1595 r1613  
    197197#if USE_THREADS 
    198198                pt->InitThread(); 
    199                 pt->RunThread(); 
     199                if (!preprocessor->mDelayVisibilityComputation) 
     200                  pt->RunThread(); 
    200201#endif 
    201202                 
     
    217218                                                                                                  preprocessor->mViewCellsManager, 
    218219                                                                                                  preprocessor->mKdTree); 
    219                    
     220 
     221                  ((QtGlRendererWidget *)rendererWidget)->SetThread((QtPreprocessorThread *)pt); 
    220222                  rendererWidget->Show(); 
    221223                  guiSupported = true;  
Note: See TracChangeset for help on using the changeset viewer.