Changeset 1020 for GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
- Timestamp:
- 06/18/06 03:47:06 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1006 r1020 12 12 #include "GlRenderer.h" 13 13 #include "PlyParser.h" 14 #include "SamplingStrategy.h" 15 16 14 17 15 18 namespace GtpVisibilityPreprocessor { 16 19 20 const static bool ADDITIONAL_GEOMETRY_HACK = false; 17 21 18 22 Preprocessor *preprocessor; … … 76 80 //Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025); 77 81 Vector3 boxSize = sceneBox.Size() * Vector3(0.005, 0.02, 0.005); 82 78 83 AxisAlignedBox3 box(pt2 + 0.1, pt2 + boxSize); 79 84 Mesh *mesh = CreateMeshFromBox(box); … … 243 248 { 244 249 // HACK 245 //AddGeometry(mSceneGraph); 246 mSceneGraph->AssignObjectIds(); 247 248 int intersectables, faces; 249 mSceneGraph->GetStatistics(intersectables, faces); 250 251 cout<<filename<<" parsed successfully."<<endl; 252 cout<<"#NUM_OBJECTS (Total numner of objects)\n"<<intersectables<<endl; 253 cout<<"#NUM_FACES (Total numner of faces)\n"<<faces<<endl; 254 mSceneGraph->CollectObjects(&mObjects); 255 mSceneGraph->mRoot->UpdateBox(); 256 257 /* Exporter *exporter = Exporter::GetExporter("testload.x3d"); 258 259 if (exporter) 260 { 261 exporter->ExportGeometry(mObjects); 262 delete exporter; 263 }*/ 264 250 if (ADDITIONAL_GEOMETRY_HACK) 251 AddGeometry(mSceneGraph); 252 253 mSceneGraph->AssignObjectIds(); 254 255 int intersectables, faces; 256 mSceneGraph->GetStatistics(intersectables, faces); 257 258 cout<<filename<<" parsed successfully."<<endl; 259 cout<<"#NUM_OBJECTS (Total numner of objects)\n"<<intersectables<<endl; 260 cout<<"#NUM_FACES (Total numner of faces)\n"<<faces<<endl; 261 mSceneGraph->CollectObjects(&mObjects); 262 mSceneGraph->mRoot->UpdateBox(); 263 264 if (0) 265 { 266 Exporter *exporter = Exporter::GetExporter("testload.x3d"); 267 268 if (exporter) 269 { 270 exporter->ExportGeometry(mObjects); 271 delete exporter; 272 } 273 } 265 274 } 266 275 … … 594 603 } 595 604 596 597 605 #if 0 // matt: implemented interface samplestrategy 598 606 bool 599 607 Preprocessor::GenerateRays( … … 656 664 return true; 657 665 } 658 659 } 666 #endif 667 bool Preprocessor::GenerateRays(const int number, 668 const int sampleType, 669 SimpleRayContainer &rays) 670 { 671 Vector3 origin, direction; 672 673 const int startSize = (int)rays.size(); 674 SamplingStrategy *strategy = GenerateSamplingStrategy(sampleType); 675 676 if (!strategy) 677 return false; 678 679 for (int i=0; (int)rays.size() - startSize < number; ++ i) 680 { 681 SimpleRay newRay; 682 bool success = strategy->GenerateSample(newRay); 683 684 if (success) 685 rays.AddRay(newRay); 686 } 687 688 delete strategy; 689 690 return true; 691 } 692 693 694 SamplingStrategy *Preprocessor::GenerateSamplingStrategy(const int strategyId) const 695 { 696 switch (strategyId) 697 { 698 case OBJECT_BASED_DISTRIBUTION: 699 return new ObjectBasedDistribution(*this); 700 case OBJECT_DIRECTION_BASED_DISTRIBUTION: 701 return new ObjectDirectionBasedDistribution(*this); 702 case DIRECTION_BASED_DISTRIBUTION: 703 return new DirectionBasedDistribution(*this); 704 case DIRECTION_BOX_BASED_DISTRIBUTION: 705 return new DirectionBoxBasedDistribution(*this); 706 case SPATIAL_BOX_BASED_DISTRIBUTION: 707 return new SpatialBoxBasedDistribution(*this); 708 case OBJECTS_INTERIOR_DISTRIBUTION: 709 return new ObjectsInteriorDistribution(*this); 710 default: // no valid strategy 711 return NULL; 712 } 713 // should never come here 714 return NULL; 715 } 716 717 718 }
Note: See TracChangeset
for help on using the changeset viewer.