Changeset 2599
- Timestamp:
- 01/15/08 23:02:37 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
r2575 r2599 83 83 void Exporter::ExportKdIntersectable(const KdIntersectable &kdObj) 84 84 { 85 KdNode * node= kdObj.GetItem();85 KdNode *root = kdObj.GetItem(); 86 86 Intersectable::NewMail(); 87 87 88 // todo: traverse to leaves 89 if (node->IsLeaf()) 90 { 91 // eyport leaf pvs 92 KdLeaf *leaf = static_cast<KdLeaf *>(node); 93 94 ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 95 96 for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 97 { 98 Intersectable *obj = *oit; 99 100 if (!obj->Mailed()) 101 { 102 ExportIntersectable(obj); 103 obj->Mail(); 104 } 105 } 88 stack<KdNode *> tStack; 89 90 tStack.push(root); 91 92 while (!tStack.empty()) { 93 KdNode *node = tStack.top(); 94 tStack.pop(); 95 // todo: traverse to leaves 96 if (node->IsLeaf()) 97 { 98 // eyport leaf pvs 99 KdLeaf *leaf = static_cast<KdLeaf *>(node); 100 101 ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 102 103 for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 104 { 105 Intersectable *obj = *oit; 106 107 if (1 || !obj->Mailed()) 108 { 109 ExportIntersectable(obj); 110 obj->Mail(); 111 } 112 } 113 } else { 114 KdInterior *interior = (KdInterior *)node; 115 tStack.push(interior->mBack); 116 tStack.push(interior->mFront); 117 118 } 119 106 120 } 107 121 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HavranRayCaster.cpp
r2592 r2599 92 92 // We give a box to which each ray is clipped to before the 93 93 // ray shooting is computed ! 94 void HavranRayCaster::CastRaysPacket4( Vector3 &boxmax,95 96 97 98 99 100 { 101 #if def _USE_HAVRAN_SSE94 void HavranRayCaster::CastRaysPacket4(const Vector3 &boxmax, 95 const Vector3 &boxmin, 96 const Vector3 origin4[], 97 const Vector3 direction4[], 98 int result4[], 99 float dist4[]) 100 { 101 #if defined(_USE_HAVRAN_SSE) 102 102 #ifdef USE_HAVRAN_RAYCASTER 103 103 for (int i = 0; i < 4; i++) { 104 104 result4[i] = -1; 105 // raypack.SetObject(i, NULL); 105 106 raypack.SetLoc(i, origin4[i]); 106 107 raypack.SetDir(i, direction4[i]); … … 110 111 // a particular ASDS, otherwise it is emulated by decomposition 111 112 // of a packet to individual rays and traced individually. 112 mKtbtree->FindNearestI(raypack, boxmin, boxmax); 113 mKtbtree->FindNearestI(raypack, (Vector3&)boxmin, (Vector3&)boxmax); 114 // mKtbtree->FindNearestI(raypack, bmin, bmax); 113 115 114 116 for (int i = 0; i < 4; i++) { … … 131 133 sray.mOrigin = origin4[i]; 132 134 sray.mDirection = direction4[i]; 133 mKtbtree->FindNearestI(sray, boxmin,boxmax);135 mKtbtree->FindNearestI(sray, (Vector3&)boxmin, (Vector3&)boxmax); 134 136 if (SimpleRay::IntersectionRes[0].intersectable) { 135 137 // This is object ID - is this the triangle index ??? -
GTP/trunk/Lib/Vis/Preprocessing/src/HavranRayCaster.h
r2592 r2599 75 75 // We give a box to which each ray is clipped to before the 76 76 // ray shooting is computed ! 77 virtual void CastRaysPacket4( Vector3 &minBox,78 79 80 81 82 77 virtual void CastRaysPacket4(const Vector3 &minBox, 78 const Vector3 &maxBox, 79 const Vector3 origin4[], 80 const Vector3 direction4[], 81 int result4[], 82 float dist4[]); 83 83 84 84 #ifdef _USE_HAVRAN_SSE -
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h
r2575 r2599 152 152 } 153 153 154 155 154 156 template<typename T> 155 157 std::ostream &IntersectableWrapper<T>::Describe(std::ostream &s) 156 158 { 157 158 159 }159 s << mItem; 160 return s; 161 } 160 162 161 163 -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r2592 r2599 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: po 14. I 15:10:1120083 # Generated by qmake (2.00a) (Qt 4.1.2) on: út 15. I 21:38:15 2008 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp
r2592 r2599 18 18 19 19 namespace GtpVisibilityPreprocessor { 20 21 20 22 21 23 #define MUTATION_USE_CDF 0 … … 92 94 93 95 Intersectable *newObject = vssRays[i]->mTerminationObject; 94 96 95 97 Intersectable *oldObject = mRays[vssRays[i]->mGeneratorId].mRay->mTerminationObject; 96 98 // the ray generated a contribution although it hits the same object … … 130 132 Intersectable *oldObject = oldRay->mTerminationObject; 131 133 134 132 135 // only allow one reverse mutation per generator ray 133 136 if (!mRays[newRay->mGeneratorId].HasReverseMutation()) { … … 333 336 // in search for unocclude reverse ray 334 337 box.Scale(2.0f); 338 //box.Scale(200.0f); 335 339 336 340 const int packetSize = 4; … … 369 373 // break on first passing ray 370 374 break; 371 } 375 } 372 376 } 373 377 float rr = left + (i+1)*(right-left)/(packetSize+1); … … 377 381 } 378 382 383 379 384 float t = right; 380 385 if (right==1.0f) 381 386 return false; 382 387 388 383 389 if (i == packetSize) 384 390 origin = newPivot + right*line; … … 464 470 float left = 0.0f; 465 471 float right = radius; 472 473 AxisAlignedBox3 _box = box; 474 _box.Scale(1.1f); 466 475 // cast rays to find silhouette ray 467 476 for (int j=0; j < mSilhouetteSearchSteps; j++) { … … 476 485 // mlrtaTraverseGroupASEye4(&box.Min().x, &box.Max().x, hit_triangles, dist); 477 486 assert(preprocessor->mRayCaster); 478 preprocessor->mRayCaster->CastRaysPacket4(box.Min(), box.Max(), 479 origs, dirs, hit_triangles, dist); 487 preprocessor->mRayCaster->CastRaysPacket4(_box.Min(), 488 _box.Max(), 489 origs, 490 dirs, 491 hit_triangles, 492 dist); 480 493 481 494 for (i=0; i < packetSize; i++) { … … 491 504 right = rr; 492 505 } 506 507 Vector3 shift; 493 508 494 509 if (i == packetSize) { … … 497 512 //cout<<"W"<<i<<endl; 498 513 // return (RandomValue(1.0f, 1.5f)*radius)*line; 499 return right*line; 500 } 501 502 // cout<<i<<endl; 503 return shifts[i]; 504 514 shift = right*line; 515 } else { 516 // cout<<i<<endl; 517 shift = shifts[i]; 518 } 519 520 521 if (0) { 522 523 static VssRayContainer rRays; 524 static int counter = 0; 525 char filename[256]; 526 527 if (counter < 50) { 528 sprintf(filename, "sil_rays_%03d.x3d", counter++); 529 530 VssRay tRays[10]; 531 rRays.push_back((VssRay *)&ray); 532 for (int k=0; k < packetSize; k++) 533 if (k!=i) { 534 tRays[k] = VssRay(origin, ray.mTermination + shifts[k], NULL, NULL); 535 rRays.push_back(&tRays[k]); 536 } 537 538 Exporter *exporter = NULL; 539 exporter = Exporter::GetExporter(filename); 540 541 exporter->SetFilled(); 542 543 Intersectable *occluder = 544 ray.mTerminationObject; 545 546 // cout<<occluder->Type()<<endl; 547 548 exporter->SetForcedMaterial(RgbColor(0,0,1)); 549 exporter->ExportIntersectable(occluder); 550 551 exporter->SetWireframe(); 552 553 exporter->SetForcedMaterial(RgbColor(0,1,0)); 554 exporter->ExportBox(occluder->GetBox()); 555 556 exporter->SetForcedMaterial(RgbColor(0,1,1)); 557 exporter->ExportBox(_box); 558 559 exporter->ResetForcedMaterial(); 560 561 exporter->ExportRays(rRays, RgbColor(1, 0, 0)); 562 563 rRays.clear(); 564 tRays[0] = VssRay(origin, ray.mTermination+shift, NULL, NULL); 565 rRays.push_back((VssRay *)&tRays[0]); 566 exporter->ExportRays(rRays, RgbColor(1, 1, 0)); 567 568 delete exporter; 569 rRays.clear(); 570 } 571 } 572 573 return shift; 574 575 505 576 #else 506 577 //cerr << "warning: shiluette mutation not supported" << endl; … … 540 611 #if !MUTATION_USE_CDF 541 612 #if SORT_RAY_ENTRIES 613 // RAYS are sorted -> find mitation candidate from the tail of the buffer 542 614 index = mLastIndex - 1; 543 615 if (index < 0 || index >= mRays.size()-1) { … … 574 646 #endif 575 647 #else 648 576 649 static HaltonSequence iHalton; 577 650 iHalton.GetNext(1, rr); … … 596 669 // cout<<index<<" "<<rr[0]<<" "<<mRays[index].mCdf<<" "<<mRays[(index+1)%mRays.size()].mCdf<<endl; 597 670 671 // WE HAVE THE INDEX HERE 672 598 673 mLastIndex = index; 599 674 // Debug<<index<<" "<<mRays[index].GetSamplingFactor()<<endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2598 r2599 1267 1267 1268 1268 } 1269 1269 1270 1270 // cerr<<"Determining PVS objects"<<endl; 1271 1271 DeterminePvsObjects(vssRays); 1272 1272 // cerr<<"done."<<endl; 1273 1274 1273 1275 1274 } 1276 1275 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2598 r2599 2483 2483 const bool useHitObjects) 2484 2484 { 2485 2486 { 2487 2488 2489 2490 2491 { 2492 2493 2494 2495 2485 if (!useHitObjects) 2486 { 2487 // store higher order object (e.g., bvh node) instead of object itself 2488 VssRayContainer::const_iterator it, it_end = rays.end(); 2489 2490 for (it = rays.begin(); it != it_end; ++ it) 2491 { 2492 VssRay *vssRay = *it; 2493 2494 // set only the termination object 2495 vssRay->mTerminationObject = GetIntersectable(*vssRay, true); 2496 2496 } 2497 2497 } … … 5723 5723 { 5724 5724 if (mUseKdPvs) 5725 5725 return ViewCellsManager::GetIntersectable(ray, isTermination); 5726 5726 else 5727 5727 return mHierarchyManager->GetIntersectable(ray, isTermination); 5728 5728 } 5729 5729 -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r2592 r2599 53 53 useGlDebugger false 54 54 # 0 = INTERNAL 1 = MLRT 2 = HAVRAN 55 rayCastMethod 255 rayCastMethod 1 56 56 57 57 # type sampling -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test2
r2590 r2599 3 3 4 4 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 5 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=20000000 -mutation_use_pass_importance- "5 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=20000000 -mutation_use_pass_importance- -mutation_silhouette_search_steps=3" 6 6 7 7 #SCENE="../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d"
Note: See TracChangeset
for help on using the changeset viewer.