Changeset 2638
- Timestamp:
- 01/24/08 11:41:38 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2633 r2638 89 89 mSceneGraph->CollectObjects(mObjects); 90 90 91 #if 191 #if 0 92 92 viewCellsManager->GetViewPoint(mViewPoint); 93 93 mViewDirection = Vector3(0,0,1); 94 94 #else 95 96 mViewPoint = Vector3(1213.85, 176.988, -437.364); 97 mViewDirection = Vector3(0.433884, 0, -0.900969); 95 96 // for sg snapshot 97 mViewPoint = Vector3(18.5133, 10.9818, -1032.24); 98 mViewDirection = Vector3(-0.5373, 0, 0.843391); 99 100 // mViewPoint = Vector3(1213.85, 176.988, -437.364); 101 // mViewDirection = Vector3(0.433884, 0, -0.900969); 98 102 99 103 //mViewPoint = Vector3(1099.9,183.0,-387); … … 505 509 506 510 glEnd(); 507 511 508 512 glPopMatrix(); 513 514 #if 1 515 // test the box of the object 516 AxisAlignedBox3 box = leaf->GetBox(); 517 RenderBox(box); 518 #endif 509 519 } 510 520 -
GTP/trunk/Lib/Vis/Preprocessing/src/HavranRayCaster.cpp
r2635 r2638 433 433 castDoubleRay, pruneInvalidRays); 434 434 435 preprocessor->UpdateDynamicObjects(); 435 436 if ((int)rays.size() > 100000 && i % (100000/16) == 0) 436 437 cout<<"\r"<<offset<<"/"<<(int)rays.size()<<"\r"; -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r2636 r2638 9 9 #include "ViewCell.h" 10 10 #include "IntersectableWrapper.h" 11 11 12 12 13 … … 1065 1066 nodeStack.pop(); 1066 1067 if (node->IsLeaf() || node->mPvsTermination == 1) { 1067 Intersectable *object = GetOrCreateKdIntersectable(node);1068 1068 if (!node->Mailed()) { 1069 node->Mail(); 1070 objects.push_back(object); 1069 Intersectable *object = GetOrCreateKdIntersectable(node); 1070 node->Mail(); 1071 objects.push_back(object); 1071 1072 } 1072 1073 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r2634 r2638 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 23. I 01:44:33 20083 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 23. I 19:46:53 2008 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2636 r2638 1731 1731 1732 1732 SceneGraphLeaf *leaf = new SceneGraphLeaf(dynamic); 1733 1734 if (LoadBinaryObj(filename, leaf, NULL, 100)) 1735 { 1733 bool parsed = false; 1734 1735 if (strstr(filename.c_str(), ".obj")) { 1736 cout<<"parsing obj file.."<<endl; 1737 ObjParser *p = new ObjParser; 1738 parsed = p->ParseFile(filename, 1739 leaf, 1740 false); 1741 leaf->UpdateBox(); 1742 cout<<leaf->GetBox(); 1743 1744 float s = 10.0f; 1745 leaf->ApplyTransform(ScaleMatrix(s, s, s)); 1746 leaf->ApplyTransform(TranslationMatrix(Vector3(0, 10, 0))); 1747 1748 1749 } else { 1750 cout<<"parsing binary obj file.."<<endl; 1751 1752 parsed = LoadBinaryObj(filename, leaf, NULL, 100); 1753 } 1754 1755 if (parsed) 1756 { 1757 cout<<"success."<<endl; 1758 leaf->UpdateBox(); 1759 cout<<leaf->GetBox(); 1736 1760 mDynamicObjects.push_back(leaf); 1737 leaf->RebuildKtbTree();1761 // leaf->RebuildKtbTree(); 1738 1762 mSceneGraph->GetRoot()->mChildren.push_back(leaf); 1739 1763 1740 1764 if (mRayCaster) 1741 1765 mRayCaster->AddDynamicObjecs(leaf->mGeometry, leaf->GetTransformation()); 1742 1743 1766 1767 1744 1768 return true; 1745 } 1769 } else 1770 { 1771 cout<<"failed."<<endl; 1772 1773 } 1746 1774 1747 1775 #endif … … 1759 1787 AxisAlignedBox3 box = object->GetBox(); 1760 1788 1761 KdNode::NewMail();1762 1763 1789 ObjectContainer objects; 1764 // first mail all kDObjects which are intersected by the object 1765 preprocessor->mKdTree->CollectKdObjects(box, 1766 objects); 1767 1790 1791 if (0) { 1792 // simplified computation taking only the objects intersecting the box 1793 KdNode::NewMail(); 1794 1795 // first mail all kDObjects which are intersected by the object 1796 preprocessor->mKdTree->CollectKdObjects(box, 1797 objects); 1798 1799 } else { 1800 ViewCellContainer viewCells; 1801 mViewCellsManager->ComputeBoxIntersections(box, viewCells); 1802 1803 ViewCellContainer::const_iterator it = viewCells.begin(), it_end = viewCells.end(); 1804 1805 ObjectPvs pvs; 1806 1807 for (int i=0; it != it_end; ++ it, ++ i) { 1808 //cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl; 1809 pvs.MergeInPlace((*it)->GetPvs()); 1810 } 1811 1812 ObjectPvsIterator pit = pvs.GetIterator(); 1813 while (pit.HasMoreEntries()) { 1814 PvsData pvsData; 1815 Intersectable *object = pit.Next(pvsData); 1816 objects.push_back(object); 1817 } 1818 } 1819 1820 int pvsCounter = 0; 1768 1821 // now search for pvss which contained any mailed node 1769 1822 for (vit = mViewCellsManager->GetViewCells().begin(); vit != vit_end; ++ vit) { … … 1775 1828 // clear the pvs 1776 1829 pvs.Clear(); 1830 pvsCounter++; 1777 1831 break; 1778 1832 } 1779 1833 } 1780 1834 } 1835 1836 cout<<"Number of affected objects "<<objects.size()<<endl; 1837 cout<<"Cleared "<<pvsCounter<<" PVSs ("<<mViewCellsManager->GetViewCells().size()/ 1838 (float)pvsCounter*100.0f<<"%) "<<endl; 1781 1839 1782 1840 } … … 1786 1844 { 1787 1845 if (mUpdateDynamicObjects) { 1846 1788 1847 preprocessor->mRayCaster->DeleteDynamicObjects(); 1789 1848 1790 1849 for (int i=0; i < mDynamicObjects.size(); i++) { 1791 1850 SceneGraphLeaf *l = mDynamicObjects[i]; 1851 cout<<"Updating dynamic objects in ray caster..."<<endl; 1792 1852 mRayCaster->AddDynamicObjecs(l->mGeometry, l->GetTransformation()); 1853 cout<<"done."<<endl; 1854 cout<<"Updating affected PVSs..."<<endl; 1793 1855 preprocessor->ObjectMoved(l); 1856 cout<<"done."<<endl; 1857 1794 1858 } 1795 1859 mUpdateDynamicObjects = false; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2636 r2638 600 600 glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); 601 601 602 mUseForcedColors = true; 603 604 glColor3f(0.0f, 0.8f, 0.2f); 602 //mUseForcedColors = true; 603 604 // glColor3f(0.0f, 0.8f, 0.2f); 605 // glColor3f(0.5f, 0.5f, 0.5f); 606 607 glColor3f(0.6f, 0.6f, 0.6f); 605 608 606 609 // Render PVS … … 617 620 618 621 SetupCamera(); 622 623 mUseForcedColors = true; 619 624 620 625 glColor3f(1.0f, 0.0f, 0.0f); … … 705 710 case 0: 706 711 { 712 if (e->modifiers() & Qt::ShiftModifier) { 713 const Vector3 transl(0, diffy, 0); 714 tm = TranslationMatrix(transl); 715 716 } else { 707 717 const Vector3 transl(diffx, 0, diffy); 708 709 718 tm = TranslationMatrix(transl); 719 } 710 720 } 711 721 break; … … 720 730 case 2: 721 731 { 722 tm = RotationXMatrix(diffx) * RotationYMatrix(diffy); 732 // tm = RotationXMatrix(diffx) * RotationYMatrix(diffy); 733 tm = RotationYMatrix(diffx); 723 734 } 724 735 break; … … 791 802 RenderInfo(); 792 803 mFrame ++; 804 // cout<<"vp="<<mViewPoint<<" vd="<<mViewDirection<<endl; 793 805 } 794 806 … … 1094 1106 void QtGlRendererWidget::LoadObject() 1095 1107 { 1096 string filename("../data/teapot.bn"); 1108 // string filename("../data/teapot.bn"); 1109 // string filename("../data/teapot.bn"); 1110 string filename("../data/cube.obj"); 1097 1111 1098 1112 cout << "Loading model << " << filename << endl; … … 1254 1268 renderText(20, 40, s); 1255 1269 #endif 1256 1270 #if 0 1257 1271 QFont font40; font40.setPointSize(30); 1258 1272 s.sprintf("PVS: %04d", mPvsSize); 1259 1273 renderText(20, 40, s, font40); 1260 1274 #endif 1275 1261 1276 /* QFont font40; font40.setPointSize(30); 1262 1277 s.sprintf("New triangles: %04d", 100); -
GTP/trunk/Lib/Vis/Preprocessing/src/RenderSampler.cpp
r1004 r2638 27 27 Environment::GetSingleton()->GetBoolValue("RenderSampler.useOcclusionQueries", useOcclusionQueries); 28 28 29 #if SG08_HACK 30 // evaluate histogram of loaded pvs solution 31 32 33 34 35 #endif 36 37 38 39 29 40 Debug << "************* render sampler ****************" << endl; 30 41 Debug << "threshold: " << threshold << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2635 r2638 3371 3371 // $$ warning collect objects takes only unmailed ones! 3372 3372 if (mUseKdPvs) { 3373 //GetPreprocessor()->mKdTree->CollectKdObjects(box, objects);3374 GetPreprocessor()->mKdTree->CollectSmallKdObjects(box, objects, 0.02f);3373 GetPreprocessor()->mKdTree->CollectKdObjects(box, objects); 3374 //GetPreprocessor()->mKdTree->CollectSmallKdObjects(box, objects, 0.02f); 3375 3375 3376 3376 } else -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2625 r2638 635 635 VizBuffer mVizBuffer; 636 636 637 /** Intersects box with the tree and returns the number of intersected boxes. 638 @returns number of view cells found 639 */ 640 virtual int ComputeBoxIntersections(const AxisAlignedBox3 &box, 641 ViewCellContainer &viewCells) const; 637 642 638 643 protected: … … 649 654 int rightIdx) const; 650 655 651 /** Intersects box with the tree and returns the number of intersected boxes.652 @returns number of view cells found653 */654 virtual int ComputeBoxIntersections(const AxisAlignedBox3 &box,655 ViewCellContainer &viewCells) const;656 656 /** Tests the visibility filter functionality. 657 657 */ -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r2635 r2638 185 185 splitMethod SAH 186 186 splitBorder 0.01 187 pvsArea 1e- 3187 pvsArea 1e-4 188 188 } 189 189 -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test2
r2636 r2638 4 4 5 5 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 6 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=20000000 -mutation_use_pass_importance- -mutation_silhouette_search_steps=3 -preprocessor_ray_cast_method=3 -preprocessor_detect_empty_viewspace+"6 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=50000000 -samples_per_pass=1000000 -total_samples=20000000 -mutation_use_pass_importance- -mutation_silhouette_search_steps=3 -preprocessor_ray_cast_method=1 -preprocessor_detect_empty_viewspace+ -total_time=140" 7 7 8 8 #SCENE="../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d" … … 29 29 #VIEWCELLS=../data/test1/test-viewcells.xml 30 30 31 #SCENE=../data/Arena/arena-high-lods.obj32 #VIEWCELLS=../data/Arena/arena-high-lods-5000-viewcells.xml.gz31 SCENE=../data/Arena/arena-high-lods.obj 32 VIEWCELLS=../data/Arena/arena-high-lods-5000-viewcells.xml.gz 33 33 #VIEWCELLS=../data/Arena/viewcells-5000.xml.gz 34 34 #VIEWCELLS=../data/Arena/arena-high-lods-57000-viewcells.xml.gz 35 35 36 36 37 SCENE=../data/vienna/vienna_cropped.obj 38 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 37 # SCENE=../data/vienna/vienna_cropped.obj 38 # VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 39 #VIEWCELLS=../data/vienna/vienna_cropped-20000-viewcells.xml.gz 39 40 40 41 #VIEWCELLS=../data/vienna/vienna-sequential-30000-single-viewcell.xml 41 42 42 43 43 # 44 # 44 #SCENE=../data/Pompeii/PompeiiTen.obj 45 #VIEWCELLS=../data/Pompeii/pompeii_big-seq-viewcells.xml.gz 45 46 46 47 PREFIX=../work/plots/osp-TEST … … 58 59 59 60 60 $COMMAND -preprocessor= combined-scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \61 $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 61 62 -rss_distributions=mutation+object_direction+spatial \ 63 -mutation_silhouette_prob=0.5 \ 64 -mutation_reverse_samples_distance=1.0 \ 65 -mutation_radius_origin=1.0 \ 66 -mutation_radius_termination=0.2 \ 67 -mutation_use_unsucc_count_importance+ \ 68 -mutation_use_pass_importance- \ 69 -mutation_buffer_size=2000000 \ 62 70 -view_cells_use_kd_pvs+ -af_use_kd_pvs+ -view_cells_filter_width=1.0 \ 63 71 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \
Note: See TracChangeset
for help on using the changeset viewer.