Changeset 1415 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 09/18/06 18:57:34 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1414 r1415 1946 1946 } 1947 1947 1948 1948 // matt: todo 1949 1949 void ViewCellsManager::ExportViewCellsForViz(Exporter *exporter) const 1950 1950 { … … 2640 2640 mViewCellsTree->SetRoot(root); 2641 2641 2642 // compute pvs2642 // recompute pvs in the whole hierarchy 2643 2643 ObjectPvs pvs; 2644 2644 UpdatePvsForEvaluation(root, pvs); 2645 2645 } 2646 2647 cout << "finished" << endl; 2648 cout << "merged view cells in " 2649 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 2650 2651 Debug << "Postprocessing: Merged view cells in " 2652 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl << endl; 2653 2654 2655 ///////////////////////////////////////// 2656 //-- visualization and statistics 2646 2657 2647 2658 // export statistics after merge … … 2653 2664 } 2654 2665 2655 //-- stats and visualizations 2656 cout << "finished" << endl; 2657 cout << "merged view cells in " 2658 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 2659 2660 Debug << "Postprocessing: Merged view cells in " 2661 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl << endl; 2662 2663 2664 //-- visualization and statistics 2665 // reset view cells and stats 2666 ResetViewCells(); 2666 ResetViewCells(); // reset view cells 2667 2667 Debug << "\nView cells after merge:\n" << mCurrentViewCellsStats << endl; 2668 2668 … … 2763 2763 { 2764 2764 mColorCode = 1; // hack color code 2765 Exporter *exporter = Exporter::GetExporter("final_view_cells. x3d");2765 Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 2766 2766 2767 2767 cout << "exporting view cells after merge (pvs size) ... "; … … 3815 3815 SimulationStatistics ss; 3816 3816 dynamic_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss); 3817 Debug << "render time before refine\n " << ss << endl;3817 Debug << "render time before refine\n\n" << ss << endl; 3818 3818 3819 3819 const long startTime = GetTime(); … … 3898 3898 //-- render simulation after merge + refine 3899 3899 3900 cout << "\nview cells partition render time before compress" ;3900 cout << "\nview cells partition render time before compress" << endl << endl;; 3901 3901 dynamic_cast<RenderSimulator *>(mRenderer)->RenderScene(); 3902 3902 SimulationStatistics ss; … … 4449 4449 // find view cells associated with the samples 4450 4450 // store the sample pvs with the pvs associated with the view cell 4451 // 4451 4452 // for each view cell: 4452 4453 // compute difference point sampled pvs - view cell pvs … … 4490 4491 m.mDiffuseColor.b = 1.0f; 4491 4492 //exporter->SetForcedMaterial(m); 4492 4493 // ExportViewCellGeometry(exporter, vc, mClipPlane); 4494 4495 /* // counting the pvss 4496 for (rit = samples.begin(); rit != rit_end; ++ rit) 4497 { 4498 RenderCostSample sample = *rit; 4499 4500 ViewCell *vc = GetViewCell(sample.mPosition); 4501 4502 AxisAlignedBox3 box(sample.mPosition - Vector3(1, 1, 1), sample.mPosition + Vector3(1, 1, 1)); 4503 Mesh *hMesh = CreateMeshFromBox(box); 4504 4505 DEL_PTR(hMesh); 4506 4507 */ 4493 //ExportViewCellGeometry(exporter, vc, mClipPlane); 4494 4495 /* // counting the pvss 4496 for (rit = samples.begin(); rit != rit_end; ++ rit) 4497 { 4498 RenderCostSample sample = *rit; 4499 ViewCell *vc = GetViewCell(sample.mPosition); 4500 4501 AxisAlignedBox3 box(sample.mPosition - Vector3(1, 1, 1), sample.mPosition + Vector3(1, 1, 1)); 4502 Mesh *hMesh = CreateMeshFromBox(box); 4503 4504 DEL_PTR(hMesh); 4505 } 4506 */ 4508 4507 } 4509 4508 } … … 4801 4800 4802 4801 // print subdivision statistics 4802 Debug << endl << endl; 4803 4803 mHierarchyManager->PrintHierarchyStatistics(Debug); 4804 4804 … … 4815 4815 4816 4816 const long startTime = GetTime(); 4817 4818 4817 cout << "Computing remaining ray contributions ... "; 4819 4818 … … 4822 4821 ComputeSampleContributions(savedRays, true, false); 4823 4822 4824 cout << "finished" << endl; 4825 4826 Debug << "Computed remaining ray contribution in " << TimeDiff(startTime, GetTime()) * 1e-3 4823 Debug << "finished computing remaining ray contribution in " << TimeDiff(startTime, GetTime()) * 1e-3 4827 4824 << " secs" << endl; 4828 4825 4829 cout << "construction finished" << endl;4830 4831 // real meshes are contructed at this stage4832 4826 if (0) 4833 4827 { 4828 // real meshes are constructed at this stage 4834 4829 cout << "finalizing view cells ... "; 4835 4830 FinalizeViewCells(true); … … 4908 4903 //-- render simulation after merge + refine 4909 4904 4910 cout << "\nview cells partition render time before compress" ;4905 cout << "\nview cells partition render time before compress" << endl << endl; 4911 4906 dynamic_cast<RenderSimulator *>(mRenderer)->RenderScene(); 4912 4907 SimulationStatistics ss; … … 5028 5023 5029 5024 if (clipPlane) 5025 { 5030 5026 plane = clipPlane->GetPlane(); 5027 } 5028 5029 AxisAlignedBox3 bbox = GetViewSpaceBox(); 5030 bbox.Scale(Vector3(0.5, 1, 0.5)); 5031 5031 5032 5032 for (it = leaves.begin(); it != it_end; ++ it) … … 5037 5037 const AxisAlignedBox3 box = mHierarchyManager->GetVspTree()->GetBoundingBox(vspVc->mLeaf); 5038 5038 5039 if (!Overlap(box, bbox)) 5040 continue; 5041 5039 5042 if (clipPlane) 5040 5043 { … … 5081 5084 if (1) 5082 5085 { 5086 ///////////////////////////// 5083 5087 //-- export final view cells 5084 5088 5085 // hack pvs5089 // hack color code (show pvs size) 5086 5090 const int savedColorCode = mColorCode; 5087 5091 mColorCode = 0; … … 5091 5095 if (exporter) 5092 5096 { 5093 cout << "exporting view cells after post process ... "; 5097 const long starttime = GetTime(); 5098 cout << "exporting final view cells (after initial construction + post process) ... "; 5094 5099 5095 5100 if (mExportGeometry) … … 5113 5118 delete exporter; 5114 5119 5115 cout << "finished " << endl;5120 cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 5116 5121 } 5117 5122 … … 5126 5131 if (exporter) 5127 5132 { 5133 const long starttime = GetTime(); 5134 5128 5135 cout << "exporting object space hierarchy ... "; 5129 5136 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects); 5130 5137 5131 5138 delete exporter; 5132 cout << "finished " << endl;5139 cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 5133 5140 } 5134 5141 } … … 5153 5160 const bool sortViewCells = true; 5154 5161 5155 // sort view cells to visualize the largest view cells5156 5162 if (sortViewCells) 5157 5163 { 5158 5164 //stable_sort(mViewCells.begin(), mViewCells.end(), ViewCell::SmallerPvs); 5165 // sort view cells to visualize the view cells with highest render cost 5159 5166 stable_sort(mViewCells.begin(), mViewCells.end(), ViewCell::LargerRenderCost); 5160 5167 } 5161 5168 5162 5169 int limit = min(leafOut, (int)mViewCells.size()); 5163 5164 5170 int raysOut = 0; 5165 5171 5166 5172 /////////////////////////// 5167 5173 //-- some rays for output 5168 5174 … … 5249 5255 } 5250 5256 5251 // --export rays piercing this view cell5257 // export rays piercing this view cell 5252 5258 exporter->ExportRays(vcRays, RgbColor(1, 1, 0)); 5253 5259 } 5254 5260 } 5255 5261 5262 5263 ///////////////// 5256 5264 //-- export view cell geometry 5257 5265 … … 5267 5275 5268 5276 #if 0 5277 ////////// 5269 5278 //-- export pvs 5270 5279 … … 5336 5345 return false; 5337 5346 5347 const long starttime = GetTime(); 5338 5348 cout << "exporting view cells to xml ... "; 5339 5349 … … 5349 5359 ////////////////////////////////////////////////////////////// 5350 5360 //-- export bounding boxes 5361 //-- The bounding boxes are used to identify 5362 //-- the objects in the rendering engine 5351 5363 5352 5364 stream << "<BoundingBoxes>" << endl; … … 5356 5368 { 5357 5369 const AxisAlignedBox3 box = (*oit)->GetBox(); 5358 5359 //-- the bounding boxes5360 5370 stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\"" 5361 5371 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 5362 5372 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 5363 5373 } 5364 5365 5374 stream << "</BoundingBoxes>" << endl; 5366 5375 5367 //////////////////////////////////////////////////////////////// 5376 5377 ////////////////////////// 5368 5378 //-- export the view cells and the pvs 5369 5379 … … 5374 5384 stream << "</ViewCells>" << endl; 5375 5385 5376 5386 ////////////////////// 5377 5387 //-- export the view space hierarchy 5378 5388 … … 5384 5394 stream << "</ViewSpaceHierarchy>" << endl; 5385 5395 5386 5396 ////////////////////// 5387 5397 //-- export the object space partition 5388 5398 … … 5392 5402 stream.close(); 5393 5403 5394 cout << "finished" << endl; 5395 5404 cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3 << " secs" << endl; 5396 5405 return true; 5397 5406 }
Note: See TracChangeset
for help on using the changeset viewer.