Changeset 2599 for GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp
- Timestamp:
- 01/15/08 23:02:37 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.