Changeset 2715 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 05/27/08 10:57:05 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna
r2712 r2715 10 10 #SCENE=../data/vienna/vienna_cropped.obj 11 11 #SCENE=../data/vienna/city_full.obj 12 SCENE=../data/vienna/city_full_hp.obj13 #SCENE=../data/vienna/vienna_rep.obj12 #SCENE=../data/vienna/city_full_hp.obj 13 SCENE=../data/vienna/vienna_rep.obj 14 14 15 15 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz … … 31 31 #DISTRIBUTIONS=spatial 32 32 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.env33 $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 45 45 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.env46 #$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 57 57 58 58 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2714 r2715 1599 1599 } 1600 1600 1601 cout << " \**************\n******* new object hasid " << currentId << endl;1601 cout << "new object registered with id " << currentId << endl; 1602 1602 1603 1603 ++ sCurrentDynamicId; … … 1605 1605 // tell ray caster to update 1606 1606 ScheduleUpdateDynamicObjects(); 1607 1608 if (0)1609 {1610 // add to scene graph1611 mSceneGraph->GetRoot()->mChildren.push_back(leaf);1612 // add to ray caster1613 if (mRayCaster)1614 mRayCaster->AddDynamicObjecs(leaf->mGeometry, leaf->GetTransformation());1615 }1616 // $$ JB in order to compile1617 //return leaf;1618 1607 } 1619 1608 … … 1769 1758 preprocessor->mRayCaster->DeleteDynamicObjects(); 1770 1759 1771 #define MULTIPLE_OBJECTS 0 1772 #define CREATE_TRANSF_COPIES_OF_DYN_OBJECTS 1 1760 #define MULTIPLE_OBJECTS 1 1773 1761 1774 1762 #if MULTIPLE_OBJECTS 1775 #if CREATE_TRANSF_COPIES_OF_DYN_OBJECTS1776 1763 static ObjectContainer objects; 1777 1764 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); 1784 1766 1785 1767 for (size_t i = 0; i < mDynamicObjects.size(); ++ i) { … … 1789 1771 Triangle3 t(((TriangleIntersectable *)l->mGeometry[j])->GetItem()); 1790 1772 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); 1792 1777 } 1793 1778 } 1794 1779 } 1795 1780 mRayCaster->AddDynamicObjecs(objects, IdentityMatrix()); 1796 #else1797 mRayCaster->AddDynamicObjecs(objects, IdentityMatrix());1798 #endif1799 1781 #endif 1800 1782 … … 1802 1784 1803 1785 for (size_t i = 0; i < mDynamicObjects.size(); ++ i) 1804 1786 { 1805 1787 SceneGraphLeaf *l = mDynamicObjects[i]; 1806 1788 1807 1789 #if !MULTIPLE_OBJECTS 1808 UpdateObjectInRayCaster(l);1790 PrepareObjectsForRayCaster(l); 1809 1791 #endif 1810 1792 1811 1793 if (l->HasChanged()) 1812 { 1813 1794 { 1814 1795 cout<<"Updating affected PVSs..."<<endl; 1815 1796 preprocessor->ObjectMoved(l); 1816 1797 cout<<"done."<<endl; 1817 1798 l->SetHasChanged(false); 1818 } 1819 } 1820 1799 } 1800 } 1821 1801 1822 1802 mUpdateDynamicObjects = false; … … 1832 1812 1833 1813 1834 void Preprocessor:: UpdateObjectInRayCaster(SceneGraphLeaf *l)1814 void Preprocessor::PrepareObjectsForRayCaster(SceneGraphLeaf *l) 1835 1815 { 1836 1816 cout<<"Updating dynamic objects in ray caster..."<<endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r2709 r2715 200 200 void RegisterDynamicObject(SceneGraphLeaf *leaf); 201 201 202 void UpdateObjectInRayCaster(SceneGraphLeaf *l);202 void PrepareObjectsForRayCaster(SceneGraphLeaf *l); 203 203 204 204 void ScheduleUpdateDynamicObjects(); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2711 r2715 574 574 DynamicObjectsContainer::const_iterator dit, dit_end = mDynamicPvsObjects.end(); 575 575 576 //cout << "dynamic objects in pvs " << mDynamicPvsObjects.size() << endl;; 577 576 578 for (dit = mDynamicPvsObjects.begin(); dit != dit_end; ++ dit) 577 579 { 578 580 _RenderDynamicObject(*dit); 579 581 } 582 583 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 580 584 581 585 // show placed dynamic objects as wireframe 582 586 Preprocessor *p = mViewCellsManager->GetPreprocessor(); 583 dit , dit_end = p->mDynamicObjects.end();587 dit_end = p->mDynamicObjects.end(); 584 588 585 589 int i = 0; … … 591 595 glColor3f(0, 1, 0); 592 596 593 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);594 597 _RenderDynamicObject(*dit); 595 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 596 } 598 } 599 600 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 597 601 } 598 602 … … 2002 2006 2003 2007 QVBoxLayout *vbox2 = new QVBoxLayout; 2004 QGroupBox *groupBox = new QGroupBox(" Trafo types");2008 QGroupBox *groupBox = new QGroupBox("Dynamic Obojects"); 2005 2009 2006 2010 vbox2->addWidget(rb1); … … 2021 2025 connect(button, SIGNAL(clicked()), SIGNAL(DeleteDynamicObject())); 2022 2026 2027 button = new QPushButton("Next object", groupBox); 2028 vbox2->layout()->addWidget(button); 2029 connect(button, SIGNAL(clicked()), SIGNAL(NextObject())); 2030 2023 2031 groupBox->setLayout(vbox2); 2024 2032 … … 2398 2406 #endif 2399 2407 2400 2401 2402 2403 2408 #if REMOVE_TEMPORARY 2404 2409 … … 2438 2443 connect(button, SIGNAL(clicked()), SIGNAL(ComputeGVS())); 2439 2444 #endif 2440 2441 #if 1 2445 2442 2446 button = new QPushButton("Replay view points", vbox); 2443 2447 vbox->layout()->addWidget(button); 2444 2448 connect(button, SIGNAL(clicked()), SIGNAL(ReplayViewPoints())); 2445 2449 2446 #endif2447 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()));2452 2450 2453 2451 /*cb = new QCheckBox("Stats", vbox); … … 2631 2629 if (mUseRandomColorPerPvsObject) 2632 2630 { 2633 KdIntersectable *kdint = static_cast<KdIntersectable *>(obj); 2634 2635 if (kdint->mGenericIdx == -1) 2631 if (obj->Type() == Intersectable::KD_INTERSECTABLE) 2636 2632 { 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]; 2639 2641 } 2640 color = mColors[kdint->mGenericIdx];2641 2642 } 2642 2643 else -
GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp
r2710 r2715 39 39 SceneGraphLeaf::~SceneGraphLeaf() 40 40 { 41 CLEAR_CONTAINER(mGeometry); 41 if (mDeleteGeometry) 42 CLEAR_CONTAINER(mGeometry); 42 43 } 43 44 … … 278 279 279 280 280 SceneGraphLeaf::SceneGraphLeaf(): mIsDynamic(false), mHasChanged(true) 281 SceneGraphLeaf::SceneGraphLeaf(): 282 mIsDynamic(false), mHasChanged(true), mDeleteGeometry(true) 281 283 { 282 284 mTrafo = IdentityMatrix(); … … 285 287 286 288 287 SceneGraphLeaf::SceneGraphLeaf(bool isDynamic): mIsDynamic(isDynamic), mHasChanged(true) 289 SceneGraphLeaf::SceneGraphLeaf(bool isDynamic): 290 mIsDynamic(isDynamic), mHasChanged(true), mDeleteGeometry(true) 288 291 { 289 292 mTrafo = IdentityMatrix(); … … 327 330 { 328 331 // 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 331 333 mGeometry = copy.mGeometry; 332 //for (size_t i = 0; i < copy.mGeometry->size(); ++ i)333 // mGeometry.push_back(copy.mGeometry[i]);334 334 335 335 mBox = copy.mBox; … … 339 339 mIntersectable = new SceneGraphLeafIntersectable(this, mBox); 340 340 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 96 96 97 97 Matrix4x4 mTrafo; 98 99 bool mDeleteGeometry; 98 100 }; 99 101 -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor05.vcproj
r2712 r2715 157 157 LinkIncremental="1" 158 158 AdditionalLibraryDirectories=""$(QTDIR)\lib";..\src\GL;"..\lib05\$(ConfigurationName)";..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;"..\MultiLevelRayTracing\RTScene\$(ConfigurationName)";"..\MultiLevelRayTracing\RTWorld\$(ConfigurationName)";"QtInterface\$(ConfigurationName)";"..\..\..\..\..\..\NonGTP\Xerces\xerces-c_2_8_0\lib";"$(CG_LIB_PATH)"" 159 GenerateDebugInformation=" false"159 GenerateDebugInformation="true" 160 160 SubSystem="1" 161 161 LargeAddressAware="2"
Note: See TracChangeset
for help on using the changeset viewer.