- Timestamp:
- 10/17/05 02:57:13 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r330 r331 9 9 # filename vienna.x3d 10 10 # filename ../data/vienna/vienna-simple.x3d 11 filename ../data/vienna/vienna-buildings.x3d11 # filename ../data/vienna/vienna-buildings.x3d 12 12 # filename ../data/vienna/viewcells-25-sel.x3d 13 #filename ../data/atlanta/atlanta2.x3d13 filename ../data/atlanta/atlanta2.x3d 14 14 # filename ../data/soda/soda.dat 15 15 # filename ../data/soda/soda5.dat … … 56 56 57 57 Sampling { 58 totalSamples 500058 totalSamples 1000000 59 59 samplesPerPass 20 60 60 } … … 76 76 BspTree { 77 77 Construction { 78 78 input fromRays 79 79 # input fromViewCells 80 80 # input fromSceneGeometry 81 samples 300081 samples 200000 82 82 sideTolerance 0.002 83 83 } … … 114 114 Termination { 115 115 maxPolysForAxisAligned 100 116 maxPolygons 2 0116 maxPolygons 2 117 117 maxDepth 100 118 118 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r329 r331 53 53 54 54 if (strcmp(viewCellsStr, "bspTree") == 0) 55 { 56 Debug << "here bsp" << endl; 57 mViewCellsType = BSP_VIEW_CELLS; 58 } 55 mViewCellsType = BSP_VIEW_CELLS; 59 56 else if (strcmp(viewCellsStr, "kdTree") == 0) 60 { 61 Debug << "here kd" << endl; 62 mViewCellsType = KD_VIEW_CELLS; 63 } 57 mViewCellsType = KD_VIEW_CELLS; 64 58 else if (strcmp(viewCellsStr, "sceneDependent") == 0) 65 59 { -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r330 r331 8 8 #include "ViewCell.h" 9 9 10 SamplingPreprocessor::SamplingPreprocessor(): mPass(0) 10 SamplingPreprocessor::SamplingPreprocessor(): mPass(0), mSampleRays(NULL) 11 11 { 12 12 // this should increase coherence of the samples … … 22 22 SamplingPreprocessor::~SamplingPreprocessor() 23 23 { 24 // clean up 25 if (mSampleRays) 26 { 27 CLEAR_CONTAINER (*mSampleRays); 28 DEL_PTR (mSampleRays); 29 } 24 CLEAR_CONTAINER(mSampleRays); 30 25 } 31 26 … … 66 61 break; 67 62 case BspTree::FROM_SCENE_GEOMETRY: 68 69 63 DeleteViewCells(); // we generate new view cells 70 64 mSceneGraph->CollectObjects(&objects); 71 mBspTree->Construct(objects, &mViewCells); 72 65 mBspTree->Construct(objects, &mViewCells); 73 66 break; 74 67 case BspTree::FROM_RAYS: 75 68 DeleteViewCells(); // we generate new view cells 76 mSceneGraph->CollectObjects(&objects);77 69 mBspTree->Construct(mSampleRays, &mViewCells); 78 70 break; … … 81 73 break; 82 74 } 75 83 76 84 77 return true; … … 278 271 279 272 int pvsOut = Min((int)objects.size(), 10); 280 int vcPvsOut = Min((int)mViewCells.size(), 5); 281 273 274 vector<Ray> rays[10]; 275 276 vector<Ray> vcRays[5]; 282 277 ViewCellContainer pvsViewCells; 283 284 // some random view cells for output285 for (int j = 0; j < vcPvsOut; ++ j)286 {287 int idx = Random((int)mViewCells.size());288 Debug << "output view cell=" << idx << endl;289 pvsViewCells.push_back(mViewCells[Random((int)mViewCells.size())]);290 }291 292 vector<Ray> rays[10];293 vector<Ray> vcRays[5];294 295 278 vector<Ray> viewCellRays; // used for BSP tree construction 296 297 mSampleRays = new RayContainer();298 //mSampleRays->reserve(mBspConstructionSamples);299 279 300 280 while (totalSamples < mTotalSamples) { … … 303 283 int passSamples = 0; 304 284 int index = 0; 305 306 cout << "totalSamples: " << totalSamples; 285 Real maxTime = 0; 286 int maxTimeIdx = 0; 287 288 cout << "totalSamples: " << totalSamples << endl; 289 307 290 for (i = 0; i < objects.size(); i++) { 308 309 Debug << "\nsampling object " << i << " of " << (int)objects.size() << " sample " << passSamples << endl; 310 291 311 292 KdNode *nodeToSample = NULL; 312 293 Intersectable *object = objects[i]; … … 369 350 370 351 object->GetRandomSurfacePoint(point, normal); 352 353 long samplesPerObjStart = GetTime(); 354 371 355 bool viewcellSample = true; 372 356 int sampleContributions; 373 374 long startTime = GetTime();375 357 376 358 if (viewcellSample) { … … 400 382 sampleContributions = CastRay(object, ray); 401 383 402 // CORR matt: put inside loop 384 //-- CORR matt: put block inside loop 385 if (sampleContributions) { 386 passContributingSamples++; 387 passSampleContributions += sampleContributions; 388 } 389 403 390 if ( i < pvsOut ) 404 391 rays[i].push_back(ray); … … 412 399 } 413 400 } 401 //------------------- 414 402 415 403 if (mViewCellsType == BSP_VIEW_CELLS) 416 404 { 417 405 // save rays for bsp tree construction 418 406 if ((BspTree::sConstructionMethod = BspTree::FROM_RAYS) && 419 407 (totalSamples < mBspConstructionSamples)) 420 408 { 421 //cout << "pushing back sampling ray << " << mSampleRays ->size() << endl;422 mSampleRays ->push_back(new Ray(ray));409 //cout << "pushing back sampling ray << " << mSampleRays.size() << endl; 410 mSampleRays.push_back(new Ray(ray)); 423 411 } 424 412 else 425 413 { 426 414 // construct BSP tree using the samples 427 415 if (!mBspTree) 428 416 { 429 Debug << "Building bsp tree" << endl;430 417 BuildBspTree(); 431 418 432 CLEAR_CONTAINER (*mSampleRays);433 DEL_PTR (mSampleRays);419 BspTreeStatistics(Debug); 420 Export("vc_bsptree.x3d", false, false, true); 434 421 } 435 422 // check whether we can add this to the rays … … 440 427 vcRays[j].push_back(ray); 441 428 } 429 // some random view cells for output 430 if (pvsViewCells.empty()) 431 { 432 int vcPvsOut = Min((int)mViewCells.size(), 5); 433 434 for (int j = 0; j < vcPvsOut; ++ j) 435 { 436 int idx = Random((int)mViewCells.size()); 437 Debug << "output view cell=" << idx << endl; 438 pvsViewCells.push_back(mViewCells[Random((int)mViewCells.size())]); 439 } 440 } 442 441 } 443 442 } … … 449 448 // object->GetRandomVisibleMesh(Plane3(normal, point)); 450 449 } 451 long t = TimeDiff(startTime, GetTime()); 452 Debug << "pass time: " << t << endl; 453 450 451 // measure maximal time for samples per object 452 Real t = TimeDiff(samplesPerObjStart, GetTime()); 453 454 if (t > maxTime) 455 { 456 maxTime = t; 457 maxTimeIdx = i; 458 } 459 460 // CORR matt: must add all samples 454 461 passSamples += mSamplesPerPass; 455 456 if (sampleContributions) {457 passContributingSamples++;458 passSampleContributions += sampleContributions;459 }460 462 } 461 463 462 // CORR matt: must add pass samples 463 totalSamples += passSamples; // totalSamples ++; 464 totalSamples += passSamples; 464 465 465 466 // if (pass>10) 466 467 // HoleSamplingPass(); 467 468 468 469 469 mPass++; 470 470 … … 483 483 } 484 484 485 cout << "#Pass " << mPass<<" : t = " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 485 Debug << "maximal time needed for pass: " << maxTime << " (object " << maxTimeIdx << ")" << endl; 486 487 float avgRayContrib = (passContributingSamples > 0) ? 488 passSampleContributions/(float)passContributingSamples : 0; 489 490 cout << "#Pass " << mPass << " : t = " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 486 491 cout << "#TotalSamples=" << totalSamples/1000 487 492 << "k #SampleContributions=" << passSampleContributions << " (" 488 493 << 100*passContributingSamples/(float)passSamples<<"%)" << " avgPVS=" 489 494 << pvsSize/(float)objects.size() << endl 490 << "avg ray contrib=" << 491 ((passContributingSamples > 0) ? passSampleContributions/(float)passContributingSamples : 0) 492 << endl; 493 495 << "avg ray contrib=" << avgRayContrib << endl; 494 496 495 497 mStats << … … 500 502 "#PContributingSamples\n"<<100*passContributingSamples/(float)passSamples<<endl << 501 503 "#AvgPVS\n"<< pvsSize/(float)objects.size() << endl << 502 "#AvgRayContrib\n" << 503 ((passContributingSamples > 0) ? passSampleContributions/(float)passContributingSamples : 0) 504 << endl; 504 "#AvgRayContrib\n" << avgRayContrib << endl; 505 505 } 506 506 … … 509 509 510 510 // HoleSamplingPass(); 511 if ( 1) {511 if (0) { 512 512 Exporter *exporter = Exporter::GetExporter("ray-density.x3d"); 513 513 exporter->SetExportRayDensity(true); … … 534 534 delete exporter; 535 535 } 536 536 537 if (1) { 537 538 if (mViewCellsType == BSP_VIEW_CELLS) 538 539 { 540 bool exportSplits = false; 541 environment->GetBoolValue("BspTree.exportSplits", exportSplits); 542 543 // export the bsp splits 544 if (exportSplits) 545 { 546 Exporter *exporter = Exporter::GetExporter("bsp_splits.x3d"); 547 548 if (exporter) 549 { 550 Material m; 551 m.mDiffuseColor = RgbColor(1, 0, 0); 552 exporter->SetForcedMaterial(m); 553 exporter->SetWireframe(); 554 exporter->ExportBspSplits(*mBspTree); 555 556 // take forced material, else big scenes cannot be viewed 557 m.mDiffuseColor = RgbColor(0, 1, 0); 558 exporter->SetForcedMaterial(m); 559 exporter->SetFilled(); 560 561 exporter->ResetForcedMaterial(); 562 563 if (1) 564 { 565 Material m;//= RandomMaterial(); 566 m.mDiffuseColor = RgbColor(0, 0, 1); 567 exporter->SetForcedMaterial(m); 568 569 for (int j = 0; j < objects.size(); ++ j) 570 exporter->ExportIntersectable(objects[j]); 571 572 delete exporter; 573 } 574 } 575 } 576 539 577 for (int j = 0; j < pvsViewCells.size(); ++ j) 540 541 542 543 544 545 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", j); 546 547 548 549 550 551 552 553 554 555 556 557 Debug << "pvs size: " << (int)vc->GetPvs().GetSize() << " of " << (int)objects.size();558 Debug << " exporting rays:" << (int)vcRays[j].size() << endl;559 560 561 562 563 564 565 578 { 579 ViewCell *vc = pvsViewCells[j]; 580 581 Intersectable::NewMail(); 582 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", j); 583 584 Exporter *exporter = Exporter::GetExporter(s); 585 exporter->SetFilled(); 586 587 ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 588 589 Material m;//= RandomMaterial(); 590 m.mDiffuseColor = RgbColor(0, 1, 0); 591 exporter->SetForcedMaterial(m); 592 593 exporter->ExportViewCell(vc); 594 595 Debug << j << ": pvs size=" << (int)vc->GetPvs().GetSize() 596 << ", piercing rays=" << (int)vcRays[j].size() << endl; 597 598 exporter->SetWireframe(); 599 600 // export view cells 601 m.mDiffuseColor = RgbColor(1, 0, 1); 602 exporter->SetForcedMaterial(m); 603 exporter->ExportViewCells(mViewCells); 566 604 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 605 // export rays piercing this view cell 606 exporter->ExportRays(vcRays[j], 1000, RgbColor(0, 1, 0)); 607 608 m.mDiffuseColor = RgbColor(1, 0, 0); 609 exporter->SetForcedMaterial(m); 610 611 // output pvs of view cell 612 for (; it != vc->GetPvs().mEntries.end(); ++ it) 613 { 614 Intersectable *intersect = (*it).first; 615 if (!intersect->Mailed()) 616 { 617 exporter->ExportIntersectable(intersect); 618 intersect->Mail(); 619 } 620 } 621 622 // output rest of the objects 623 if (1) 624 { 625 Material m;//= RandomMaterial(); 626 m.mDiffuseColor = RgbColor(0, 0, 1); 627 exporter->SetForcedMaterial(m); 628 629 for (int j = 0; j < objects.size(); ++ j) 630 if (!objects[j]->Mailed()) 631 { 632 //if (j == 2198)m.mDiffuseColor = RgbColor(1, 0, 1); 633 //else m.mDiffuseColor = RgbColor(1, 1, 0); 634 exporter->SetForcedMaterial(m); 635 exporter->ExportIntersectable(objects[j]); 636 objects[j]->Mail(); 637 } 638 } 639 DEL_PTR(exporter); 602 640 } 603 641 } -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h
r329 r331 23 23 ofstream mStats; 24 24 ObjectContainer mObjects; 25 RayContainer *mSampleRays;25 RayContainer mSampleRays; 26 26 int mBspConstructionSamples; 27 27 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r330 r331 174 174 // bound ray 175 175 if ((ray->GetType() == Ray::LOCAL_RAY) && 176 ( ray->intersections.empty()) &&176 (!ray->intersections.empty()) && 177 177 (ray->intersections[0].mT <= maxT)) 178 178 { … … 327 327 { 328 328 } 329 329 330 ViewCell *BspLeaf::GetViewCell() 330 331 { … … 341 342 return true; 342 343 } 344 345 int BspLeaf::GenerateViewCell(const RayContainer &rays, 346 ViewCellContainer &viewCells) 347 { 348 int sampleContri = 0; 349 ViewCell *viewCell = new ViewCell(); 350 viewCells.push_back(viewCell); 351 352 mViewCell = viewCell; 353 354 RayContainer::const_iterator it, it_end = rays.end(); 355 356 // add contributions from samples to the PVS 357 for (it = rays.begin(); it != it_end; ++ it) 358 { 359 for (int i = 0; i < (int)(*it)->intersections.size(); ++ i) 360 sampleContri = viewCell->GetPvs().AddSample((*it)->intersections[i].mObject); 361 } 362 return sampleContri; 363 } 364 343 365 344 366 /****************************************************************/ … … 501 523 BspNode *subRoot = Subdivide(tStack, tData); 502 524 525 int sampleContri = 0; 526 503 527 // generate new view cell for each leaf 504 528 if (viewCells && subRoot->IsLeaf()) 505 GenerateViewCell(dynamic_cast<BspLeaf *>(subRoot), *viewCells); 506 } 507 } 508 } 509 510 void BspTree::GenerateViewCell(BspLeaf *leaf, ViewCellContainer &viewCells) const 511 { 512 ViewCell *viewCell = new ViewCell(); 513 viewCells.push_back(viewCell); 514 515 leaf->SetViewCell(viewCell); 529 sampleContri += dynamic_cast<BspLeaf *>(subRoot)-> 530 GenerateViewCell(*tData.mRays, *viewCells); 531 532 DEL_PTR(tData.mRays); 533 } 534 } 516 535 } 517 536 … … 585 604 } 586 605 587 voidBspTree::Construct(const ViewCellContainer &viewCells)606 int BspTree::Construct(const ViewCellContainer &viewCells) 588 607 { 589 608 mStat.nodes = 1; … … 595 614 596 615 // construct tree from the view cell polygons 597 Construct(polys, new RayContainer());598 } 599 600 601 voidBspTree::Construct(const ObjectContainer &objects, ViewCellContainer *viewCells)616 return Construct(polys, new RayContainer()); 617 } 618 619 620 int BspTree::Construct(const ObjectContainer &objects, ViewCellContainer *viewCells) 602 621 { 603 622 mStat.nodes = 1; … … 610 629 611 630 // construct tree from polygon soup 612 Construct(polys, new RayContainer(), viewCells);613 } 614 615 void BspTree::Construct(RayContainer *rays,631 return Construct(polys, new RayContainer(), viewCells); 632 } 633 634 int BspTree::Construct(const RayContainer &sampleRays, 616 635 ViewCellContainer *viewCells) 617 636 { 637 mStat.nodes = 1; 638 mBox.Initialize(); // initialise bsp tree bounding box 639 618 640 PolygonContainer *polys = new PolygonContainer(); 619 620 RayContainer::const_iterator rit, rit_end = rays->end(); 641 RayContainer *rays = new RayContainer(); 642 643 RayContainer::const_iterator rit, rit_end = sampleRays.end(); 621 644 622 645 long startTime = GetTime(); … … 626 649 627 650 //-- extract polygons from faces stored in the rays 628 for (rit = rays->begin(); rit != rit_end; ++ rit)651 for (rit = sampleRays.begin(); rit != rit_end; ++ rit) 629 652 { 630 653 Ray *ray = *rit; 631 632 654 ray->SetId(-1); // reset id 655 rays->push_back(ray); 633 656 634 657 for (int i = 0; i < (int)ray->intersections.size(); ++ i) 635 658 { 636 659 MeshInstance *obj = dynamic_cast<MeshInstance *>(ray->intersections[i].mObject); 637 Face *face = obj->GetMesh()->mFaces[i]; 638 639 std::map<Face *, Polygon3 *>::iterator it= facePolyMap.find(face); 640 641 if (it != facePolyMap.end()) 642 { 643 (*it).second->AddPiercingRay(ray); 644 } 645 else 646 { 647 Polygon3 *poly = new Polygon3(face, obj->GetMesh()); 648 polys->push_back(poly); 649 poly->AddPiercingRay(ray); 650 651 facePolyMap[face] = poly; 652 } 653 } 654 } 655 656 660 Face *face = obj->GetMesh()->mFaces[ray->intersections[i].mFace]; 661 662 // store rays piercing a face with the polygon representing the face 663 std::map<Face *, Polygon3 *>::iterator it= facePolyMap.find(face); 664 665 if (it != facePolyMap.end()) 666 { 667 (*it).second->AddPiercingRay(ray); 668 } 669 else 670 { 671 Polygon3 *poly = new Polygon3(face, obj->GetMesh()); 672 polys->push_back(poly); 673 Debug << "poly: " << *poly << endl; 674 poly->AddPiercingRay(ray); 675 676 facePolyMap[face] = poly; 677 } 678 } 679 } 680 681 Polygon3::IncludeInBox(*polys, mBox); 657 682 mStat.polys = (int)polys->size(); 658 683 659 Debug << "**** Finished polygon extraction ****\n"; 660 Debug << "ray casting time: " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 661 662 Construct(polys, rays, viewCells); 663 } 664 665 void BspTree::Construct(PolygonContainer *polys, RayContainer *rays, ViewCellContainer *viewCells) 684 Debug << "**** Finished polygon extraction ****" << endl; 685 Debug << polys->size() << " polys extracted from " << rays->size() << " rays" << endl; 686 Debug << "extraction time: " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 687 688 return Construct(polys, rays, viewCells); 689 } 690 691 int BspTree::Construct(PolygonContainer *polys, 692 RayContainer *rays, 693 ViewCellContainer *viewCells) 666 694 { 667 695 std::stack<BspTraversalData> tStack; 668 696 669 697 BspTraversalData tData(new BspLeaf(), polys, 0, mRootCell, rays); 670 671 698 tStack.push(tData); 672 699 … … 674 701 cout << "**** Contructing bsp tree ****\n"; 675 702 703 int sampleContri = 0; 704 676 705 while (!tStack.empty()) 677 706 { … … 683 712 684 713 if (viewCells && subRoot->IsLeaf()) 685 GenerateViewCell(dynamic_cast<BspLeaf *>(subRoot), *viewCells); 714 sampleContri += dynamic_cast<BspLeaf *>(subRoot)-> 715 GenerateViewCell(*tData.mRays, *viewCells); 716 DEL_PTR(tData.mRays); 686 717 } 687 718 688 719 cout << "**** Finished tree construction ****\n"; 689 720 Debug << "BSP tree contruction time: " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 721 return sampleContri; 690 722 } 691 723 … … 696 728 if ((tData.mPolygons->size() <= sTermMaxPolygons) || (tData.mDepth >= sTermMaxDepth)) 697 729 { 698 #ifdef _DEBUG730 //#ifdef _DEBUG 699 731 Debug << "subdivision terminated at depth " << tData.mDepth << ", #polys: " 700 732 << (int)tData.mPolygons->size() << endl; 701 #endif733 //#endif 702 734 EvaluateLeafStats(tData); 703 735 BspLeaf *leaf = dynamic_cast<BspLeaf *>(tData.mNode); … … 711 743 leaf->ProcessPolygons(tData.mPolygons, sStoreSplitPolys); 712 744 DEL_PTR(tData.mPolygons); 713 DEL_PTR(tData.mRays); 714 745 715 746 return leaf; 716 747 } … … 726 757 RayContainer *backRays = new RayContainer(); 727 758 728 729 759 // create new interior node and two leaf nodes 730 760 BspInterior *interior = SubdivideNode(dynamic_cast<BspLeaf *>(tData.mNode), … … 736 766 *frontRays, 737 767 *backRays); 738 739 768 ViewCell *frontViewCell = mRootCell; 740 769 ViewCell *backViewCell = mRootCell; … … 775 804 DEL_PTR(tData.mNode); 776 805 DEL_PTR(tData.mPolygons); 777 DEL_PTR(tData.mRays); 778 806 779 807 return interior; 780 808 } … … 820 848 { 821 849 mStat.nodes += 2; 822 850 823 851 // select subdivision plane 824 852 BspInterior *interior = … … 838 866 coincident, 839 867 sStoreSplitPolys); 868 840 869 BspInterior *parent = leaf->GetParent(); 841 870 … … 1063 1092 { 1064 1093 float val = 0; 1065 1094 1066 1095 if (sSplitPlaneStrategy & VERTICAL_AXIS) 1067 1096 { -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r329 r331 229 229 void SetViewCell(ViewCell *viewCell); 230 230 231 /** Generates new view cell and stores it back in the container. 232 @returns the number of sample contributions from the rays 233 */ 234 int GenerateViewCell(const RayContainer &rays, ViewCellContainer &viewCells); 235 231 236 protected: 232 237 … … 295 300 Many leafs can point to the same viewcell. 296 301 */ 297 voidConstruct(const ViewCellContainer &viewCells);302 int Construct(const ViewCellContainer &viewCells); 298 303 299 304 /** Constructs tree using the given list of objects. … … 304 309 @returns list of view cells. 305 310 */ 306 voidConstruct(const ObjectContainer &objects, ViewCellContainer *viewCells);307 308 /** Constructs the tree from a given bundleof rays.309 @param rays the bundle of sample rays311 int Construct(const ObjectContainer &objects, ViewCellContainer *viewCells); 312 313 /** Constructs the tree from a given set of rays. 314 @param sampleRays the set of sample rays the construction is based on 310 315 @param viewCells if not NULL, new view cells are 311 316 created in the leafs and stored in the conatainer 312 317 */ 313 void Construct(RayContainer *rays,314 318 int Construct(const RayContainer &sampleRays, 319 ViewCellContainer *viewCells = NULL); 315 320 316 321 /** Returns list of BSP leaves. … … 380 385 created in the leafs and stored in the conatainer 381 386 */ 382 void Construct(PolygonContainer *polys, RayContainer *rays, ViewCellContainer *viewCells = NULL); 387 int Construct(PolygonContainer *polys, 388 RayContainer *rays, 389 ViewCellContainer *viewCells = NULL); 383 390 384 391 /** Selects the best possible splitting plane. … … 526 533 vector<SortableEntry> &splitCandidates) const; 527 534 528 529 /** Generates new view cell for a leaf and stores it back in the container.530 */531 void BspTree::GenerateViewCell(BspLeaf *leaf, ViewCellContainer &viewCells) const;532 533 535 /// Pointer to the root of the tree 534 536 BspNode *mRoot; -
trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp
r330 r331 39 39 p->ParseViewCellsOptions(); 40 40 41 // construct tree immediately for "from view cells" or "from scene geometry" 42 // construction method. For "from rays" construction, wait until there is 43 // a certain number of rays collected 41 44 if (p->mViewCellsType == Preprocessor::BSP_VIEW_CELLS && 42 !(BspTree::sConstructionMethod == BspTree::FROM_RAYS)) // construct tree later45 !(BspTree::sConstructionMethod == BspTree::FROM_RAYS)) 43 46 { 44 Debug << "do1" << endl;45 47 if (BspTree::sConstructionMethod == BspTree::FROM_INPUT_VIEW_CELLS) 46 48 { … … 61 63 p->BspTreeStatistics(Debug); 62 64 63 bool exportSplits = false;64 environment->GetBoolValue("BspTree.exportSplits", exportSplits);65 66 // export the bsp splits67 if (exportSplits)68 {69 Exporter *exporter = Exporter::GetExporter("bsp_splits.x3d");70 71 if (exporter)72 {73 Material m;74 m.mDiffuseColor = RgbColor(1, 0, 0);75 exporter->SetForcedMaterial(m);76 exporter->SetWireframe();77 exporter->ExportBspSplits(*p->mBspTree);78 79 // take forced material because does not load for big scenes otherwise80 m.mDiffuseColor = RgbColor(0, 1, 0);81 exporter->SetForcedMaterial(m);82 exporter->SetFilled();83 84 exporter->ResetForcedMaterial();85 86 if (1)87 {88 ObjectContainer objects;89 p->mSceneGraph->CollectObjects(&objects);90 Material m;//= RandomMaterial();91 m.mDiffuseColor = RgbColor(0, 0, 1);92 exporter->SetForcedMaterial(m);93 94 for (int j = 0; j < objects.size(); ++ j)95 exporter->ExportIntersectable(objects[j]);96 97 delete exporter;98 }99 }100 }101 65 #if 0 102 66 //-- export the complementary view cells
Note: See TracChangeset
for help on using the changeset viewer.