Changeset 1727 for GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
- Timestamp:
- 11/09/06 03:35:58 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1723 r1727 149 149 "Hierarchy.Termination.maxMemory", mTermMaxMemory); 150 150 151 Environment::GetSingleton()->GetIntValue( 152 "Hierarchy.Construction.maxRepairs", mMaxRepairs); 153 151 154 if (1 && mConsiderMemory2) 152 155 { … … 177 180 Debug << "min steps of same kind: " << mMinStepsOfSameType << endl; 178 181 Debug << "max steps of same kind: " << mMaxStepsOfSameType << endl; 182 Debug << "max repairs: " << mMaxRepairs << endl; 179 183 180 184 switch (mConstructionType) … … 418 422 const int maxSteps = mMaxStepsOfSameType; 419 423 420 SubdivisionCandidate *osc = PrepareObjectSpaceSubdivision(sampleRays, objects); 424 SubdivisionCandidate *osc = 425 PrepareObjectSpaceSubdivision(sampleRays, objects); 421 426 objectSpaceQueue.Push(osc); 422 423 427 424 428 ///////////////////////// … … 430 434 // for first round, use sah splits. Once view space partition 431 435 // has started, use render cost heuristics instead 432 ospSteps = RunConstruction(objectSpaceQueue, dirtyList, NULL, minSteps, maxSteps); 436 ospSteps = RunConstruction(objectSpaceQueue, 437 dirtyList, 438 NULL, 439 minSteps, 440 maxSteps); 441 433 442 cout << "\n" << ospSteps << " object space partition steps taken" << endl; 434 443 … … 474 483 { 475 484 // decide upon next split type 485 if (viewSpaceQueue.Top()->IsDirty()) 486 viewSpaceQueue.Top()->EvalCandidate(); 487 488 if (objectSpaceQueue.Top()->IsDirty()) 489 objectSpaceQueue.Top()->EvalCandidate(); 490 476 491 const float vspPriority = viewSpaceQueue.Top() ? viewSpaceQueue.Top()->GetPriority() : -1e20f; 477 492 const float ospPriority = objectSpaceQueue.Top() ? objectSpaceQueue.Top()->GetPriority() : -1e20f; … … 489 504 SubdivisionCandidateContainer dirtyVspList; 490 505 491 // subdivide object space first 492 // for first round,use sah splits. Once view space partition506 // subdivide object space first for first round, 507 // use sah splits. Once view space partition 493 508 // has started, use render cost heuristics instead 494 const int ospSteps = 495 RunConstruction(objectSpaceQueue, dirtyVspList, viewSpaceQueue.Top(), minSteps, maxSteps); 509 const int ospSteps = RunConstruction(objectSpaceQueue, 510 dirtyVspList, 511 viewSpaceQueue.Top(), 512 minSteps, 513 maxSteps); 496 514 497 515 cout << "\n" << ospSteps << " object space partition steps taken" << endl; … … 501 519 cout << "repairing queue ... " << endl; 502 520 RepairQueue(dirtyVspList, viewSpaceQueue, true); 521 503 522 cout << "\nrepaired " << (int)dirtyVspList.size() << " candidates" << endl; 504 523 } … … 515 534 516 535 // process view space candidates 517 const int vspSteps = 518 RunConstruction(viewSpaceQueue, dirtyOspList, objectSpaceQueue.Top(), minSteps, maxSteps); 536 const int vspSteps = RunConstruction(viewSpaceQueue, 537 dirtyOspList, 538 objectSpaceQueue.Top(), 539 minSteps, 540 maxSteps); 519 541 520 542 cout << "\n" << vspSteps << " view space partition steps taken" << endl; … … 527 549 cout << "repairing queue ... " << endl; 528 550 RepairQueue(dirtyOspList, objectSpaceQueue, true); 551 529 552 cout << "repaired " << (int)dirtyOspList.size() << " candidates" << endl; 530 553 } … … 965 988 while (!splitQueue.Empty()) 966 989 { 990 // reevaluate current candidate 991 if (splitQueue.Top()->IsDirty()) 992 splitQueue.Top()->EvalCandidate(); 993 967 994 const float priority = splitQueue.Top()->GetPriority(); 968 995 const float threshold = oldCandidate ? oldCandidate->GetPriority() : 1e20f; … … 975 1002 } 976 1003 977 SubdivisionCandidate *sc = NextSubdivisionCandidate(splitQueue);978 979 1004 //////// 980 1005 //-- subdivide leaf node of either type 981 1006 1007 SubdivisionCandidate *sc = NextSubdivisionCandidate(splitQueue); 1008 982 1009 const bool repairQueue = false; 983 1010 const bool success = ApplySubdivisionCandidate(sc, splitQueue, repairQueue); … … 1323 1350 const long startTime = GetTime(); 1324 1351 if (0) cout << "repairing " << (int)dirtyList.size() << " candidates ... "; 1325 1352 1353 const float prop = (float)mMaxRepairs / (float)dirtyList.size(); 1326 1354 1327 1355 /////////////////////////// … … 1332 1360 for (sit = dirtyList.begin(); sit != sit_end; ++ sit) 1333 1361 { 1362 // only repair a certain number of candidates 1363 if ((mMaxRepairs < (int)dirtyList.size()) && (Random(1.0f) >= prop)) 1364 continue; 1365 1334 1366 SubdivisionCandidate* sc = *sit; 1335 1367 const float rcd = sc->GetRenderCostDecrease();
Note: See TracChangeset
for help on using the changeset viewer.