Changeset 2663 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 04/29/08 11:19:06 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna
r2596 r2663 7 7 8 8 SCENE=../data/vienna/vienna_cropped.obj 9 SCENE=../data/vienna/city_full.obj 10 #SCENE=../data/vienna/city_full3.obj 9 11 #VIEWCELLS=../data/vienna/vienna_cropped-seq-3000-false-20-viewcells.xml.gz 10 12 VIEWCELLS=../data/vienna/vienna_cropped-57000-viewcells.xml.gz -
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh
r2661 r2663 30 30 -gvs_samples_per_pass=50000 \ 31 31 -gvs_initial_samples=16 \ 32 -gvs_max_viewcells= 20\32 -gvs_max_viewcells=4 \ 33 33 -gvs_min_contribution=50 \ 34 34 -gvs_per_viewcell=true \ -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2662 r2663 435 435 glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 436 436 437 OcclusionQuery::GenQueries(mOcclusionQueries, 10); 437 // create some occlusion queries 438 OcclusionQuery::GenQueries(mOcclusionQueries, 100); 438 439 439 440 SceneGraphInterior *interior = mSceneGraph->GetRoot(); … … 1734 1735 float GlRenderer::GetPixelError(int &pvsSize) 1735 1736 { 1736 1737 return -1.0f; 1737 1738 } 1738 1739 … … 1951 1952 1952 1953 delete [] mData; 1954 mData = NULL; 1953 1955 } 1954 1956 … … 1960 1962 { 1961 1963 glDeleteBuffersARB(1, &mVboId); 1962 1963 /* 1964 KdLeafContainer leaves; 1965 mKdTree->CollectLeaves(leaves); 1966 1967 KdLeafContainer::const_iterator kit, kit_end = leaves.end(); 1968 1969 for (kit = leaves.begin(); kit != kit_end; ++ kit) 1970 { 1971 KdLeaf *leaf = *kit; 1972 1973 if (leaf->mVboId == -1) 1974 { 1975 // delete old vbo 1976 glDeleteBuffersARB(1, &leaf->mVboId); 1977 leaf->mVboId = -1; 1978 } 1979 } 1980 */ 1981 } 1982 1983 1984 1985 } 1964 } 1965 1966 1967 1968 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r2643 r2663 357 357 unsigned int *mPixelBuffer; 358 358 359 static void GenQueries( constint numQueries);359 static void GenQueries(int numQueries); 360 360 361 361 virtual void SetupProjectionForViewPoint(const Vector3 &viewPoint, -
GTP/trunk/Lib/Vis/Preprocessing/src/OcclusionQuery.cpp
r2629 r2663 12 12 #endif 13 13 14 #ifdef _WIN3214 //#ifdef _WIN32 15 15 // This Macro does not compile under LINUX 16 #define _ARBGL 17 #endif 16 //#define _ARBGL 17 //#endif 18 18 19 19 20 using namespace std; 20 21 21 namespace GtpVisibilityPreprocessor { 22 23 bool OcclusionQuery::sUseArbQueries = true; 22 namespace GtpVisibilityPreprocessor 23 { 24 25 const static bool sUseArbQueries = true; 24 26 25 27 … … 27 29 { 28 30 GLuint id; 29 30 if (sUseArbQueries) 31 { 32 #ifdef _ ARBGL33 34 31 32 if (sUseArbQueries) 33 { 34 #ifdef _WIN32 35 // VH 36 glGenQueriesARB(1, &id); 35 37 #endif 36 38 } 37 39 else 38 40 { 39 #ifdef _ ARBGL40 41 #ifdef _WIN32 42 // VH 41 43 glGenOcclusionQueriesNV(1, &id); 42 44 #endif 43 45 } 44 46 } 47 45 48 46 49 OcclusionQuery::OcclusionQuery(const unsigned int idx): 47 50 mId(idx) 48 {} 51 { 52 } 49 53 50 54 … … 53 57 if (sUseArbQueries) 54 58 { 55 #ifdef _ ARBGL56 59 #ifdef _WIN32 60 // VH 57 61 glDeleteQueriesARB(1, &mId); 58 62 #endif … … 60 64 else 61 65 { 62 #ifdef _ ARBGL63 66 #ifdef _WIN32 67 // VH 64 68 glDeleteOcclusionQueriesNV(1, &mId); 65 69 #endif … … 67 71 68 72 } 69 //----------------------------------------------------------------------- 73 74 70 75 void OcclusionQuery::BeginQuery() 71 76 { 72 77 if (sUseArbQueries) 73 78 { 74 #ifdef _ARBGL 75 // VH 79 #ifdef _WIN32 80 // VH 81 cout << "issuing arb query" << endl; 76 82 glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mId); 77 83 #endif … … 79 85 else 80 86 { 81 #ifdef _ARBGL 82 // VH 87 #ifdef _WIN32 88 // VH 89 cout << "issuing nv query" << endl; 83 90 glBeginOcclusionQueryNV(mId); 84 91 #endif 85 92 } 86 93 } 87 //----------------------------------------------------------------------- 94 95 88 96 void OcclusionQuery::EndQuery() 89 97 { 90 98 if (sUseArbQueries) 91 99 { 92 #ifdef _ARBGL 93 // VH 100 #ifdef _WIN32 101 // VH 102 cout << "ending query" << endl; 94 103 glEndQueryARB(GL_SAMPLES_PASSED_ARB); 95 104 #endif … … 97 106 else 98 107 { 99 #ifdef _ ARBGL100 108 #ifdef _WIN32 109 // VH 101 110 glEndOcclusionQueryNV(); 102 111 #endif … … 110 119 } 111 120 121 112 122 bool OcclusionQuery::ResultAvailable() const 113 123 { 114 GLuint available; 115 116 if (sUseArbQueries) 117 { 118 #ifdef _ARBGL 119 // VH 120 //GLint available; 121 glGetQueryObjectuivARB(mId, 122 GL_QUERY_RESULT_AVAILABLE_ARB, 123 &available); 124 GLuint available = GL_TRUE; 125 126 if (sUseArbQueries) 127 { 128 #ifdef _WIN32 129 // VH 130 glGetQueryObjectuivARB(mId, GL_QUERY_RESULT_AVAILABLE_ARB, &available); 124 131 #endif 125 return available == GL_TRUE; 126 } 127 else 128 { 129 #ifdef _ARBGL 132 } 133 else 134 { 135 #ifdef _WIN32 130 136 // VH 131 137 glGetOcclusionQueryuivNV(mId, GL_PIXEL_COUNT_AVAILABLE_NV, &available); 132 138 #endif 133 return available == GL_TRUE;134 } 135 139 } 140 141 return available == GL_TRUE; 136 142 } 137 143 … … 139 145 unsigned int OcclusionQuery::GetQueryResult() const 140 146 { 141 GLuint sampleCount ;142 143 if (sUseArbQueries) 144 { 145 #ifdef _ ARBGL146 147 GLuint sampleCount = 1; 148 149 if (sUseArbQueries) 150 { 151 #ifdef _WIN32 152 // VH 147 153 glGetQueryObjectuivARB(mId, GL_QUERY_RESULT_ARB, &sampleCount); 148 154 #endif 149 return sampleCount;150 155 } 151 156 else 152 157 { 153 #ifdef _ ARBGL154 158 #ifdef _WIN32 159 // VH 155 160 glGetOcclusionQueryuivNV(mId, GL_PIXEL_COUNT_NV, &sampleCount); 156 161 #endif 157 return sampleCount;158 162 } 159 } 160 161 162 void OcclusionQuery::GenQueries(std::vector<OcclusionQuery * > &queries, const int numQueries) 163 164 return sampleCount; 165 } 166 167 168 void OcclusionQuery::GenQueries(std::vector<OcclusionQuery * > &queries, 169 int numQueries) 163 170 { 164 171 if ((int)queries.size() < numQueries) … … 170 177 if (sUseArbQueries) 171 178 { 172 #ifdef _ ARBGL173 179 #ifdef _WIN32 180 // VH 174 181 glGenQueriesARB(n, (unsigned int *)newQueries); 182 cout << "creating " << n << " arb queries" << endl; 175 183 #endif 176 184 } 177 185 else 178 186 { 179 #ifdef _ARBGL 180 // VH 181 glGenOcclusionQueriesNV(n, (unsigned int *)newQueries); 187 #ifdef _WIN32 188 // VH 189 glGenOcclusionQueriesNV(n, (unsigned int *)newQueries); 190 cout << "creating " << n << " nv queries" << endl; 182 191 #endif 183 192 } … … 192 201 } 193 202 } 203 204 194 205 } // namespace -
GTP/trunk/Lib/Vis/Preprocessing/src/OcclusionQuery.h
r1001 r2663 23 23 virtual void EndQuery(); 24 24 25 static void GenQueries(std::vector<OcclusionQuery *> &queries, constint numQueries);25 static void GenQueries(std::vector<OcclusionQuery *> &queries, int numQueries); 26 26 27 27 unsigned int GetQueryId() const; … … 31 31 32 32 OcclusionQuery(const unsigned int idx); 33 static bool sUseArbQueries; 34 33 35 34 unsigned int mId; 36 35 }; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2662 r2663 101 101 QtGlRendererBuffer::RenderPvs(const ObjectPvs &pvs) 102 102 { 103 #if TEST_PVS_RENDERING 104 105 // Render PVS 106 ObjectPvsIterator it = pvs.GetIterator(); 107 108 Intersectable::NewMail(); 109 mCurrentFrame++; 110 while (it.HasMoreEntries()) 111 { 112 RenderIntersectable(it.Next()); 113 } 114 115 #else 116 117 PreparePvs(pvs); 118 119 int offset = (int)mObjects.size() * 3; 120 char *arrayPtr = mUseVbos ? NULL : (char *)mData; 121 122 glVertexPointer(3, GL_FLOAT, 0, (char *)arrayPtr); 123 glNormalPointer(GL_FLOAT, 0, (char *)arrayPtr + offset * sizeof(Vector3)); 124 glDrawElements(GL_TRIANGLES, mIndexBufferSize, GL_UNSIGNED_INT, mIndices); 125 126 #endif 103 PreparePvs(pvs); 104 105 int offset = (int)mObjects.size() * 3; 106 char *arrayPtr = mUseVbos ? NULL : (char *)mData; 107 108 glVertexPointer(3, GL_FLOAT, 0, (char *)arrayPtr); 109 glNormalPointer(GL_FLOAT, 0, (char *)arrayPtr + offset * sizeof(Vector3)); 110 glDrawElements(GL_TRIANGLES, mIndexBufferSize, GL_UNSIGNED_INT, mIndices); 127 111 } 128 112 … … 136 120 float pErrorPixels = -1.0f; 137 121 138 139 122 mUseFalseColors = false; 140 unsigned int pixelCount ;123 unsigned int pixelCount = 0; 141 124 142 125 … … 153 136 if (!evaluateFilter) 154 137 pvs = viewcell->GetPvs(); 155 else { 156 157 mViewCellsManager->ApplyFilter2(viewcell, 158 false, 159 mViewCellsManager->GetFilterWidth(), 160 pvs); 161 } 138 else 139 mViewCellsManager->ApplyFilter2(viewcell, false, mViewCellsManager->GetFilterWidth(), pvs); 140 162 141 163 142 mUseForcedColors = true; … … 168 147 glColor3f(0,1,0); 169 148 149 glDepthFunc(GL_LESS); 150 glDepthMask(GL_TRUE); 151 glEnable(GL_DEPTH_TEST); 170 152 171 153 glStencilFunc(GL_EQUAL, 0x0, 0x1); … … 182 164 183 165 184 OcclusionQuery *query = mOcclusionQueries[ 0];166 OcclusionQuery *query = mOcclusionQueries[1]; 185 167 186 168 Intersectable::NewMail(); … … 193 175 glDisable(GL_STENCIL_TEST); 194 176 177 195 178 // reenable other state 196 // int wait=0; 197 // while (!query.ResultAvailable()) { 198 // wait++; 199 // } 179 int wait = 0; 180 181 while (0 && !query->ResultAvailable()) 182 { 183 wait ++; 184 } 200 185 201 186 … … 1648 1633 const ViewCellInfoContainer &compareInfo) 1649 1634 { 1650 //cout << "comparing " << viewcells.size() << " view cells to " << compareInfo.size() << " values" << endl;1651 1652 1635 if (viewcells.size() > compareInfo.size()) 1653 1636 { 1654 cerr << "loaded size (" << (int)compareInfo.size() << ") does not fit to view cells size (" << (int)viewcells.size() << ")" << endl; 1637 cerr << "loaded size (" << (int)compareInfo.size() 1638 << ") does not fit to view cells size (" << (int)viewcells.size() << ")" << endl; 1655 1639 return; 1656 1640 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
r2660 r2663 511 511 break; 512 512 case PARSE_OBJECTSPACE_HIERARCHY: 513 if ((++ nObjects % 1000 ) == 0)513 if ((++ nObjects % 10000) == 0) 514 514 cout <<"\r" << nObjects << " objects parsed\r"; 515 515
Note: See TracChangeset
for help on using the changeset viewer.