Changeset 2620 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 01/21/08 16:10:52 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2619 r2620 26 26 27 27 // if 1 = SAFE RENDERING OF PVS primitives without VBOs for Pvs error estimation 28 #define EVAL_ERROR 128 #define EVAL_ERROR 0 29 29 30 30 namespace GtpVisibilityPreprocessor { … … 449 449 } 450 450 451 452 451 453 void 452 454 GlRenderer::_RenderScene() … … 516 518 for (; oi != mObjects.end(); oi++) { 517 519 518 520 if ((*oi)->Type() == Intersectable::TRIANGLE_INTERSECTABLE) { 519 521 TriangleIntersectable *object = (TriangleIntersectable *)*oi; 520 522 Triangle3 *t = &(object->GetItem()); … … 525 527 glVertex3f(t->mVertices[1].x, t->mVertices[1].y, t->mVertices[1].z); 526 528 glVertex3f(t->mVertices[2].x, t->mVertices[2].y, t->mVertices[2].z); 527 528 } 529 } 529 530 } 530 531 … … 834 835 GlRenderer::RenderKdNode(KdNode *node) 835 836 { 836 837 if (node->IsLeaf()) 837 838 { 838 839 #if !EVAL_ERROR … … 843 844 { 844 845 RenderIntersectable(leaf->mObjects[i]); 846 845 847 } 846 848 #endif … … 1577 1579 // compute the pixel error 1578 1580 float error = GetPixelError(pvsSize); 1579 1581 1580 1582 mPvsErrorBuffer[i].mError = error; 1581 1583 mPvsErrorBuffer[i].mPvsSize = pvsSize; … … 1685 1687 void GlRenderer::EnableDrawArrays() 1686 1688 { 1687 1688 1689 glEnableClientState(GL_VERTEX_ARRAY); 1690 glEnableClientState(GL_NORMAL_ARRAY); 1689 1691 } 1690 1692 … … 1771 1773 #endif 1772 1774 1775 1776 1777 void GlRenderer::PreparePvs(const ObjectPvs &pvs) 1778 { 1779 int indexBufferSize = 0; 1780 1781 KdNode::NewMail(); 1782 //Intersectable::NewMail(); 1783 1784 1785 ObjectPvsIterator it = pvs.GetIterator(); 1786 1787 while (it.HasMoreEntries()) 1788 { 1789 Intersectable *obj = it.Next(); 1790 switch (obj->Type()) 1791 { 1792 case Intersectable::KD_INTERSECTABLE: 1793 { 1794 KdNode *node = static_cast<KdIntersectable *>(obj)->GetItem(); 1795 _UpdatePvsIndices(node, indexBufferSize); 1796 } 1797 break; 1798 1799 } 1800 } 1801 1802 mIndexBufferSize = indexBufferSize; 1803 } 1804 1805 void GlRenderer::_UpdatePvsIndices(KdNode *node, int &indexBufferSize) 1806 { 1807 if (node->Mailed()) 1808 return; 1809 1810 node->Mail(); 1811 1812 // if (mObjects.size() * 3 < indexBufferSize) cerr << "problem: " << mObjects.size() * 3 << " < " << indexBufferSize << endl; 1813 if (!node->IsLeaf()) 1814 { 1815 KdInterior *kdInterior = static_cast<KdInterior *>(node); 1816 1817 _UpdatePvsIndices(kdInterior->mBack, indexBufferSize); 1818 _UpdatePvsIndices(kdInterior->mFront, indexBufferSize); 1819 } 1820 else 1821 { 1822 KdLeaf *leaf = static_cast<KdLeaf *>(node); 1823 1824 leaf->mIndexBufferStart = indexBufferSize; 1825 1826 for (size_t i = 0; i < leaf->mObjects.size(); ++ i) 1827 { 1828 TriangleIntersectable *obj = 1829 static_cast<TriangleIntersectable *>(leaf->mObjects[i]); 1830 1831 if (obj->mRenderedFrame != mCurrentFrame) 1832 { 1833 obj->mRenderedFrame = mCurrentFrame; 1834 1835 mIndices[indexBufferSize + 0] = (obj->GetId() - 1) * 3 + 0; 1836 mIndices[indexBufferSize + 1] = (obj->GetId() - 1) * 3 + 1; 1837 mIndices[indexBufferSize + 2] = (obj->GetId() - 1) * 3 + 2; 1838 1839 indexBufferSize += 3; 1840 } 1841 } 1842 1843 leaf->mIndexBufferSize = indexBufferSize - leaf->mIndexBufferStart; 1844 } 1845 1846 //cout << "id: " << indexBufferSize << endl; 1847 } 1773 1848 1774 1849 void GlRenderer::CreateVertexArrays(SceneGraphLeaf *leaf) -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r2615 r2620 174 174 EvalPvsStat(); 175 175 176 void PreparePvs(const ObjectPvs &pvs); 177 void _UpdatePvsIndices(KdNode *node, int &indexBufferSize); 178 179 176 180 virtual void EvalPvsStat(const SimpleRayContainer &viewPoints); 177 181 … … 211 215 212 216 PvsRenderStatistics mPvsStat; 217 218 unsigned int mIndexBufferSize; 213 219 214 220 int mPvsStatFrames; -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r2617 r2620 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: ne 20. I 00:39:4220083 # Generated by qmake (2.00a) (Qt 4.1.2) on: po 21. I 14:57:24 2008 4 4 # Project: preprocessor.pro 5 5 # Template: app … … 63 63 $(MAKE) -f $(MAKEFILE).Debug uninstall 64 64 65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc 2005\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc.net\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \ 66 66 C:\Qt\4.1.2\mkspecs\features\qt_config.prf \ 67 67 C:\Qt\4.1.2\mkspecs\features\exclusive_builds.prf \ -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2619 r2620 21 21 #define USE_CG 1 22 22 23 #define TEST_PVS_RENDERING 123 #define TEST_PVS_RENDERING 0 24 24 25 25 #if USE_CG … … 91 91 GlRendererBuffer(sceneGraph, viewcells, tree) 92 92 { 93 mUseVbos = true; 93 94 MakeCurrent(); 94 95 InitGL(); … … 96 97 } 97 98 99 void 100 QtGlRendererBuffer::RenderPvs(const ObjectPvs &pvs) 101 { 102 #if TEST_PVS_RENDERING 103 104 // Render PVS 105 ObjectPvsIterator it = pvs.GetIterator(); 106 107 Intersectable::NewMail(); 108 mCurrentFrame++; 109 while (it.HasMoreEntries()) 110 { 111 RenderIntersectable(it.Next()); 112 } 113 114 #else 115 116 PreparePvs(pvs); 117 118 int offset = (int)mObjects.size() * 3; 119 char *arrayPtr = mUseVbos ? NULL : (char *)mData; 120 121 glVertexPointer(3, GL_FLOAT, 0, (char *)arrayPtr); 122 glNormalPointer(GL_FLOAT, 0, (char *)arrayPtr + offset * sizeof(Vector3)); 123 glDrawElements(GL_TRIANGLES, mIndexBufferSize, GL_UNSIGNED_INT, mIndices); 124 125 #endif 126 } 98 127 99 128 // reimplemented here so that we can snap the error windows … … 133 162 glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); 134 163 135 136 // Render PVS137 ObjectPvsIterator it = pvs.GetIterator();138 164 139 165 pvsSize = pvs.GetSize(); 140 166 cout<<pvsSize<<endl; 141 142 Intersectable::NewMail(); 143 mCurrentFrame++; 144 while (it.HasMoreEntries()) 145 { 146 RenderIntersectable(it.Next()); 147 } 148 167 168 RenderPvs(pvs); 169 149 170 //glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 150 171 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); … … 212 233 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 213 234 214 // Render PVS 215 Intersectable::NewMail(); 216 mCurrentFrame++; 217 218 219 ObjectPvsIterator it = pvs.GetIterator(); 220 for (; it.HasMoreEntries(); ) 221 { 222 RenderIntersectable(it.Next()); 223 } 235 RenderPvs(pvs); 224 236 225 237 mUseForcedColors = false; … … 464 476 465 477 466 void QtGlRendererWidget::_UpdatePvsIndices(KdNode *node, int &indexBufferSize)467 {468 if (node->Mailed())469 return;470 471 node->Mail();472 473 // if (mObjects.size() * 3 < indexBufferSize) cerr << "problem: " << mObjects.size() * 3 << " < " << indexBufferSize << endl;474 if (!node->IsLeaf())475 {476 KdInterior *kdInterior = static_cast<KdInterior *>(node);477 478 _UpdatePvsIndices(kdInterior->mBack, indexBufferSize);479 _UpdatePvsIndices(kdInterior->mFront, indexBufferSize);480 }481 else482 {483 KdLeaf *leaf = static_cast<KdLeaf *>(node);484 485 leaf->mIndexBufferStart = indexBufferSize;486 487 for (size_t i = 0; i < leaf->mObjects.size(); ++ i)488 {489 TriangleIntersectable *obj =490 static_cast<TriangleIntersectable *>(leaf->mObjects[i]);491 492 if (obj->mRenderedFrame != mCurrentFrame)493 {494 obj->mRenderedFrame = mCurrentFrame;495 496 mIndices[indexBufferSize + 0] = (obj->GetId() - 1) * 3 + 0;497 mIndices[indexBufferSize + 1] = (obj->GetId() - 1) * 3 + 1;498 mIndices[indexBufferSize + 2] = (obj->GetId() - 1) * 3 + 2;499 500 indexBufferSize += 3;501 }502 }503 504 leaf->mIndexBufferSize = indexBufferSize - leaf->mIndexBufferStart;505 }506 507 //cout << "id: " << indexBufferSize << endl;508 }509 478 510 479 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2615 r2620 66 66 67 67 int ComputePvs() const { return 0; } 68 68 69 void 70 RenderPvs(const ObjectPvs &pvs); 71 69 72 float 70 73 GetPixelError(int &pvsSize); … … 216 219 float mTransferFunction; 217 220 218 unsigned int mIndexBufferSize;219 221 220 222 Vector3 mDummyViewPoint; … … 543 545 void _RenderColoredPvs(); 544 546 545 void _UpdatePvsIndices(KdNode *node, int &indexBufferSize);547 // void _UpdatePvsIndices(KdNode *node, int &indexBufferSize); 546 548 547 549 float ComputeRenderCost(ViewCell *vc); -
GTP/trunk/Lib/Vis/Preprocessing/src/SG08/run_test_pixel
r2619 r2620 4 4 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 5 5 #COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -samples_per_pass=500000 -samples_per_evaluation=10000000 -total_samples=500000000 -preprocessor_pvs_rendererror_samples=10000 -preprocessor_evaluatePixelError+" 6 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer + -preprocessor_evaluate_filter- -samples_per_pass=500000 -samples_per_evaluation=100000 -total_samples=500000000 -preprocessor_pvs_rendererror_samples=100 -preprocessor_evaluatePixelError+ -preprocessor_detect_empty_viewspace+ -kd_pvs_area=1e-5 -view_cells_use_kd_pvs+ -af_use_kd_pvs+"7 6 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -samples_per_pass=1000000 -samples_per_evaluation=10000000 -total_samples=250000000 -preprocessor_pvs_rendererror_samples=1000 -preprocessor_evaluatePixelError+ -preprocessor_detect_empty_viewspace+ -kd_pvs_area=1e-5 -view_cells_use_kd_pvs+ -af_use_kd_pvs+" 7 8 8 #SCENE="../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d" 9 9 #VIEWCELLS=../data/vienna/vienna-viewcells-5000.xml -
GTP/trunk/Lib/Vis/Preprocessing/src/SG08/run_test_vienna
r2607 r2620 5 5 #COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace- -total_samples=500000000" 6 6 7 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace+ -samples_per_evaluation=5000000 -samples_per_pass=1000000 -total_samples=1 000000000 -view_cells_use_kd_pvs+"7 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace+ -samples_per_evaluation=5000000 -samples_per_pass=1000000 -total_samples=12000000 -view_cells_use_kd_pvs+ -preprocessor_ray_cast_method=0" 8 8 9 9 … … 13 13 14 14 15 PREFIX=../work/plots/osp-vienna-SG08 15 PREFIX=../work/plots/osp-vienna-SG08-gr 16 16 17 17 … … 19 19 ###################### 20 20 21 # #$COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \22 # #-preprocessor_visibility_file=$PREFIX-reference.xml \23 # #-view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \24 # #-preprocessor_histogram_file=$PREFIX-r-reference.hlog25 26 #$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \27 #-rss_distributions=direction -view_cells_filter_max_size=1 \28 #-preprocessor_visibility_file=$PREFIX-r-reference-global.xml \29 #-preprocessor_stats=$PREFIX-reference-global.log \30 #-preprocessor_histogram_file=$PREFIX-r-reference-global.hlog21 $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 22 -preprocessor_visibility_file=$PREFIX-reference.xml \ 23 -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \ 24 -preprocessor_histogram_file=$PREFIX-r-reference.hlog 25 26 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 27 -rss_distributions=direction -view_cells_filter_max_size=1 \ 28 -preprocessor_visibility_file=$PREFIX-r-reference-global.xml \ 29 -preprocessor_stats=$PREFIX-reference-global.log \ 30 -preprocessor_histogram_file=$PREFIX-r-reference-global.hlog 31 31 32 32 # $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ … … 286 286 # -preprocessor_stats=$PREFIX-combined-m8-1.log 287 287 288 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 289 -mutation_silhouette_prob=0.5 \ 290 -mutation_reverse_samples_distance=1.0 \ 291 -mutation_radius_origin=1.0 \ 292 -mutation_radius_termination=0.2 \ 293 -mutation_use_unsucc_count_importance+ \ 294 -mutation_use_pass_importance- \ 295 -mutation_buffer_size=2000000 \ 296 -rss_distributions=mutation+object_direction+spatial \ 297 -preprocessor_stats=$PREFIX-combined-m8-2.log 288 # USE THIS ONE!!!!!! 289 # $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 290 # -mutation_silhouette_prob=0.5 \ 291 # -mutation_reverse_samples_distance=1.0 \ 292 # -mutation_radius_origin=1.0 \ 293 # -mutation_radius_termination=0.2 \ 294 # -mutation_use_unsucc_count_importance+ \ 295 # -mutation_use_pass_importance- \ 296 # -mutation_buffer_size=2000000 \ 297 # -rss_distributions=mutation+object_direction+spatial \ 298 # -preprocessor_stats=$PREFIX-combined-m8-2.log 298 299 299 300 # $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ … … 308 309 # -preprocessor_stats=$PREFIX-combined-m8-3.log 309 310 310 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \311 -mutation_silhouette_prob=0.5 \312 -mutation_reverse_samples_distance=1.0 \313 -mutation_radius_origin=0.5 \314 -mutation_radius_termination=0.2 \315 -mutation_use_unsucc_count_importance- \316 -mutation_use_pass_importance+ \317 -mutation_buffer_size=2000000 \318 -rss_distributions=mutation+object_direction+spatial \319 -preprocessor_stats=$PREFIX-combined-m8-4.log311 # $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 312 # -mutation_silhouette_prob=0.5 \ 313 # -mutation_reverse_samples_distance=1.0 \ 314 # -mutation_radius_origin=0.5 \ 315 # -mutation_radius_termination=0.2 \ 316 # -mutation_use_unsucc_count_importance- \ 317 # -mutation_use_pass_importance+ \ 318 # -mutation_buffer_size=2000000 \ 319 # -rss_distributions=mutation+object_direction+spatial \ 320 # -preprocessor_stats=$PREFIX-combined-m8-4.log
Note: See TracChangeset
for help on using the changeset viewer.