Changeset 1020 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 06/18/06 03:47:06 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1006 r1020 8 8 #include "ViewCellBsp.h" 9 9 #include "KdTree.h" 10 //#include "VspOspTree.h"10 #include "VspOspTree.h" 11 11 #include "Exporter.h" 12 12 #include "VspBspTree.h" … … 104 104 105 105 106 // sampling type for view cells construction samples 106 107 if (strcmp(buf, "box") == 0) 107 108 { … … 112 113 mSamplingType = Preprocessor::DIRECTION_BASED_DISTRIBUTION; 113 114 } 114 else 115 else if (strcmp(buf, "interior") == 0) 116 { 117 mSamplingType = Preprocessor::OBJECTS_INTERIOR_DISTRIBUTION; 118 } 119 else if (strcmp(buf, "object_directional") == 0) 120 { 121 mSamplingType = Preprocessor::OBJECT_DIRECTION_BASED_DISTRIBUTION; 122 } 123 else 115 124 { 116 125 Debug << "error! wrong sampling type" << endl; … … 118 127 } 119 128 129 // sampling type for evaluation samples 120 130 Environment::GetSingleton()->GetStringValue("ViewCells.Evaluation.samplingType", buf); 121 131 … … 128 138 mEvaluationSamplingType = Preprocessor::DIRECTION_BASED_DISTRIBUTION; 129 139 } 130 else 140 else if (strcmp(buf, "object_directional") == 0) 141 { 142 mEvaluationSamplingType = Preprocessor::OBJECT_DIRECTION_BASED_DISTRIBUTION; 143 } 144 else if (strcmp(buf, "interior") == 0) 145 { 146 mEvaluationSamplingType = Preprocessor::OBJECTS_INTERIOR_DISTRIBUTION; 147 } 148 else 131 149 { 132 150 Debug << "error! wrong sampling type" << endl; … … 201 219 ViewCellsManager::~ViewCellsManager() 202 220 { 203 //DEL_PTR(mRenderer); 204 221 // HACK: if view cells tree does not 222 // take care of view cells, we have to do it 223 // question: rather create view cells resource manager? 205 224 if (!ViewCellsTreeConstructed()) 206 225 CLEAR_CONTAINER(mViewCells); 207 //else226 208 227 DEL_PTR(mViewCellsTree); 209 228 } … … 855 874 Debug << "view cell stats prefix: " << statsPrefix << endl; 856 875 857 858 876 // should directional sampling be used? 859 877 bool dirSamples = (mEvaluationSamplingType == Preprocessor::DIRECTION_BASED_DISTRIBUTION); 860 861 878 862 879 cout << "reseting pvs ... "; … … 1366 1383 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 1367 1384 1368 1369 1385 //-- compute expected value 1370 1371 1386 totalRenderCost = 0; 1372 1387 totalPvs = 0; … … 2480 2495 if (1) // export final view cells 2481 2496 { 2482 mColorCode = 1; 2483 2497 mColorCode = 1; // hack color code 2484 2498 Exporter *exporter = Exporter::GetExporter("final_view_cells.x3d"); 2485 2499 … … 2494 2508 2495 2509 //exporter->SetFilled(); 2496 bool b = mUseClipPlaneForViz;2510 const bool b = mUseClipPlaneForViz; 2497 2511 mUseClipPlaneForViz = false; 2512 2498 2513 ExportViewCellsForViz(exporter); 2514 2499 2515 mUseClipPlaneForViz = b; 2500 2516 delete exporter; … … 3101 3117 } 3102 3118 3119 3103 3120 int KdViewCellsManager::PostProcess(const ObjectContainer &objects, 3104 3121 const VssRayContainer &rays) … … 3106 3123 return 0; 3107 3124 } 3125 3108 3126 3109 3127 void KdViewCellsManager::Visualize(const ObjectContainer &objects, … … 3956 3974 mColorCode = 1; 3957 3975 3958 Exporter *exporter = Exporter::GetExporter("final_view_cells. x3d");3976 Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 3959 3977 3960 3978 if (exporter) … … 3976 3994 3977 3995 // export rays 3978 if ( mExportRays)3996 if (1 && mExportRays) 3979 3997 { 3980 3998 exporter->ExportRays(visRays, RgbColor(0, 1, 0)); … … 3982 4000 3983 4001 //exporter->SetFilled(); 4002 3984 4003 // HACK: export without clip plane 3985 4004 const bool b = mUseClipPlaneForViz; 3986 4005 mUseClipPlaneForViz = false; 4006 3987 4007 ExportViewCellsForViz(exporter); 4008 3988 4009 mUseClipPlaneForViz = b; 3989 3990 4010 delete exporter; 4011 3991 4012 cout << "finished" << endl; 3992 4013 } … … 4107 4128 const VssRayContainer &rays) 4108 4129 { 4109 const int leafOut = 20; 4130 int leafOut; 4131 Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.maxOutput", leafOut); 4110 4132 4111 4133 ViewCell::NewMail(); … … 4116 4138 4117 4139 const bool sortViewCells = true; 4118 4119 4120 4140 // sort view cells to visualize the largest view cells 4121 4141 if (sortViewCells) … … 4145 4165 4146 4166 //bspLeaves[j]->Mail(); 4147 char s[64]; sprintf(s, "bsp-pvs%04d. x3d", i);4167 char s[64]; sprintf(s, "bsp-pvs%04d.wrl", i); 4148 4168 Exporter *exporter = Exporter::GetExporter(s); 4149 4169 … … 4151 4171 4152 4172 //-- export the sample rays 4153 if ( 1 ||mExportRays)4173 if (mExportRays) 4154 4174 { 4155 4175 // output rays stored with the view cells during subdivision … … 4219 4239 4220 4240 4241 //-- export view cell geometry 4221 4242 exporter->SetWireframe(); 4222 4243 … … 4228 4249 4229 4250 exporter->SetFilled(); 4251 4230 4252 4231 4253 //-- export pvs … … 4314 4336 case 1: // pvs 4315 4337 { 4316 importance = (float)mViewCellsTree->GetPvsSize(vc) / (float)mCurrentViewCellsStats.maxPvs; 4338 if (mCurrentViewCellsStats.maxPvs) 4339 importance = (float)mViewCellsTree->GetPvsSize(vc) / (float)mCurrentViewCellsStats.maxPvs; 4317 4340 } 4318 4341 break; … … 4469 4492 if (i != j) 4470 4493 { 4471 4472 4494 BspLeaf *leaf2 =dynamic_cast<BspViewCell *>(leaves[j])->mLeaf; 4473 4495
Note: See TracChangeset
for help on using the changeset viewer.