Changeset 1311 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 09/01/06 11:19:39 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1297 r1311 2427 2427 2428 2428 2429 RegisterOption("Hierarchy.Construction.minDepthForOsp", 2430 optInt, 2431 "hierarchy_construction_min_depth_for_osp=", 2432 "-1"); 2433 2434 2429 2435 ////////////////////////////////////////////////////////////////////////////////// 2430 2436 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1308 r1311 102 102 "Hierarchy.Construction.type", mConstructionType); 103 103 104 mMinDepthForObjectSpaceSubdivion = -1; 105 104 Environment::GetSingleton()->GetIntValue( 105 "Hierarchy.Construction.minDepthForOsp", mMinDepthForObjectSpaceSubdivion); 106 106 107 Debug << "******** Hierachy Manager Parameters ***********" << endl; 107 108 Debug << "max leaves: " << mTermMaxLeaves << endl; … … 196 197 197 198 void HierarchyManager::Construct(const VssRayContainer &sampleRays, 198 const ObjectContainer &objects, 199 AxisAlignedBox3 *forcedViewSpace) 200 { 201 202 RayInfoContainer *viewSpaceRays = new RayInfoContainer(); 203 199 const ObjectContainer &objects, 200 AxisAlignedBox3 *forcedViewSpace) 201 { 202 204 203 mHierarchyStats.Reset(); 205 204 mHierarchyStats.Start(); 206 207 // start with view space subdivison: prepare vsp tree for traversal 205 206 mTotalCost = (float)objects.size(); 207 Debug << "setting total cost to " << mTotalCost << endl; 208 209 const long startTime = GetTime(); 210 cout << "Constructing view space / object space tree ... \n"; 211 212 // process object space candidates 213 RunConstruction(sampleRays, objects, forcedViewSpace); 214 215 cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 216 mVspTree->mVspStats.Stop(); 217 } 218 219 220 void HierarchyManager::PrepareViewSpaceSubdivision(const VssRayContainer &sampleRays, 221 const ObjectContainer &objects, 222 AxisAlignedBox3 *forcedViewSpace) 223 { 224 RayInfoContainer *viewSpaceRays = new RayInfoContainer(); 208 225 SubdivisionCandidate *vsc = 209 226 mVspTree->PrepareConstruction(sampleRays, forcedViewSpace, *viewSpaceRays); 227 210 228 mTQueue.Push(vsc); 211 212 mTotalCost = (float)objects.size();213 Debug << "setting total cost to " << mTotalCost << endl;214 215 const long startTime = GetTime();216 cout << "Constructing view space / object space tree ... \n";217 218 // process object space candidates219 RunConstruction();220 221 cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl;222 mVspTree->mVspStats.Stop();223 229 } 224 230 … … 313 319 bool HierarchyManager::StartObjectSpaceSubdivision() const 314 320 { 315 const bool constructAfterViewSpace = (mConstructionType == 1) && mTQueue.Empty(); 316 317 return 318 NO_OBJ_SUBDIV && 319 ((mMinDepthForObjectSpaceSubdivion < 0/*mVspTree->mVspStats.mMaxDepth*/) || constructAfterViewSpace); 320 } 321 322 323 void HierarchyManager::RunConstruction() 321 const bool ospDepthReached = 322 (mMinDepthForObjectSpaceSubdivion == mVspTree->mVspStats.maxDepth); 323 const bool stillNotOsp = (mObjectSpaceSubdivisionType == NO_OBJ_SUBDIV); 324 325 Debug << "here10 " << mMinDepthForObjectSpaceSubdivion << " " << mVspTree->mVspStats.maxDepth << endl; 326 327 return stillNotOsp && (mTQueue.Empty() || ospDepthReached); 328 } 329 330 331 void HierarchyManager::RunConstruction(const VssRayContainer &sampleRays, 332 const ObjectContainer &objects, 333 AxisAlignedBox3 *forcedViewSpace) 324 334 { 325 335 mHierarchyStats.nodes = 0; 326 336 mGlobalCostMisses = 0; 327 328 // use objects for evaluating vsp tree construction 337 Debug << "here2" << endl; 338 // use objects for evaluating vsp tree construction in the first levels 339 // of the subdivision 329 340 const int savedObjectSpaceSubdivisionType = mObjectSpaceSubdivisionType; 330 341 mObjectSpaceSubdivisionType = NO_OBJ_SUBDIV; 331 332 //const bool repairQueue = false; 333 const bool repairQueue = true; 334 335 do 336 { 337 // use objects for evaluating vsp tree construction until a certain depth 342 Debug << "here3" << endl; 343 // start with view space subdivison: prepare vsp tree for traversal 344 PrepareViewSpaceSubdivision(sampleRays, objects, forcedViewSpace); 345 346 const bool repairQueue = false; 347 //const bool repairQueue = true; 348 349 while (!FinishedConstruction()); 350 {Debug << "here7" << endl; 351 // we use objects for evaluating vsp tree construction until 352 // a certain depth once a certain depth existiert .... 338 353 if (StartObjectSpaceSubdivision()) 339 354 { 355 Debug << "here8" << endl; 340 356 mObjectSpaceSubdivisionType = savedObjectSpaceSubdivisionType; 341 //PrepareObjectSpaceSubdivision(); 357 PrepareObjectSpaceSubdivision(sampleRays, objects); 358 Debug << "here9" << endl; 342 359 } 343 360 … … 365 382 // this would be object space splits and other way round 366 383 if (repairQueue) RepairQueue(); 367 } 384 } 385 368 386 DEL_PTR(mCurrentCandidate); 369 387 } 370 while (!FinishedConstruction());388 371 389 372 390 mObjectSpaceSubdivisionType = savedObjectSpaceSubdivisionType; … … 377 395 { 378 396 return mTQueue.Empty(); 397 } 398 399 400 int HierarchyManager::GetObjectSpaceSubdivisionType() 401 { 402 if (!ObjectSpaceSubdivisionConstructed()) 403 return NO_OBJECT_SUBDIV; 404 405 return mObjectSpaceSubdivisionType; 406 } 407 408 409 bool HierarchyManager::ObjectSpaceSubdivisionConstructed() 410 { 411 switch (mObjectSpaceSubdivisionType) 412 { 413 case KD_BASED_OBJ_SUBDIV: 414 return mOspTree && mOspTree->GetRoot(); 415 case BV_BASED_OBJ_SUBDIV: 416 return mBvHierarchy && mOspTree->GetRoot(); 417 default: 418 return false; 419 } 379 420 } 380 421 -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1308 r1311 169 169 /** The type of object space subdivison 170 170 */ 171 in line int GetObjectSpaceSubdivisonType() const171 int HierarchyManager::GetObjectSpaceSubdivisionType() const 172 172 { 173 173 return mObjectSpaceSubdivisionType; 174 174 } 175 175 176 176 void SetViewCellsManager(ViewCellsManager *vcm); 177 177 … … 207 207 const ObjectContainer &objects); 208 208 209 void RunConstruction(); 209 void RunConstruction( 210 const VssRayContainer &sampleRays, 211 const ObjectContainer &objects, 212 AxisAlignedBox3 *forcedViewSpace); 213 210 214 bool ApplySubdivisionCandidate(SubdivisionCandidate *sc); 211 215 … … 238 242 void ExportBvHierarchy(Exporter *exporter, const ObjectContainer &objects) const; 239 243 240 241 244 void PrepareBvHierarchy( 242 245 const VssRayContainer &sampleRays, … … 250 253 251 254 bool StartObjectSpaceSubdivision() const; 255 256 void PrepareViewSpaceSubdivision( 257 const VssRayContainer &sampleRays, 258 const ObjectContainer &objects, 259 AxisAlignedBox3 *forcedViewSpace); 252 260 253 261 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1297 r1311 1762 1762 } 1763 1763 1764 // interior node1765 1766 1764 // interior nodes: pvs is either stored as a scalar or 1767 1765 // has to be reconstructed from the leaves 1768 1769 1766 // the stored pvs size is the valid pvs size => just return scalar 1770 1767 if (vc->mPvsSizeValid) … … 1959 1956 { 1960 1957 int pvsSize = 0; 1961 1962 1958 Intersectable::NewMail(); 1963 1959 1964 1960 //////////////////////////////////////////////// 1965 // 1961 // for interiors, pvs can be stored using different methods 1966 1962 // 1967 1963 … … 1969 1965 { 1970 1966 case PVS_IN_LEAVES: //-- store pvs only in leaves 1971 { 1972 pvsSize = GetPvsSizeForLeafStorage(vc); 1973 break; 1974 } 1967 pvsSize = GetPvsSizeForLeafStorage(vc); 1968 break; 1975 1969 case COMPRESSED: 1976 { 1977 pvsSize = GetPvsSizeForCompressedStorage(vc); 1978 break; 1979 } 1970 pvsSize = GetPvsSizeForCompressedStorage(vc); 1971 break; 1980 1972 case PVS_IN_INTERIORS: 1981 1973 default: -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1302 r1311 362 362 startTime = GetTime(); 363 363 364 // 364 //-- stats after construction 365 365 ResetViewCells(); 366 366 Debug << "\nView cells after initial sampling:\n" << mCurrentViewCellsStats << endl; … … 1319 1319 { 1320 1320 mCurrentViewCellsStats.Reset(); 1321 1322 1321 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 1323 1322 -
GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
r1281 r1311 485 485 } 486 486 #endif 487 VssTree *vssTree = NULL; 488 487 VssTree *vssTree = NULL; 489 488 490 489 long initialTime = GetTime(); … … 499 498 else 500 499 { 501 502 500 while (totalSamples < mInitialSamples) { 503 501 int passContributingSamples = 0;
Note: See TracChangeset
for help on using the changeset viewer.