Changeset 2648
- Timestamp:
- 03/18/08 19:28:00 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2647 r2648 90 90 mSceneGraph->CollectObjects(mObjects); 91 91 92 #if 092 #if 1 93 93 viewCellsManager->GetViewPoint(mViewPoint); 94 94 mViewDirection = Vector3(0,0,1); … … 1621 1621 for (sit = viewPoints.begin(); sit != sit_end; ++ sit, ++ i) 1622 1622 { 1623 1624 //cout << "view point: " << (*sit) << endl;; 1623 //cout << "\n\nvp: " << (*sit) << endl; 1625 1624 SimpleRay sray = *sit; 1626 1625 … … 1642 1641 mPvsErrorBuffer[i].mPvsSize = pvsSize; 1643 1642 1644 cout << "( " << i << "," << mPvsErrorBuffer[i].mError <<")";1643 cout << "(vc: " << i << ", er: " << mPvsErrorBuffer[i].mError <<")" << endl; 1645 1644 } 1646 1645 -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2643 r2648 20 20 21 21 #define GVS_DEBUG 0 22 static ObjectContainer myobjects;23 22 24 23 struct VizStruct … … 32 31 static const float MIN_DIST = 0.001f; 33 32 33 static ObjectContainer myobjects; 34 34 static vector<VizStruct> vizContainer; 35 35 36 36 37 GvsPreprocessor::GvsPreprocessor(): … … 78 79 mGvsStats.Reset(); 79 80 81 // hack: some generic statistical values that can be read 82 // by an application using the preprocessor 80 83 mGenericStats = 0; 81 84 mGenericStats2 = 0; … … 105 108 ViewCell *GvsPreprocessor::NextViewCell() 106 109 { 107 //if (mViewCellsManager->GetNumViewCells() == mProcessedViewCells)108 // return false; // no more view cells109 110 110 if (mProcessedViewCells == (int)mViewCells.size()) 111 111 return NULL; // no more view cells … … 440 440 441 441 const int numBorderSamples = (int)vssRays.size() - numRandomRays; 442 443 #if 0 442 444 // set flags 443 /*VssRayContainer::const_iterator rit, rit_end = vssRays.end();445 VssRayContainer::const_iterator rit, rit_end = vssRays.end(); 444 446 for (rit = vssRays.begin(); rit != rit_end; ++ rit, ++ i) 445 447 (*rit)->mFlags |= VssRay::BorderSample; 446 */ 448 #endif 449 447 450 int castRays = (int)simpleRays.size(); 448 451 449 452 VssRayContainer invalidSamples; 450 451 453 452 454 // handle rays … … 783 785 int oldContribution = mGvsStats.mTotalContribution; 784 786 int passSamples = 0; 787 785 788 mGenericStats = 0; 786 789 mGenericStats2 = 0; … … 831 834 void GvsPreprocessor::CompileViewCellsList() 832 835 { 836 // Receive list of view cells from view cells manager 833 837 ViewCellPointsList *vcPoints = mViewCellsManager->GetViewCellPointsList(); 834 835 836 int i = 0; 837 838 838 839 if (!vcPoints->empty()) 839 840 { … … 843 844 844 845 for (vit = vcPoints->begin(); vit != vit_end; ++ vit) 845 { //cout << i ++ << " " << (*vit)->first->GetId() << endl;846 { 846 847 mViewCells.push_back((*vit)->first); 847 848 } … … 941 942 942 943 943 944 944 void GvsPreprocessor::PerViewCellComputation() 945 945 { … … 954 954 (*oit)->mCounter = 0; 955 955 956 956 ComputeViewCell(vc); 957 957 } 958 958 } … … 1124 1124 #endif 1125 1125 1126 mGvsStats.Stop();1127 mGvsStats.Print(mGvsStatsStream);1128 1129 1126 if (mPerViewCell) 1130 1127 { 1131 #if 01128 #if 1 1132 1129 // provide list of view cells to compute 1133 1130 CompileViewCellsList(); 1134 1135 1131 // start per view cell gvs 1136 1132 PerViewCellComputation(); 1137 1138 if (mEvaluatePixelError)1139 {1140 ComputeRenderError();1141 }1142 1133 #else 1143 1134 PerViewCellComputation2(); … … 1162 1153 { 1163 1154 ExportPreprocessedData(mVisibilityFileName); 1155 } 1156 1157 // compute the pixel error of this visibility solution 1158 if (mEvaluatePixelError) 1159 { 1160 ComputeRenderError(); 1164 1161 } 1165 1162 … … 1211 1208 { 1212 1209 app << "#ViewCells\n" << mViewCells << endl; 1213 app << "#ViewCellId\n" << mViewCellId << endl; 1210 app << "#Id\n" << mViewCellId << endl; 1211 app << "#Time\n" << mTimePerViewCell << endl;; 1212 app << "#TrianglePvs\n" << mTrianglePvs << endl; 1213 app << "#ObjectPvs\n" << mPerViewCellPvs << endl; 1214 app << "#PvsCost\n" << (int)mPvsCost << endl; 1215 1216 #if 0 1217 app << "#TotalPvs\n" << mTotalPvs << endl; 1214 1218 app << "#TotalTime\n" << mTotalTime << endl; 1215 app << "#TimePerViewCell\n" << mTimePerViewCell << endl;;1216 1217 1219 app << "#RaysPerSec\n" << RaysPerSec() << endl; 1218 1219 app << "#TrianglePvs\n" << mTrianglePvs << endl;1220 app << "#TotalTrianglePvs\n" << mTotalTrianglePvs << endl;1221 1222 app << "#PerViewCellPvs\n" << mPerViewCellPvs << endl;1223 app << "#TotalPvs\n" << mTotalPvs << endl;1224 1220 1225 1221 app << "#PerViewCellSamples\n" << mPerViewCellSamples << endl; 1226 1222 app << "#TotalSamples\n" << mTotalSamples << endl; 1227 1223 app << "#SamplesContri\n" << mTotalContribution << endl; 1228 1224 app << "#TotalTrianglePvs\n" << mTotalTrianglePvs << endl; 1225 1226 #endif 1227 1229 1228 //app << "#ReverseSamples\n" << mReverseSamples << endl; 1230 1229 //app << "#BorderSamples\n" << mBorderSamples << endl; … … 1277 1276 else 1278 1277 { 1279 /*// add pvs1280 ObjectContainer::const_iterator it, it_end = mKdPvs.end();1281 1282 for (it = mKdPvs.begin(); it != it_end; ++ it)1283 mCurrentViewCell->GetPvs().AddSampleDirty(*it, 1.0f);1284 */1285 1278 mGvsStats.mPerViewCellPvs = mCurrentViewCell->GetPvs().GetSize(); 1286 1287 cout << "pvs cost: " << mCurrentViewCell->GetPvs().EvalPvsCost() << " pvs tri: " << mGenericStats2 << endl; 1279 mGvsStats.mPvsCost = mCurrentViewCell->GetPvs().EvalPvsCost(); 1280 1281 cout << "id: " << mCurrentViewCell->GetId() << " pvs cost: " 1282 << mGvsStats.mPvsCost << " pvs tri: " << mTrianglePvs.size() << endl; 1288 1283 } 1289 1284 … … 1293 1288 1294 1289 mGvsStats.mViewCells = mProcessedViewCells;//mPass; 1295 1296 1297 1290 mGvsStats.mTotalPvs += mGvsStats.mPerViewCellPvs; 1298 1291 mGvsStats.mTotalSamples += mGvsStats.mPerViewCellSamples; -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h
r2625 r2648 43 43 mTimePerViewCell = 0; 44 44 mTotalTrianglePvs = 0; 45 mPvsCost = 0; 45 46 } 46 47 … … 66 67 float mTimePerViewCell; 67 68 float mTotalTime; 69 70 float mPvsCost; 68 71 69 72 ObjectContainer mKdPvs; … … 211 214 void ClearRayQueue(); 212 215 216 /** Create a list of view cells gvs is run on. 217 */ 213 218 void CompileViewCellsList(); 214 219 … … 223 228 void StorePvs(const ObjectContainer &objectPvs); 224 229 230 /** Compute visibility for a given view cell. 231 */ 225 232 void ComputeViewCell(ViewCell *vc); 226 233 /** Runs gvs on the current view cell. -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2647 r2648 1537 1537 // mutex.unlock(); 1538 1538 1539 if ( mViewCellsManager->GetViewCellPointsList()->size()) {1539 if (!mViewCellsManager->GetViewCellPointsList()->empty()) { 1540 1540 1541 1541 ViewCellPointsList *vcPoints = mViewCellsManager->GetViewCellPointsList(); … … 1551 1551 1552 1552 SimpleRayContainer::const_iterator rit = vp->second.begin(), rit_end = vp->second.end(); 1553 1553 1554 for (; rit!=rit_end; ++rit) 1554 1555 viewPoints.push_back(*rit); … … 1560 1561 } 1561 1562 1563 cerr << "evaluating list of " << viewPoints.size() << " pts" << endl; 1562 1564 renderer->EvalPvsStat(viewPoints); 1563 1565 } else 1566 { 1564 1567 renderer->EvalPvsStat(); 1565 1568 } 1569 1566 1570 mStats << 1567 1571 "#AvgPvsRenderError\n" <<renderer->mPvsStat.GetAvgError()<<endl<< -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2645 r2648 142 142 143 143 ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 144 145 //cout << "vp: " << mViewPoint << endl; 146 144 147 if (viewcell == NULL) 145 148 return 0.0f; … … 173 176 174 177 pvsSize = pvs.GetSize(); 175 cout <<pvsSize<<endl;178 cout << "vc id: " << viewcell->GetId() << " pvs: " << pvsSize << endl; 176 179 177 180 RenderPvs(pvs); -
GTP/trunk/Lib/Vis/Preprocessing/src/RandomViewCellsHandler.cpp
r2647 r2648 129 129 130 130 bool RandomViewCellsHandler::ImportViewCellsList(const string &filename, 131 131 vector<ViewCellPoints *> &viewCells) 132 132 { 133 133 ifstream inStream(filename.c_str()); … … 136 136 137 137 ViewCellPoints *currentViewCell = NULL; 138 int i = 0; 139 int j = 0; 138 140 139 141 string buf; … … 149 151 currentViewCell = new ViewCellPoints(); 150 152 currentViewCell->first = mViewCellsManager->GetViewCellById(id); 151 152 viewCells.push_back(currentViewCell); 153 154 if (1)//i ++ < 5) 155 { 156 viewCells.push_back(currentViewCell); 157 j = 0; 158 } 153 159 break; 154 160 } … … 159 165 160 166 SimpleRay ray(pt, dir, 0, 1); 161 currentViewCell->second.push_back(ray); 167 168 if (1)//j ++ < 5) 169 currentViewCell->second.push_back(ray); 170 162 171 break; 163 172 }
Note: See TracChangeset
for help on using the changeset viewer.