- Timestamp:
- 07/26/06 16:02:21 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj
r1002 r1159 109 109 LinkIncremental="1" 110 110 SuppressStartupBanner="TRUE" 111 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\..\GtpVisibility\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)"; ..\..\..\..\..\..\..\NonGTP\Zlib\lib;"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;"$(QTDIR)\lib";..\..\..\Preprocessing\src\GL;"$(CG_LIB_PATH)""111 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\..\GtpVisibility\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;"$(QTDIR)\lib";..\..\..\Preprocessing\src\GL;"$(CG_LIB_PATH)";..\..\..\..\..\..\..\NonGTP\Zlib\lib" 112 112 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 113 113 GenerateDebugInformation="TRUE" -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1149 r1159 1494 1494 "0"); 1495 1495 1496 RegisterOption("ViewCells.storeKdPvs", 1497 optBool, 1498 "view_cells_store_kd_pvs=", 1499 "false"); 1500 1496 1501 1497 1502 /************************************************************************************/ -
GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp
r1154 r1159 1 //#include <QApplication>2 1 #include "PreprocessorThread.h" 3 2 -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
r1112 r1159 82 82 VssRay vssRay(ray); 83 83 84 mViewCellsManager->ComputeSampleContribution s(vssRay, true, false);84 mViewCellsManager->ComputeSampleContribution(vssRay, true, false); 85 85 86 86 return vssRay.mPvsContribution; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1155 r1159 20 20 #include "KdIntersectable.h" 21 21 22 // should not count origin object for sampling because it disturbs heuristics 23 #define COUNT_ORIGIN_OBJECTS 0 22 24 23 25 namespace GtpVisibilityPreprocessor { … … 103 105 Environment::GetSingleton()->GetBoolValue("ViewCells.exportPvs", mExportPvs); 104 106 107 Environment::GetSingleton()->GetBoolValue("ViewCells.storeKdPvs", mStoreKdPvs); 108 105 109 106 110 char buf[100]; … … 217 221 Debug << "export pvs for view cells: " << mExportPvs << endl; 218 222 219 223 Debug << "store kd pvs: " << mStoreKdPvs << endl; 224 220 225 Debug << endl; 221 226 } … … 1376 1381 for (it = rays.begin(); it != it_end; ++ it) 1377 1382 { 1378 sum += ComputeSampleContribution s(*(*it), addRays, storeViewCells);1383 sum += ComputeSampleContribution(*(*it), addRays, storeViewCells); 1379 1384 } 1380 1385 … … 1842 1847 1843 1848 1844 float ViewCellsManager::ComputeSampleContribution s(VssRay &ray,1845 1846 1849 float ViewCellsManager::ComputeSampleContribution(VssRay &ray, 1850 const bool addRays, 1851 const bool storeViewCells) 1847 1852 { 1848 1853 ViewCellContainer viewcells; … … 1893 1898 // made in one direction!!! 1894 1899 // the other contributions of this sample will be counted for the oposite ray! 1895 #if 01900 #if COUNT_ORIGIN_OBJECTS 1896 1901 if (ray.mOriginObject && 1897 1902 viewcell->GetPvs().GetSampleContribution(ray.mOriginObject, … … 1917 1922 // if ray not outside of view space 1918 1923 1919 // add kd cell1924 // add new object to the pvs 1920 1925 if (ray.mTerminationObject) 1921 1926 { 1922 if (!mStoreKdPvs) 1923 { 1924 viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 1925 } 1926 else 1927 { 1928 // todo 1929 //viewcell->GetPvs().AddSample(ray.mTerminationNode, ray.mPdf); 1930 } 1931 } 1932 1933 #if 0 1927 viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 1928 } 1929 #if COUNT_ORIGIN_OBJECTS 1934 1930 if (ray.mOriginObject) 1931 { 1935 1932 viewcell->GetPvs().AddSample(ray.mOriginObject, ray.mPdf); 1933 } 1936 1934 #endif 1937 1935 } … … 5714 5712 5715 5713 5714 float VspOspViewCellsManager::ComputeSampleContribution(VssRay &ray, 5715 const bool addRays, 5716 const bool storeViewCells) 5717 { 5718 ViewCellContainer viewcells; 5719 5720 ray.mPvsContribution = 0; 5721 ray.mRelativePvsContribution = 0.0f; 5722 5723 static Ray hray; 5724 hray.Init(ray); 5725 //hray.mFlags |= Ray::CULL_BACKFACES; 5726 //Ray hray(ray); 5727 5728 float tmin = 0, tmax = 1.0; 5729 5730 if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 5731 return 0; 5732 5733 Vector3 origin = hray.Extrap(tmin); 5734 Vector3 termination = hray.Extrap(tmax); 5735 5736 // traverse the view space subdivision 5737 CastLineSegment(origin, termination, viewcells); 5738 5739 if (storeViewCells) 5740 { // copy viewcells memory efficiently 5741 ray.mViewCells.reserve(viewcells.size()); 5742 ray.mViewCells = viewcells; 5743 } 5744 5745 ViewCellContainer::const_iterator it = viewcells.begin(); 5746 5747 for (; it != viewcells.end(); ++ it) 5748 { 5749 ViewCell *viewcell = *it; 5750 5751 if (viewcell->GetValid()) 5752 { 5753 // if ray not outside of view space 5754 float contribution; 5755 5756 if (ray.mTerminationObject) 5757 { 5758 if (viewcell->GetPvs().GetSampleContribution(ray.mTerminationObject, 5759 ray.mPdf, contribution)) 5760 { 5761 ++ ray.mPvsContribution; 5762 } 5763 5764 ray.mRelativePvsContribution += contribution; 5765 } 5766 5767 // for directional sampling it is important to count only contributions 5768 // made in one direction!!! 5769 // the other contributions of this sample will be counted for the oposite ray! 5770 #if COUNT_ORIGIN_OBJECTS 5771 if (ray.mOriginObject && 5772 viewcell->GetPvs().GetSampleContribution(ray.mOriginObject, 5773 ray.mPdf, 5774 contribution)) 5775 { 5776 ++ ray.mPvsContribution; 5777 ray.mRelativePvsContribution += contribution; 5778 } 5779 #endif 5780 } 5781 } 5782 5783 // if addrays is true, sampled entities are stored in the pvs 5784 if (addRays) 5785 { 5786 for (it = viewcells.begin(); it != viewcells.end(); ++ it) 5787 { 5788 ViewCell *viewcell = *it; 5789 5790 if (viewcell->GetValid()) 5791 { 5792 // if ray not outside of view space 5793 5794 // add kd cell 5795 if (ray.mTerminationObject) 5796 { 5797 if (!mStoreKdPvs) 5798 { 5799 viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 5800 } 5801 else 5802 { 5803 /// get current leaf the point 5804 KdLeaf *leaf = mOspTree->GetLeaf(ray.mTermination); 5805 5806 KdIntersectable *entry = mOspTree->GetOrCreateKdIntersectable(leaf); 5807 5808 viewcell->GetPvs().AddSample(entry, ray.mPdf); 5809 } 5810 } 5811 5812 #if COUNT_ORIGIN_OBJECTS 5813 if (ray.mOriginObject) 5814 viewcell->GetPvs().AddSample(ray.mOriginObject, ray.mPdf); 5815 #endif 5816 } 5817 } 5818 } 5819 5820 return ray.mRelativePvsContribution; 5821 } 5822 5823 5716 5824 void VspOspViewCellsManager::PrepareLoadedViewCells() 5717 5825 { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1155 r1159 116 116 @returns number of sample contributions 117 117 */ 118 virtual float ComputeSampleContribution s(VssRay &ray,119 120 118 virtual float ComputeSampleContribution(VssRay &ray, 119 const bool addRays, 120 const bool storeViewCells); 121 121 122 122 virtual void AddSampleContributions(VssRay &ray); … … 1012 1012 void Finalize(ViewCell *viewCell, const bool createMesh); 1013 1013 1014 /** Stores sample contribution for kd cells or objects. 1015 */ 1016 virtual float ComputeSampleContribution(VssRay &ray, 1017 const bool addRays, 1018 const bool storeViewCells); 1014 1019 1015 1020 protected: 1016 1017 1021 1018 1022 /** Exports view cell geometry. -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h
r1149 r1159 1390 1390 int ComputePvsSize(const ObjectContainer &objects) const; 1391 1391 1392 KdLeaf *GetLeaf(const Vector3 &pt, KdNode *node) const; 1392 /** Returns kd leaf the point pt lies in, starting from root. 1393 */ 1394 KdLeaf *GetLeaf(const Vector3 &pt, KdNode *root = NULL) const; 1393 1395 1394 1396
Note: See TracChangeset
for help on using the changeset viewer.