Changeset 1789 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 11/25/06 00:19:18 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1787 r1789 1956 1956 } 1957 1957 1958 1958 /* 1959 1959 void 1960 1960 ViewCellsManager::AddSampleContributions(const VssRayContainer &rays) … … 1964 1964 1965 1965 VssRayContainer::const_iterator it, it_end = rays.end(); 1966 1966 cout <<"here60"<<endl; 1967 1967 for (it = rays.begin(); it != it_end; ++ it) { 1968 1968 AddSampleContributions(*(*it)); 1969 1969 } 1970 1970 } 1971 1971 */ 1972 1972 1973 1973 int ViewCellsManager::GetMinPvsSize() const … … 1983 1983 } 1984 1984 1985 1985 /* 1986 1986 void 1987 1987 ViewCellsManager::AddSampleContributions(VssRay &ray) 1988 { 1988 {cout << "here12" << endl; 1989 1989 // assumes viewcells have been stored... 1990 1990 ViewCellContainer *viewcells = &ray.mViewCells; … … 2008 2008 } 2009 2009 } 2010 2010 */ 2011 2011 2012 2012 float ViewCellsManager::ComputeSampleContribution(VssRay &ray, 2013 2013 const bool addRays, 2014 2014 const bool storeViewCells) 2015 { 2015 {cout << "$$$$$$$$$$$$$4here10" << endl; 2016 2016 ViewCellContainer viewcells; 2017 2017 … … 3470 3470 if (sortViewCells) 3471 3471 { // sort view cells to visualize the largest view cells 3472 s table_sort(mViewCells.begin(), mViewCells.end(), ViewCell::LargerRenderCost);3472 sort(mViewCells.begin(), mViewCells.end(), ViewCell::LargerRenderCost); 3473 3473 } 3474 3474 … … 4824 4824 { 4825 4825 // sort view cells to visualize the largest view cells 4826 s table_sort(mViewCells.begin(), mViewCells.end(), ViewCell::LargerRenderCost);4826 sort(mViewCells.begin(), mViewCells.end(), ViewCell::LargerRenderCost); 4827 4827 } 4828 4828 … … 5278 5278 5279 5279 5280 VspOspViewCellsManager::VspOspViewCellsManager(ViewCellsTree *vcTree, const string &hierarchyType) 5280 VspOspViewCellsManager::VspOspViewCellsManager(ViewCellsTree *vcTree, 5281 const string &hierarchyType) 5281 5282 : ViewCellsManager(vcTree) 5282 5283 { … … 5297 5298 mHierarchyManager->SetViewCellsTree(mViewCellsTree); 5298 5299 } 5300 5299 5301 5300 5302 Intersectable * … … 5307 5309 #endif 5308 5310 } 5311 5309 5312 5310 5313 HierarchyManager *VspOspViewCellsManager::CreateHierarchyManager(const string &hierarchyType) … … 5675 5678 Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 5676 5679 5677 Vector3 scale(0.9f, 0.9f, 0.9f); 5680 //Vector3 scale(0.9f, 0.9f, 0.9f); 5681 Vector3 scale(1.0f, 1.0f, 1.0f); 5682 5678 5683 if (exporter) 5679 5684 { … … 5773 5778 { 5774 5779 // sort view cells to visualize the view cells with highest render cost 5775 s table_sort(mViewCells.begin(), mViewCells.end(), ViewCell::LargerRenderCost);5780 sort(mViewCells.begin(), mViewCells.end(), ViewCell::LargerRenderCost); 5776 5781 } 5777 5782 … … 6055 6060 float tmin = 0, tmax = 1.0; 6056 6061 6057 6058 6062 if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 6059 6063 return 0; … … 6069 6073 if (storeViewCells) 6070 6074 { 6071 6072 6073 6075 // copy viewcells memory efficiently 6076 ray.mViewCells.reserve(viewcells.size()); 6077 ray.mViewCells = viewcells; 6074 6078 } 6075 6079 … … 6078 6082 Intersectable *terminationObj = GetIntersectable(ray, true); 6079 6083 Intersectable *originObj = GetIntersectable(ray, false); 6080 6081 for (; it != viewcells.end(); ++ it) { 6082 ViewCell *viewcell = *it; 6083 6084 if (viewcell->GetValid()) 6084 6085 for (; it != viewcells.end(); ++ it) 6086 { 6087 ViewCell *viewcell = *it; 6088 6089 if (viewcell->GetValid()) 6085 6090 { // if ray not outside of view space 6086 6087 6088 6091 float contribution; 6092 6093 if (terminationObj) 6089 6094 { 6090 6091 6092 6095 // todo: maybe not correct for kd node pvs 6096 /* if (viewcell->GetPvs().GetSampleContribution( 6097 terminationObj, ray.mPdf, contribution)) 6093 6098 { 6094 6099 ++ ray.mPvsContribution; 6095 6100 } 6096 6097 ray.mRelativePvsContribution += contribution; 6101 ray.mRelativePvsContribution += contribution;*/ 6098 6102 } 6099 6100 6101 6102 6103 6104 6103 6104 //////////////// 6105 //-- for directional sampling it is important to count 6106 //-- only contributions made in one direction! 6107 //-- the other contributions of this sample will be counted for the opposite ray! 6108 6105 6109 #if SAMPLE_ORIGIN_OBJECTS 6106 6107 6108 6109 6110 6110 6111 /* if (originObj && 6112 viewcell->GetPvs().GetSampleContribution(originObj, 6113 ray.mPdf, 6114 contribution)) 6111 6115 { 6112 6113 6114 } 6116 ++ ray.mPvsContribution; 6117 ray.mRelativePvsContribution += contribution; 6118 }*/ 6115 6119 #endif 6116 6120 } 6117 6121 } 6118 6122 6119 6123 if (!addRays) 6120 6124 { … … 6131 6135 6132 6136 //$$JB hack 6133 viewCell->GetPvs().AddSample(terminationObj, ray.mPdf); 6134 6137 float contrib; 6138 //viewCell->GetPvs().AddSampleDirtyCheck(terminationObj, ray.mPdf, contrib); 6139 viewCell->GetPvs().AddSample(terminationObj, ray.mPdf);//, contrib); 6140 6141 if (viewCell->GetPvs().GetSize() == 50) 6142 //if (viewCell->GetPvs().RequiresResort()) 6143 {Intersectable::NewMail(); 6144 cout << "\nbefore sort: " << viewCell->GetPvs().GetLastSorted() << " \n"; 6145 ObjectPvsIterator pit = viewCell->GetPvs().GetIterator(); int i = 0; 6146 while (pit.HasMoreEntries()) 6147 { 6148 ObjectPvsEntry entry = pit.Next(); 6149 Intersectable *object = entry.mObject; 6150 6151 if ((i ++) == viewCell->GetPvs().GetLastSorted()) 6152 cout << "| "; 6153 6154 //if (object->Mailed()) cout << "error!!"<<endl; 6155 object->Mail(); 6156 cout << (int)object << " "; 6157 } 6158 6159 //viewCell->GetPvs().Sort(); 6160 6161 /*cout << "\nafter sort\n"; 6162 pit = viewCell->GetPvs().GetIterator(); i = 0; 6163 while (pit.HasMoreEntries()) 6164 { 6165 ObjectPvsEntry entry = pit.Next(); 6166 Intersectable *object = entry.mObject; 6167 6168 if ((i ++) == viewCell->GetPvs().GetLastSorted()) 6169 cout << "| "; 6170 cout << (int)object << " "; 6171 }*/ 6172 } 6173 //else cout << "b"; 6135 6174 #if SAMPLE_ORIGIN_OBJECTS 6136 viewCell->GetPvs().AddSample(originObj, ray.mPdf);6137 #endif 6138 } 6139 6175 //viewCell->GetPvs().AddSample(originObj, ray.mPdf); 6176 #endif 6177 } 6178 6140 6179 return ABS_CONTRIBUTION_WEIGHT*ray.mPvsContribution + 6141 6180 (1.0f - ABS_CONTRIBUTION_WEIGHT)*ray.mRelativePvsContribution; 6142 6181 } 6143 6182
Note: See TracChangeset
for help on using the changeset viewer.