Changeset 1785 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 11/23/06 21:38:45 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1784 r1785 26 26 27 27 28 #define ABS_CONTRIBUTION_WEIGHT 1.0f29 28 30 29 // warning: Should not count origin object for sampling … … 33 32 34 33 // $$JB HACK 35 #define USE_KD_PVS 034 #define USE_KD_PVS 1 36 35 #define KD_PVS_AREA (1e-5f) 37 36 … … 1826 1825 1827 1826 stat.avgPvs += pvsCost; 1828 1829 const bool evaluateFilter = true; 1827 1828 bool evaluateFilter; 1829 Environment::GetSingleton()->GetBoolValue("Preprocessor.evaluateFilter", evaluateFilter); 1830 1830 1831 1831 1832 if (evaluateFilter) { 1832 1833 ObjectPvs filteredPvs = viewcell->GetPvs(); 1833 PvsFilterStatistics fstat = ApplyFilter2(viewcell, false, 1.0f, filteredPvs); 1834 PvsFilterStatistics fstat = ApplyFilter2(viewcell, false, 1835 1.0f, filteredPvs); 1834 1836 1835 1837 float filteredCost = filteredPvs.EvalPvsCost(); … … 2032 2034 ViewCell::NewMail(); 2033 2035 2036 // if (ray.mPdf!=1.0f) 2037 // cout<<ray.mPdf<<" "; 2038 2039 2034 2040 // traverse the view space subdivision 2035 2041 CastLineSegment(origin, termination, viewcells); … … 5852 5858 //Ray hray(ray); 5853 5859 5860 // if (ray.mPdf!=1.0f) 5861 // cout<<ray.mPdf<<" "; 5862 5854 5863 float tmin = 0, tmax = 1.0; 5855 5864 5865 5856 5866 if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 5857 5867 return 0; … … 5867 5877 if (storeViewCells) 5868 5878 { 5869 5870 5871 5879 // copy viewcells memory efficiently 5880 ray.mViewCells.reserve(viewcells.size()); 5881 ray.mViewCells = viewcells; 5872 5882 } 5873 5883 … … 5877 5887 Intersectable *originObj = GetIntersectable(ray, false); 5878 5888 5879 for (; it != viewcells.end(); ++ it) 5880 { 5881 ViewCell *viewcell = *it; 5882 5883 if (viewcell->GetValid()) 5889 for (; it != viewcells.end(); ++ it) { 5890 ViewCell *viewcell = *it; 5891 5892 if (viewcell->GetValid()) 5884 5893 { // if ray not outside of view space 5885 5886 5887 5894 float contribution; 5895 5896 if (terminationObj) 5888 5897 { 5889 5890 5891 terminationObj, ray.mPdf, contribution))5898 // todo: maybe not correct for kd node pvs 5899 if (viewcell->GetPvs().GetSampleContribution( 5900 terminationObj, ray.mPdf, contribution)) 5892 5901 { 5893 5902 ++ ray.mPvsContribution; 5894 5903 } 5895 5896 5904 5905 ray.mRelativePvsContribution += contribution; 5897 5906 } 5898 5907 5899 5900 5901 5902 5903 5908 //////////////// 5909 //-- for directional sampling it is important to count 5910 //-- only contributions made in one direction! 5911 //-- the other contributions of this sample will be counted for the opposite ray! 5912 5904 5913 #if SAMPLE_ORIGIN_OBJECTS 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 if (originObj && 5916 viewcell->GetPvs().GetSampleContribution(originObj, 5917 ray.mPdf, 5918 contribution)) 5919 { 5920 ++ ray.mPvsContribution; 5921 ray.mRelativePvsContribution += contribution; 5922 } 5914 5923 #endif 5915 5924 } 5916 5925 } 5917 5926 5918 5927 if (!addRays) 5919 5928 {
Note: See TracChangeset
for help on using the changeset viewer.