Changeset 2715


Ignore:
Timestamp:
05/27/08 10:57:05 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna

    r2712 r2715  
    1010#SCENE=../data/vienna/vienna_cropped.obj 
    1111#SCENE=../data/vienna/city_full.obj 
    12 SCENE=../data/vienna/city_full_hp.obj 
    13 #SCENE=../data/vienna/vienna_rep.obj 
     12#SCENE=../data/vienna/city_full_hp.obj 
     13SCENE=../data/vienna/vienna_rep.obj 
    1414 
    1515VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 
     
    3131#DISTRIBUTIONS=spatial 
    3232 
    33 # $COMMAND -preprocessor=combined \ 
    34 # -scene_filename=$SCENE \ 
    35 # -view_cells_filename=$VIEWCELLS \ 
    36 # -rss_distributions=$DISTRIBUTIONS \ 
    37 # -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 
    38 # -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ 
    39 # -preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \ 
    40 # -preprocessor_detect_empty_viewspace+ \ 
    41 # -preprocessor_use_vbos- \ 
    42 # -preprocessor_ray_cast_method=1 \ 
    43 # -view_cells_random_viewpoint_list=$VIEWPOINTS \ 
    44 # demo1.env 
     33 $COMMAND -preprocessor=combined \ 
     34 -scene_filename=$SCENE \ 
     35 -view_cells_filename=$VIEWCELLS \ 
     36 -rss_distributions=$DISTRIBUTIONS \ 
     37 -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 
     38 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ 
     39 -preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \ 
     40 -preprocessor_detect_empty_viewspace+ \ 
     41 -preprocessor_use_vbos- \ 
     42 -preprocessor_ray_cast_method=3 \ 
     43 -view_cells_random_viewpoint_list=$VIEWPOINTS \ 
     44 demo1.env 
    4545 
    46 $COMMAND -preprocessor=sampling \ 
    47 -scene_filename=$SCENE \ 
    48 -view_cells_filename=$VIEWCELLS \ 
    49 -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 
    50 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ 
    51 -preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \ 
    52 -preprocessor_detect_empty_viewspace+ \ 
    53 -preprocessor_use_vbos- \ 
    54 -preprocessor_ray_cast_method=1 \ 
    55 -view_cells_random_viewpoint_list=$VIEWPOINTS \ 
    56 demo1.env 
     46#$COMMAND -preprocessor=sampling \ 
     47#-scene_filename=$SCENE \ 
     48#-view_cells_filename=$VIEWCELLS \ 
     49#-view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 
     50#-preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ 
     51#-preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \ 
     52#-preprocessor_detect_empty_viewspace+ \ 
     53#-preprocessor_use_vbos- \ 
     54#-preprocessor_ray_cast_method=1 \ 
     55#-view_cells_random_viewpoint_list=$VIEWPOINTS \ 
     56#demo1.env 
    5757 
    5858 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2714 r2715  
    15991599        } 
    16001600 
    1601         cout << "\**************\n******* new object has id " << currentId << endl; 
     1601        cout << "new object registered with id " << currentId << endl; 
    16021602 
    16031603        ++ sCurrentDynamicId; 
     
    16051605        // tell ray caster to update 
    16061606        ScheduleUpdateDynamicObjects(); 
    1607  
    1608         if (0)  
    1609         { 
    1610                 // add to scene graph 
    1611                 mSceneGraph->GetRoot()->mChildren.push_back(leaf); 
    1612                 // add to ray caster 
    1613                 if (mRayCaster) 
    1614                         mRayCaster->AddDynamicObjecs(leaf->mGeometry, leaf->GetTransformation()); 
    1615         } 
    1616         // $$ JB in order to compile 
    1617         //return leaf; 
    16181607} 
    16191608 
     
    17691758          preprocessor->mRayCaster->DeleteDynamicObjects(); 
    17701759           
    1771 #define MULTIPLE_OBJECTS 0 
    1772 #define CREATE_TRANSF_COPIES_OF_DYN_OBJECTS      1 
     1760#define MULTIPLE_OBJECTS 1 
    17731761 
    17741762#if MULTIPLE_OBJECTS  
    1775 #if CREATE_TRANSF_COPIES_OF_DYN_OBJECTS  
    17761763          static ObjectContainer objects; 
    17771764           
    1778           if (objects.size()) { 
    1779                 for (size_t i = 0; i < objects.size(); ++ i) { 
    1780                   delete objects[i]; 
    1781                 } 
    1782                 objects.clear(); 
    1783           } 
     1765          CLEAR_CONTAINER(objects); 
    17841766           
    17851767          for (size_t i = 0; i < mDynamicObjects.size(); ++ i) { 
     
    17891771                        Triangle3 t(((TriangleIntersectable *)l->mGeometry[j])->GetItem()); 
    17901772                        t.ApplyTransformation(l->GetTransformation()); 
    1791                         objects.push_back(new TriangleIntersectable(t)); 
     1773                        TriangleIntersectable *to = new TriangleIntersectable(t); 
     1774                        to->SetId(l->GetIntersectable()->GetId()); 
     1775 
     1776                        objects.push_back(to); 
    17921777                  } 
    17931778                } 
    17941779          } 
    17951780          mRayCaster->AddDynamicObjecs(objects, IdentityMatrix()); 
    1796 #else 
    1797           mRayCaster->AddDynamicObjecs(objects, IdentityMatrix()); 
    1798 #endif 
    17991781#endif     
    18001782 
     
    18021784           
    18031785          for (size_t i = 0; i < mDynamicObjects.size(); ++ i)  
    1804                 { 
     1786          { 
    18051787                  SceneGraphLeaf *l = mDynamicObjects[i]; 
    18061788 
    18071789#if  !MULTIPLE_OBJECTS 
    1808                   UpdateObjectInRayCaster(l); 
     1790                  PrepareObjectsForRayCaster(l); 
    18091791#endif 
    18101792 
    18111793                  if (l->HasChanged()) 
    1812                         { 
    1813                            
     1794                  { 
    18141795                          cout<<"Updating affected PVSs..."<<endl; 
    18151796                          preprocessor->ObjectMoved(l); 
    18161797                          cout<<"done."<<endl;   
    18171798                          l->SetHasChanged(false); 
    1818                         } 
    1819                 } 
    1820  
     1799                  } 
     1800          } 
    18211801 
    18221802          mUpdateDynamicObjects = false; 
     
    18321812 
    18331813 
    1834 void Preprocessor::UpdateObjectInRayCaster(SceneGraphLeaf *l) 
     1814void Preprocessor::PrepareObjectsForRayCaster(SceneGraphLeaf *l) 
    18351815{ 
    18361816        cout<<"Updating dynamic objects in ray caster..."<<endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r2709 r2715  
    200200        void RegisterDynamicObject(SceneGraphLeaf *leaf); 
    201201         
    202         void UpdateObjectInRayCaster(SceneGraphLeaf *l); 
     202        void PrepareObjectsForRayCaster(SceneGraphLeaf *l); 
    203203         
    204204        void ScheduleUpdateDynamicObjects(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2711 r2715  
    574574        DynamicObjectsContainer::const_iterator dit, dit_end = mDynamicPvsObjects.end(); 
    575575 
     576        //cout << "dynamic objects in pvs " << mDynamicPvsObjects.size() << endl;; 
     577 
    576578        for (dit = mDynamicPvsObjects.begin(); dit != dit_end; ++ dit) 
    577579        { 
    578580                _RenderDynamicObject(*dit); 
    579581        } 
     582 
     583        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
    580584 
    581585        // show placed dynamic objects as wireframe 
    582586        Preprocessor *p = mViewCellsManager->GetPreprocessor(); 
    583         dit, dit_end = p->mDynamicObjects.end(); 
     587        dit_end = p->mDynamicObjects.end(); 
    584588 
    585589        int i = 0; 
     
    591595                        glColor3f(0, 1, 0); 
    592596 
    593                 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
    594597                _RenderDynamicObject(*dit); 
    595                 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 
    596         } 
     598        } 
     599         
     600        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 
    597601} 
    598602 
     
    20022006     
    20032007        QVBoxLayout *vbox2 = new QVBoxLayout; 
    2004         QGroupBox *groupBox = new QGroupBox("Trafo types"); 
     2008        QGroupBox *groupBox = new QGroupBox("Dynamic Obojects"); 
    20052009 
    20062010        vbox2->addWidget(rb1); 
     
    20212025        connect(button, SIGNAL(clicked()), SIGNAL(DeleteDynamicObject())); 
    20222026         
     2027        button = new QPushButton("Next object", groupBox); 
     2028        vbox2->layout()->addWidget(button); 
     2029        connect(button, SIGNAL(clicked()), SIGNAL(NextObject())); 
     2030 
    20232031        groupBox->setLayout(vbox2); 
    20242032         
     
    23982406#endif 
    23992407 
    2400  
    2401          
    2402  
    24032408#if REMOVE_TEMPORARY 
    24042409         
     
    24382443        connect(button, SIGNAL(clicked()), SIGNAL(ComputeGVS())); 
    24392444#endif 
    2440  
    2441 #if 1    
     2445         
    24422446        button = new QPushButton("Replay view points", vbox); 
    24432447        vbox->layout()->addWidget(button); 
    24442448        connect(button, SIGNAL(clicked()), SIGNAL(ReplayViewPoints())); 
    24452449 
    2446 #endif 
    2447  
    2448         button = new QPushButton("Next object", vbox); 
    2449         vbox->layout()->addWidget(button); 
    2450         connect(button, SIGNAL(clicked()), SIGNAL(NextObject())); 
    2451         //connect(button, SIGNAL(clicked()), SIGNAL(LoadObject())); 
    24522450 
    24532451        /*cb = new QCheckBox("Stats", vbox); 
     
    26312629                if (mUseRandomColorPerPvsObject) 
    26322630                { 
    2633                         KdIntersectable *kdint = static_cast<KdIntersectable *>(obj); 
    2634  
    2635                         if (kdint->mGenericIdx == -1) 
     2631                        if (obj->Type() == Intersectable::KD_INTERSECTABLE) 
    26362632                        { 
    2637                                 kdint->mGenericIdx = (int)mColors.size(); 
    2638                                 mColors.push_back(RandomColor(0, 1)); 
     2633                                KdIntersectable *kdint = static_cast<KdIntersectable *>(obj); 
     2634 
     2635                                if (kdint->mGenericIdx == -1) 
     2636                                { 
     2637                                        kdint->mGenericIdx = (int)mColors.size(); 
     2638                                        mColors.push_back(RandomColor(0, 1)); 
     2639                                } 
     2640                                color = mColors[kdint->mGenericIdx]; 
    26392641                        } 
    2640                         color = mColors[kdint->mGenericIdx]; 
    26412642                }  
    26422643                else 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp

    r2710 r2715  
    3939SceneGraphLeaf::~SceneGraphLeaf() 
    4040{ 
    41     CLEAR_CONTAINER(mGeometry); 
     41        if (mDeleteGeometry) 
     42                CLEAR_CONTAINER(mGeometry); 
    4243} 
    4344 
     
    278279 
    279280 
    280 SceneGraphLeaf::SceneGraphLeaf(): mIsDynamic(false), mHasChanged(true) 
     281SceneGraphLeaf::SceneGraphLeaf():  
     282mIsDynamic(false), mHasChanged(true), mDeleteGeometry(true) 
    281283{ 
    282284        mTrafo = IdentityMatrix(); 
     
    285287 
    286288 
    287 SceneGraphLeaf::SceneGraphLeaf(bool isDynamic): mIsDynamic(isDynamic), mHasChanged(true) 
     289SceneGraphLeaf::SceneGraphLeaf(bool isDynamic):  
     290mIsDynamic(isDynamic), mHasChanged(true), mDeleteGeometry(true) 
    288291{ 
    289292    mTrafo = IdentityMatrix(); 
     
    327330{ 
    328331        // hack: should just pass a IntersectableGroup as a whole 
    329         // instead we duplicate the object container and create a new 
    330         // leaf 
     332        // instead we duplicate the geometry vector 
    331333        mGeometry = copy.mGeometry; 
    332         //for (size_t i = 0; i < copy.mGeometry->size(); ++ i) 
    333         //      mGeometry.push_back(copy.mGeometry[i]); 
    334334 
    335335        mBox = copy.mBox; 
     
    339339        mIntersectable = new SceneGraphLeafIntersectable(this, mBox); 
    340340        mHasChanged = true; 
    341 } 
    342  
    343 } 
     341 
     342        // hack: the geometry should not be deleted here because this 
     343        // is just a copy 
     344        mDeleteGeometry = false; 
     345} 
     346 
     347} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h

    r2709 r2715  
    9696 
    9797        Matrix4x4 mTrafo; 
     98 
     99        bool mDeleteGeometry; 
    98100}; 
    99101 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor05.vcproj

    r2712 r2715  
    157157                                LinkIncremental="1" 
    158158                                AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;..\src\GL;&quot;..\lib05\$(ConfigurationName)&quot;;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;&quot;..\MultiLevelRayTracing\RTScene\$(ConfigurationName)&quot;;&quot;..\MultiLevelRayTracing\RTWorld\$(ConfigurationName)&quot;;&quot;QtInterface\$(ConfigurationName)&quot;;&quot;..\..\..\..\..\..\NonGTP\Xerces\xerces-c_2_8_0\lib&quot;;&quot;$(CG_LIB_PATH)&quot;" 
    159                                 GenerateDebugInformation="false" 
     159                                GenerateDebugInformation="true" 
    160160                                SubSystem="1" 
    161161                                LargeAddressAware="2" 
Note: See TracChangeset for help on using the changeset viewer.