Changeset 1694


Ignore:
Timestamp:
10/28/06 23:39:26 (18 years ago)
Author:
bittner
Message:

obj exporter, vienna.obj + kdf added

Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
4 added
14 edited

Legend:

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

    r1421 r1694  
    177177        case Intersectable::TRIANGLE_INTERSECTABLE: 
    178178                { 
    179                         const Triangle3 triangle = dynamic_cast<TriangleIntersectable *>(object)->GetItem(); 
    180                         Polygon3 poly(triangle); 
    181                         ExportPolygon(&poly); 
    182                         break; 
     179                  const Triangle3 triangle = dynamic_cast<TriangleIntersectable *>(object)->GetItem(); 
     180                  Polygon3 poly(triangle); 
     181                  ExportPolygon(&poly); 
     182                  break; 
    183183                } 
    184184        case Intersectable::BVH_INTERSECTABLE: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.cpp

    r1692 r1694  
    22#include "Mesh.h" 
    33#include "Triangle3.h" 
     4#include "KdTree.h" 
    45 
    56 
     
    8889        return GetRandomSurfacePoint(point, normal); 
    8990} 
    90   
     91 
     92 
     93KdIntersectable::KdIntersectable(KdNode *item, const AxisAlignedBox3 &box)  : 
     94  IntersectableWrapper<KdNode *>(item) 
     95{ 
     96  mBox = box; 
    9197} 
     98 
     99} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h

    r1686 r1694  
    1616class Ray; 
    1717struct Triangle3; 
    18  
     18  class KdTree; 
    1919 
    2020 
     
    147147{ 
    148148public: 
    149         KdIntersectable(KdNode *item): 
    150         IntersectableWrapper<KdNode *>(item) {} 
    151  
    152         int Type() const 
     149  AxisAlignedBox3 mBox; 
     150 
     151  KdIntersectable(KdNode *item, const AxisAlignedBox3 &box); 
     152 
     153   
     154  int Type() const 
    153155        { 
    154                 return Intersectable::KD_INTERSECTABLE; 
     156          return Intersectable::KD_INTERSECTABLE; 
    155157        } 
    156158 
    157         AxisAlignedBox3 GetBox() const { return mBbox; } 
    158         AxisAlignedBox3 mBbox; 
     159   
     160  AxisAlignedBox3 GetBox() const { 
     161        return mBox; 
     162  } 
    159163}; 
    160164 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp

    r1633 r1694  
    14101410   
    14111411  // not in map => create new entry 
    1412   KdIntersectable *kdObj = new KdIntersectable(node); 
     1412  KdIntersectable *kdObj = new KdIntersectable(node, GetBox(node)); 
    14131413  mKdIntersectables[node] = kdObj; 
    14141414   
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r1613 r1694  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 11. X 21:13:40 2006 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: so 28. X 21:20:40 2006 
    44# Project:  preprocessor.pro 
    55# Template: app 
  • GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp

    r1654 r1694  
    18301830 
    18311831        // not in map => create new entry 
    1832         KdIntersectable *kdObj = new KdIntersectable(node); 
     1832        KdIntersectable *kdObj = new KdIntersectable(node, GetBoundingBox(node)); 
    18331833        mKdIntersectables[node] = kdObj; 
    18341834 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r1673 r1694  
    192192         
    193193        return pvsReduction + pvsEnlargement; 
    194   }                
     194  } 
     195   
     196  int Size() { return mEntries.size(); } 
    195197                                           
    196198  /// Map of PVS entries 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp

    r1613 r1694  
    985985           
    986986          if (mRenderVisibilityEstimates) { 
    987                 float visibility = log10((*it).second.mSumPdf + 1)/5.0f; 
     987                float visibility = mTransferFunction*log10((*it).second.mSumPdf + 1); // /5.0f 
    988988                glColor3f(visibility, 0.0f, 0.0f); 
    989989                mUseForcedColors = true; 
     
    10011001          glPushMatrix(); 
    10021002          glTranslatef(mViewPoint.x, mViewPoint.y, mViewPoint.z); 
     1003          glScalef(5.0f,5.0f,5.0f); 
     1004          glPushAttrib(GL_CURRENT_BIT); 
     1005          glColor3f(1.0f, 0.0f, 0.0f); 
    10031006          gluSphere((::GLUquadric *)mSphere, 
    10041007                                1e-3*Magnitude(mViewCellsManager->GetViewSpaceBox().Size()), 6, 6); 
     1008          glPopAttrib(); 
    10051009          glPopMatrix(); 
    10061010          mWireFrame = false; 
     
    13781382  mRenderFilter = true; 
    13791383  mRenderVisibilityEstimates = false; 
    1380  
     1384  mTransferFunction = 0.2f; 
    13811385  mManipulatorScale = 1.0f; 
    13821386  trackball(mManipulatorLastQuat, 0.0f, 0.0f, 0.0f, 0.0f); 
     
    14001404   
    14011405  connect(mControlWidget, SIGNAL(SetViewCellGranularity(int)), this, SLOT(SetViewCellGranularity(int))); 
     1406  connect(mControlWidget, 
     1407                  SIGNAL(SetTransferFunction(int)), 
     1408                  this, 
     1409                  SLOT(SetTransferFunction(int))); 
    14021410  connect(mControlWidget, SIGNAL(UpdateAllPvs()), this, SLOT(UpdateAllPvs())); 
    14031411  connect(mControlWidget, SIGNAL(ComputeVisibility()), this, SLOT(ComputeVisibility())); 
     
    17211729  { 
    17221730        ViewCell *vc = viewcells[i]; 
    1723         const int p = vc->GetPvs().CountObjectsInPvs(); 
     1731 
     1732        //const int p = vc->GetPvs().CountObjectsInPvs(); 
     1733        const int p = vc->GetPvs().Size(); 
    17241734        if (p > maxPvs) 
    17251735          maxPvs = p; 
     
    17341744        RgbColor c; 
    17351745 
    1736         if (!mShowPvsSizes)  
     1746        if (!mShowPvsSizes) { 
     1747          mWireFrame = true; 
    17371748          c = vc->GetColor(); 
    1738         else { 
    1739           const float importance = (float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs; 
     1749        } else { 
     1750          //      const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 
     1751          const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().Size() / (float)maxPvs); 
    17401752          c = RgbColor(importance, 1.0f - importance, 0.0f); 
    17411753        } 
     
    17451757  } 
    17461758 
     1759  mUseFalseColors = false; 
     1760  mWireFrame = false; 
    17471761 
    17481762  glPopAttrib(); 
    1749  
     1763   
    17501764} 
    17511765 
     
    18051819  connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetViewCellGranularity(int))); 
    18061820 
     1821  label = new QLabel("Transfer function"); 
     1822  vbox->layout()->addWidget(label); 
     1823   
     1824  slider = new QSlider(Qt::Horizontal, vbox); 
     1825  vl->addWidget(slider); 
     1826  slider->show(); 
     1827  slider->setRange(1, 1000); 
     1828  slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 
     1829  slider->setValue(100); 
     1830 
     1831   
     1832  connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetTransferFunction(int))); 
     1833 
    18071834  { 
    18081835        QPushButton *button = new QPushButton("Update all PVSs", vbox); 
     
    18751902 
    18761903 
     1904  cb = new QCheckBox("Cut view cells", vbox); 
     1905  vbox->layout()->addWidget(cb); 
     1906  cb->setChecked(false); 
     1907  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetCutViewCells(bool))); 
     1908 
     1909 
    18771910  slider = new QSlider(Qt::Horizontal, vbox); 
    18781911  vbox->layout()->addWidget(slider); 
     
    18851918 
    18861919 
     1920  cb = new QCheckBox("Cut scene", vbox); 
     1921  vbox->layout()->addWidget(cb); 
     1922  cb->setChecked(false); 
     1923  connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetCutScene(bool))); 
     1924 
    18871925  cb = new QCheckBox("Render boxes", vbox); 
    18881926  vbox->layout()->addWidget(cb); 
     
    19241962 
    19251963 
    1926   cb = new QCheckBox("Cut view cells", vbox); 
    1927   vbox->layout()->addWidget(cb); 
    1928   cb->setChecked(false); 
    1929   connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetCutViewCells(bool))); 
    1930  
    1931   cb = new QCheckBox("Cut scene", vbox); 
    1932   vbox->layout()->addWidget(cb); 
    1933   cb->setChecked(false); 
    1934   connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetCutScene(bool))); 
    19351964 
    19361965   
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h

    r1613 r1694  
    149149  void UpdateAllPvs(); 
    150150  void SetViewCellGranularity(int); 
     151  void SetTransferFunction(int); 
    151152  void SetSceneCut(int); 
    152153  void SetTopDistance(int); 
     
    200201  int mPvsSize; 
    201202  float mRenderError; 
    202  
     203  float mTransferFunction; 
    203204 
    204205  float mManipulatorLastQuat[4]; 
     
    310311  void 
    311312  SetViewCellGranularity(int number); 
    312    
     313 
     314  void 
     315  SetTransferFunction(int number) { 
     316        mTransferFunction = number/1000.0f; 
     317        updateGL(); 
     318  } 
     319 
    313320  void 
    314321  SetVisibilityFilterSize(int number); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp

    r1613 r1694  
    394394  Randomize(0); 
    395395   
     396  const bool useRayBuffer = false; 
     397   
    396398  vector<VssRayContainer> rayBuffer(50); 
    397399   
     
    461463        ExportRays(filename, mVssRays, mExportNumRays); 
    462464 
    463         mVssRays.SelectRays(mExportNumRays, rayBuffer[0], true); 
     465        if (useRayBuffer) 
     466          mVssRays.SelectRays(mExportNumRays, rayBuffer[0], true); 
    464467         
    465468  } 
     
    723726           
    724727 
    725           vssRays.SelectRays(mExportNumRays, rayBuffer[mPass], true); 
     728          if (useRayBuffer) 
     729                vssRays.SelectRays(mExportNumRays, rayBuffer[mPass], true); 
    726730           
    727731          ExportRays(filename, vssRays, mExportNumRays); 
     
    805809 
    806810 
    807   if (mExportRays && mUseImportanceSampling) { 
     811  if (useRayBuffer&& mExportRays && mUseImportanceSampling) { 
    808812        char filename[64]; 
    809813        sprintf(filename, "rss-rays-i.x3d"); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1692 r1694  
    3131// $$JB HACK 
    3232#define USE_KD_PVS 0 
    33 #define KD_PVS_AREA 1e-3f 
     33#define KD_PVS_AREA (5*1e-4f) 
    3434 
    3535namespace GtpVisibilityPreprocessor { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r1613 r1694  
    66Scene { 
    77 
    8 #filename ../data/arena/export.obj 
     8#filename ../data/Arena/arena-low-lods.obj 
     9# filename ../data/Arena/arena-high-lods.obj 
    910# filename ../data/City4M/City4M.obj 
    1011# filename ../data/CityModel/CityModel.obj 
     
    1516# filename ../data/vienna/vienna-buildings.x3d 
    1617#filename ../data/vienna/city1500_flat_1.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 
    17 filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 
    18  
    19 #;../data/vienna/vienna-plane.x3d; 
     18#filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d;../data/vienna/vienna-plane.x3d 
     19filename ../data/vienna/vienna.obj 
     20 
    2021# filename ../data/vienna/viewcells-25-sel.x3d 
    2122#filename ../data/atlanta/atlanta2.x3d 
    22 # filename ../data/soda/soda.dat 
     23#filename ../data/soda/soda.dat 
    2324#filename ../data/test1/test2.x3d 
    2425#filename ../data/soda/soda5.dat 
     
    4142# 0 = INTERNAL          1 = MLRT 
    4243 
    43         rayCastMethod 0 
     44        rayCastMethod 1 
    4445         
    4546#       type sampling 
     
    4849#       type render 
    4950        detectEmptyViewSpace true 
    50 #       pvsRenderErrorSamples 0 
    51         pvsRenderErrorSamples 5000 
     51        pvsRenderErrorSamples 0 
     52#       pvsRenderErrorSamples 5000 
    5253        quitOnFinish true 
    5354        computeVisibility true 
     
    7980        samplesPerPass 1000 
    8081        initialSamples 1000000 
    81         vssSamples 20000000 
    82         vssSamplesPerPass 500000 
     82        vssSamples 50000000 
     83#       vssSamples 1000000 
     84        vssSamplesPerPass 1000000 
    8385        useImportanceSampling true 
    8486 
     
    8991                pvs false 
    9092                rssTree false 
    91                 rays true 
     93                rays false 
    9294                numRays 2000 
    9395        } 
     
    146148        sahUseFaces false 
    147149        Termination { 
    148                 minCost 4 
     150                minCost 1 
    149151                maxDepth 30 
    150                 maxCostRatio 1.1 
     152                maxCostRatio 0.95 
    151153                ct_div_ci 0.5 
    152                 maxNodes 500000 
     154                maxNodes 200000 
    153155#500000  
    154156        } 
     
    181183 
    182184        #number of active view cells 
    183         active 5000 
    184         maxViewCells 5000 
     185        active 20000 
     186        maxViewCells 20000 
    185187 
    186188        maxStaticMemory 40 
     
    192194        #type vspKdTree 
    193195        #type bspTree 
    194         #type vspBspTree 
    195         type vspOspTree 
     196        type vspBspTree 
     197        #type vspOspTree 
    196198        #type sceneDependent 
    197199         
     
    218220                useRaysForMerge false 
    219221                compress false 
    220                 merge true 
     222                merge false 
    221223        } 
    222224 
     
    236238        } 
    237239 
    238         showVisualization true 
     240        showVisualization false 
    239241        evaluateViewCells false 
    240242         
     
    249251        } 
    250252 
    251 #       filename ../data/arena/viewcells-5000.xml 
     253#       filename ../data/Arena/viewcells-5000.xml 
     254#       filename ../data/Arena/viewcells-20000.xml 
    252255 
    253256#       filename ../data/atlanta/atlanta_viewcells_large.x3d 
     
    279282#       filename ../data/vienna/viewcells_vienna2.xml 
    280283#       filename ../data/vienna/vienna_simple-21-04-avs2-viewCells.xml 
    281 #       filename ../data/vienna/vienna-viewcells-5000.xml 
     284#       filename ../data/vienna/vienna-viewcells-5000.xml.gz 
    282285        filename ../data/vienna/vienna-viewcells-1000.xml.zip 
    283286#       filename ../data/vienna/vsposp-seq-viewCells.xml.gz 
     
    350353#               minGlobalCostRatio      0.0001 
    351354# $$MAXVIEWCELLS 
    352                 maxViewCells            1000 
     355                maxViewCells            20000 
    353356         
    354357 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1658 r1694  
    2323 
    2424#include "PreprocessorThread.h" 
     25#include "ObjExporter.h" 
     26#include "SceneGraph.h" 
     27 
     28 
    2529 
    2630#if !USE_QT && USE_THREADS 
     
    205209        } 
    206210 
     211        if (1) { 
     212          // export obj file 
     213          Exporter *exporter = new ObjExporter("scene.obj"); 
     214          exporter->ExportScene(preprocessor->mSceneGraph->GetRoot()); 
     215          delete exporter; 
     216        } 
     217         
     218         
    207219        const string externKdTree = ReplaceSuffix(filename, ".obj", ".kdf"); 
    208220        const string internKdTree = GetInternKdTreeName(filename); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro

    r1581 r1694  
    117117BvHierarchy.cpp  \ 
    118118BoostPreprocessorThread.cpp InternalRayCaster.cpp IntelRayCaster.cpp \ 
    119 RayCaster.cpp PreprocessorFactory.cpp GvsPreprocessor.cpp Trackball.cpp 
     119RayCaster.cpp PreprocessorFactory.cpp GvsPreprocessor.cpp \ 
     120Trackball.cpp ObjExporter.cpp SubdivisionCandidate.cpp 
    120121 
    121122 
Note: See TracChangeset for help on using the changeset viewer.