Changeset 1784 for GTP/trunk/Lib/Vis
- Timestamp:
- 11/23/06 12:25:16 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1779 r1784 297 297 Environment::GetSingleton()->GetBoolValue("BvHierarchy.Construction.useInitialSubdivision", mApplyInitialPartition); 298 298 299 mApplyInitialPartition = true; 299 mInitialObjectsSize = 50; 300 300 301 //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(VspViewCell)); 301 302 //mMemoryConst = (float)sizeof(BvhLeaf); … … 574 575 { 575 576 const bool sufficientSamples = 576 splitCandidate.mParentData.mNumRays > mMinRaysForVisibility;577 splitCandidate.mParentData.mNumRays > mMinRaysForVisibility; 577 578 578 579 const bool useVisibiliyBasedHeuristics = 579 !mUseSah &&580 (mHierarchyManager->GetViewSpaceSubdivisionType() ==581 HierarchyManager::KD_BASED_VIEWSPACE_SUBDIV) &&582 sufficientSamples;580 mUseSah && 581 (mHierarchyManager->GetViewSpaceSubdivisionType() == 582 HierarchyManager::KD_BASED_VIEWSPACE_SUBDIV) && 583 sufficientSamples; 583 584 584 585 // compute best object partition … … 1369 1370 1370 1371 const int numRays = CollectViewCells(tData.mNode->mObjects, viewCells, true, true); 1371 //cout << " here4" << numRays << endl;1372 //cout << "number of rays: " << numRays << endl; 1372 1373 1373 1374 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); … … 1456 1457 if (mIsInitialSubdivision) 1457 1458 { 1458 ApplyInititialSplit(tData, 1459 frontObjects, 1460 backObjects); 1461 1459 ApplyInitialSplit(tData, frontObjects, backObjects); 1462 1460 return 0; 1463 1461 } 1464 1465 1462 1466 1463 ObjectContainer nFrontObjects[3]; … … 2120 2117 // only rays intersecting objects in node are interesting 2121 2118 const int nRays = AssociateObjectsWithRays(sampleRays); 2122 // Debug<< "using " << nRays << " of " << (int)sampleRays.size() << " rays" << endl;2119 //cout << "using " << nRays << " of " << (int)sampleRays.size() << " rays" << endl; 2123 2120 2124 2121 // create bvh traversal data … … 2149 2146 if (mApplyInitialPartition) 2150 2147 { 2148 cout << "§§§§§§§§here41 "<<oSubdivisionCandidate->mParentData.mSortedObjects[3]->size()<<endl; 2151 2149 ApplyInitialSubdivision(oSubdivisionCandidate, tQueue); 2152 2150 } … … 2191 2189 2192 2190 *(tData.mSortedObjects[3]) = objects; 2193 2194 2191 stable_sort(tData.mSortedObjects[3]->begin(), tData.mSortedObjects[3]->end(), smallerSize); 2195 2192 } … … 2211 2208 } 2212 2209 2213 for (int i = 0; i < 3; ++ i)2210 for (int i = 0; i < 4; ++ i) 2214 2211 { 2215 2212 frontData.mSortedObjects[i] = new ObjectContainer(); … … 2504 2501 2505 2502 SplitQueue tempQueue; 2506 2503 tempQueue.Push(firstCandidate); 2507 2504 while (!tempQueue.Empty()) 2508 { 2509 SubdivisionCandidate *candidate = t Queue.Top();2505 {cout << "here2"<<endl; 2506 SubdivisionCandidate *candidate = tempQueue.Top(); 2510 2507 tQueue.Pop(); 2511 2508 2512 2509 BvhSubdivisionCandidate *bsc = 2513 2510 dynamic_cast<BvhSubdivisionCandidate *>(candidate); 2514 2511 cout << "§§§§§§§§here49 "<< bsc->mParentData.mSortedObjects[3]->size()<<endl; 2512 cout << "here87 "<<((BvhSubdivisionCandidate *)firstCandidate)->mParentData.mNode->mObjects.size()<<endl; 2515 2513 const bool globalCriteriaMet = 2516 2514 GlobalTerminationCriteriaMet(bsc->mParentData); 2517 2515 cout << "here5"<<endl; 2518 2516 if (!InitialTerminationCriteriaMet(bsc->mParentData)) 2519 { 2517 {cout << "here9"<<bsc->mParentData.mNode->mObjects.size()<<endl; 2520 2518 BvhNode *node = Subdivide(tempQueue, bsc, globalCriteriaMet); 2521 2519 cout << "here12"<<endl; 2522 2520 // not needed anymore 2523 2521 delete bsc; 2524 2522 } 2525 2523 else // initial preprocessing finished for this candidate 2526 { 2524 {cout << "here15"<<endl; 2527 2525 tQueue.Push(bsc); 2528 2526 } … … 2533 2531 2534 2532 2535 void BvHierarchy::ApplyInititialSplit(const BvhTraversalData &tData, 2536 ObjectContainer &frontObjects, 2537 ObjectContainer &backObjects) 2538 { 2533 void BvHierarchy::ApplyInitialSplit(const BvhTraversalData &tData, 2534 ObjectContainer &frontObjects, 2535 ObjectContainer &backObjects) 2536 { 2537 cout << "*******here54 "<<tData.mSortedObjects[3]->size()<<endl; 2539 2538 ObjectContainer *objects = tData.mSortedObjects[3]; 2540 2539 2541 2540 ObjectContainer::const_iterator oit, oit_end = objects->end(); 2542 2541 cout<<"$$$$$$$$$$$$$$$$$$$"<<endl; 2542 for (oit = objects->begin(); oit != objects->end(); ++ oit) 2543 { 2544 //cout << (*oit)->GetBox().SurfaceArea() << " "; 2545 } 2546 cout<<"$$$$$$$$$$$$$$$$$$$"<<endl; 2543 2547 float maxAreaDiff = 0.0f; 2544 2548 … … 2577 2581 { 2578 2582 return (0 2579 || ((int)tData.mNode->mObjects.size() < mIniti tialObjectsSize)2583 || ((int)tData.mNode->mObjects.size() < mInitialObjectsSize) 2580 2584 || (tData.mNode->mObjects.back()->GetBox().SurfaceArea() < mMinInitialSurfaceArea) 2581 2585 ); -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1779 r1784 903 903 SplitQueue &tQueue); 904 904 905 void ApplyIniti tialSplit(const BvhTraversalData &tData,906 907 905 void ApplyInitialSplit(const BvhTraversalData &tData, 906 ObjectContainer &frontObjects, 907 ObjectContainer &backObjects); 908 908 909 909 bool InitialTerminationCriteriaMet(const BvhTraversalData &tData) const; 910 910 911 911 float mMinInitialSurfaceArea; 912 int mIniti tialObjectsSize;912 int mInitialObjectsSize; 913 913 914 914 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1779 r1784 2489 2489 "true"); 2490 2490 2491 RegisterOption("BvHierarchy.Construction.useInitialSubdivisio ",2491 RegisterOption("BvHierarchy.Construction.useInitialSubdivision", 2492 2492 optBool, 2493 2493 "bvh_construction_use_initial_subdivision=", -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1779 r1784 474 474 { 475 475 // decide upon next split type 476 const float vspPriority = viewSpaceQueue.Top() ? viewSpaceQueue.Top()->GetPriority() : -1e20f; 477 const float ospPriority = objectSpaceQueue.Top() ? objectSpaceQueue.Top()->GetPriority() : -1e20f; 476 const float vspPriority = 477 viewSpaceQueue.Top() ? viewSpaceQueue.Top()->GetPriority() : -1e20f; 478 const float ospPriority = 479 objectSpaceQueue.Top() ? objectSpaceQueue.Top()->GetPriority() : -1e20f; 478 480 479 481 cout << "new decicion, vsp: " << vspPriority << ", osp: " << ospPriority << endl; … … 505 507 const int repaired = RepairQueue(dirtyVspList, viewSpaceQueue, true); 506 508 507 cout << "\nrepaired " << repaired << " candidates from " << (int)dirtyVspList.size() << " dirtied candidates" << endl; 509 cout << "\nrepaired " << repaired << " candidates from " 510 << (int)dirtyVspList.size() << " dirtied candidates" << endl; 508 511 } 509 512 else … … 535 538 const int repaired = RepairQueue(dirtyOspList, objectSpaceQueue, true); 536 539 537 cout << "\nrepaired " << repaired << " candidates from " << (int)dirtyOspList.size() << " dirtied candidates" << endl; 540 cout << "\nrepaired " << repaired << " candidates from " 541 << (int)dirtyOspList.size() << " dirtied candidates" << endl; 538 542 } 539 543 } … … 586 590 // prepare vsp tree for traversal 587 591 mViewSpaceSubdivisionType = mSavedViewSpaceSubdivisionType; 588 589 592 PrepareViewSpaceSubdivision(mTQueue, sampleRays, objects); 590 593 } … … 596 599 PrepareObjectSpaceSubdivision(mTQueue, sampleRays, objects); 597 600 } 598 601 599 602 // begin subdivision 600 603 RunConstruction(mRepairQueue, sampleRays, objects, forcedViewSpace); … … 2047 2050 2048 2051 SubdivisionCandidate *firstVsp = mVspTree->PrepareConstruction(sampleRays, *viewSpaceRays); 2052 tQueue.Push(firstVsp); 2053 2049 2054 mBvHierarchy->PrepareConstruction(tQueue, sampleRays, objects); 2050 2055 … … 2054 2059 firstVsp->SetPriority((float)-oldVspRoot->mTimeStamp); 2055 2060 firstBvh->SetPriority((float)-oldBvhRoot->GetTimeStamp()); 2056 2057 tQueue.Push(firstVsp);2058 2061 2059 2062 ExportStats(stats, tQueue, objects); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1778 r1784 330 330 ) const 331 331 { 332 long startTime = GetTime(); 333 332 334 SimpleRayContainer simpleRays; 333 long startTime = GetTime(); 335 336 simpleRays.reserve(samplesPerPass); 337 passSamples.reserve(samplesPerPass * 2); // always creates double rays 334 338 335 339 // create one third of each type … … 349 353 } 350 354 351 cout << "generated " << samplesPerPass << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 355 cout << "generated " << samplesPerPass << " samples in " 356 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 352 357 353 358 startTime = GetTime(); 359 354 360 // shoot simple ray and add it to importance samples 355 361 mPreprocessor->CastRays(simpleRays, passSamples, true); 356 cout << "cast " << samplesPerPass << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 362 cout << "cast " << samplesPerPass << " samples in " 363 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 357 364 358 365 return (int)passSamples.size();
Note: See TracChangeset
for help on using the changeset viewer.