Changeset 2100
- Timestamp:
- 02/07/07 17:43:56 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/GtpVisibility.sln
r1949 r2100 10 10 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IVReader", "OnlineCullingCHC\IVReader\src\IVReader.vcproj", "{7319E499-473D-4CE5-9983-725D6E68A55D}" 11 11 ProjectSection(ProjectDependencies) = postProject 12 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436}13 12 EndProjectSection 14 13 EndProject -
GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj
r1926 r2100 73 73 Name="VCCLCompilerTool" 74 74 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\Samples\Common\include";..\include" 75 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE "75 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE" 76 76 RuntimeLibrary="2" 77 77 UsePrecompiledHeader="0" … … 225 225 <Tool 226 226 Name="VCCLCompilerTool" 227 Optimization="3" 228 GlobalOptimizations="TRUE" 229 InlineFunctionExpansion="2" 230 EnableIntrinsicFunctions="TRUE" 231 FavorSizeOrSpeed="1" 232 OmitFramePointers="TRUE" 233 EnableFiberSafeOptimizations="TRUE" 234 OptimizeForProcessor="3" 235 OptimizeForWindowsApplication="TRUE" 227 236 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\Samples\Common\include";..\include" 228 237 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 229 RuntimeLibrary="2" 230 UsePrecompiledHeader="0" 231 WarningLevel="3" 232 Detect64BitPortabilityProblems="TRUE" 233 DebugInformationFormat="3"/> 234 <Tool 235 Name="VCCustomBuildTool"/> 236 <Tool 237 Name="VCLinkerTool" 238 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib" 239 OutputFile="$(OutDir)/IVReader.dll" 240 LinkIncremental="1" 241 AdditionalLibraryDirectories=""$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\..\GtpVisibility\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)"" 238 StringPooling="TRUE" 239 RuntimeLibrary="2" 240 UsePrecompiledHeader="0" 241 WarningLevel="3" 242 Detect64BitPortabilityProblems="TRUE" 243 DebugInformationFormat="3"/> 244 <Tool 245 Name="VCCustomBuildTool"/> 246 <Tool 247 Name="VCLinkerTool" 248 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib" 249 OutputFile="$(OutDir)/IVReader.dll" 250 LinkIncremental="1" 251 AdditionalLibraryDirectories=""$(OGRE_PATH)\OgreMain\lib\Release";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";..\..\GtpVisibility\lib\Release;..\..\lib\Release;..\lib\Release;"$(OGRE_PATH)\Dependencies\lib\Release"" 242 252 GenerateDebugInformation="TRUE" 243 253 SubSystem="2" 244 254 OptimizeReferences="2" 245 255 EnableCOMDATFolding="2" 246 ImportLibrary="$(OutDir)/IVReader.lib" 247 TargetMachine="1"/> 248 <Tool 249 Name="VCMIDLTool"/> 250 <Tool 251 Name="VCPostBuildEventTool" 252 CommandLine="copy $(OutDir)\$(TargetFileName) "$(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)""/> 256 OptimizeForWindows98="1" 257 ImportLibrary="$(OutDir)/IVReader.lib" 258 TargetMachine="1"/> 259 <Tool 260 Name="VCMIDLTool"/> 261 <Tool 262 Name="VCPostBuildEventTool" 263 CommandLine="copy $(OutDir)\$(TargetFileName) "$(OGRE_PATH)\Samples\Common\bin\Release""/> 253 264 <Tool 254 265 Name="VCPreBuildEventTool"/> -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r2069 r2100 87 87 OmitFramePointers="TRUE" 88 88 EnableFiberSafeOptimizations="TRUE" 89 OptimizeForProcessor=" 0"89 OptimizeForProcessor="3" 90 90 OptimizeForWindowsApplication="TRUE" 91 91 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include;..\..\..\Preprocessing\src\Timer" 92 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE "92 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE;GAMETOOLS_ILLUMINATION_MODULE" 93 93 StringPooling="TRUE" 94 94 RuntimeLibrary="2" … … 280 280 <Configuration 281 281 Name="Release Internal|Win32" 282 OutputDirectory=" $(ConfigurationName)"283 IntermediateDirectory=" $(ConfigurationName)"282 OutputDirectory="Release" 283 IntermediateDirectory="Release" 284 284 ConfigurationType="2" 285 285 CharacterSet="2" … … 295 295 OmitFramePointers="TRUE" 296 296 EnableFiberSafeOptimizations="TRUE" 297 OptimizeForProcessor="2" 298 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src" 299 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GTP_VISIBILITY_MODIFIED_OGRE" 297 OptimizeForProcessor="3" 298 OptimizeForWindowsApplication="TRUE" 299 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\IVReader\include;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include" 300 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GTP_VISIBILITY_MODIFIED_OGRE;PLUGIN_KD_TERRAIN_EXPORTS" 300 301 StringPooling="TRUE" 301 302 RuntimeLibrary="2" 302 303 BufferSecurityCheck="FALSE" 303 304 EnableFunctionLevelLinking="TRUE" 304 RuntimeTypeInfo=" TRUE"305 RuntimeTypeInfo="FALSE" 305 306 UsePrecompiledHeader="0" 306 307 WarningLevel="3" … … 312 313 Name="VCLinkerTool" 313 314 IgnoreImportLibrary="TRUE" 314 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib "315 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib RTScene.lib RTWorld.lib IVReader.lib" 315 316 OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 316 317 Version="0.99" 317 318 LinkIncremental="1" 318 319 SuppressStartupBanner="TRUE" 319 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;..\..\..\Preprocessing\src\GL;"$(CG_LIB_PATH)";..\..\..\..\..\..\..\NonGTP\Zlib\lib"320 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\Release";"$(OGRE_PATH)\OgreMain\lib\Release";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";..\..\GtpVisibility\lib\Release;..\..\lib\Release;..\lib\Release;"$(OGRE_PATH)\Dependencies\lib\Release";..\..\..\Preprocessing\lib\Release;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;"$(CG_LIB_PATH)";..\..\..\..\..\..\..\NonGTP\Zlib\lib" 320 321 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 321 GenerateDebugInformation=" TRUE"322 GenerateDebugInformation="FALSE" 322 323 SubSystem="2" 323 324 OptimizeReferences="2" 324 325 EnableCOMDATFolding="2" 326 OptimizeForWindows98="1" 325 327 ImportLibrary="$(OutDir)/Plugin_VisibilitySceneManager.lib" 326 328 TargetMachine="1"/> … … 329 331 <Tool 330 332 Name="VCPostBuildEventTool" 331 CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\ $(ConfigurationName)"/>333 CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\Release"/> 332 334 <Tool 333 335 Name="VCPreBuildEventTool"/> -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/GtpVisibility.vcproj
r1926 r2100 62 62 <Tool 63 63 Name="VCCLCompilerTool" 64 Optimization="3" 64 65 GlobalOptimizations="TRUE" 66 InlineFunctionExpansion="2" 67 EnableIntrinsicFunctions="TRUE" 65 68 FavorSizeOrSpeed="1" 66 69 OmitFramePointers="TRUE" 67 OptimizeForWindowsApplication="TRUE" 68 AdditionalIncludeDirectories="..\include;"$(OGRE_PATH)\OgreMain\include";..\..\Preprocessing\src" 69 PreprocessorDefinitions="WIN32;NDEBUG;_LIB" 70 RuntimeLibrary="2" 71 RuntimeTypeInfo="TRUE" 70 EnableFiberSafeOptimizations="TRUE" 71 OptimizeForProcessor="3" 72 OptimizeForWindowsApplication="TRUE" 73 AdditionalIncludeDirectories="..\include;"$(OGRE_PATH)\OgreMain\include";..\..\Preprocessing\src" 74 PreprocessorDefinitions="WIN32;NDEBUG;_LIB" 75 StringPooling="TRUE" 76 RuntimeLibrary="2" 77 EnableEnhancedInstructionSet="2" 78 RuntimeTypeInfo="FALSE" 72 79 UsePrecompiledHeader="0" 73 80 WarningLevel="3" … … 188 195 <Tool 189 196 Name="VCCLCompilerTool" 190 OptimizeForWindowsApplication="TRUE" 191 AdditionalIncludeDirectories="..\include;"$(OGRE_PATH)\OgreMain\include";..\..\Preprocessing\src" 192 PreprocessorDefinitions="WIN32;NDEBUG;_LIB" 193 RuntimeLibrary="2" 194 RuntimeTypeInfo="TRUE" 197 Optimization="3" 198 GlobalOptimizations="TRUE" 199 InlineFunctionExpansion="2" 200 EnableIntrinsicFunctions="TRUE" 201 FavorSizeOrSpeed="1" 202 OmitFramePointers="TRUE" 203 EnableFiberSafeOptimizations="TRUE" 204 OptimizeForProcessor="3" 205 OptimizeForWindowsApplication="TRUE" 206 AdditionalIncludeDirectories="..\include;"$(OGRE_PATH)\OgreMain\include";..\..\Preprocessing\src" 207 PreprocessorDefinitions="WIN32;NDEBUG;_LIB" 208 RuntimeLibrary="2" 209 EnableEnhancedInstructionSet="2" 210 RuntimeTypeInfo="FALSE" 195 211 UsePrecompiledHeader="0" 196 212 BrowseInformation="1" -
GTP/trunk/Lib/Vis/Preprocessing/EvalStats/EvalStats.vcproj
r1926 r2100 205 205 <Tool 206 206 Name="VCCLCompilerTool" 207 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 208 RuntimeLibrary="0" 209 UsePrecompiledHeader="3" 210 WarningLevel="3" 211 Detect64BitPortabilityProblems="TRUE" 212 DebugInformationFormat="3"/> 213 <Tool 214 Name="VCCustomBuildTool"/> 215 <Tool 216 Name="VCLinkerTool" 217 OutputFile="$(OutDir)/EvalStats.exe" 218 LinkIncremental="1" 219 GenerateDebugInformation="TRUE" 220 SubSystem="1" 221 OptimizeReferences="2" 222 EnableCOMDATFolding="2" 207 Optimization="3" 208 GlobalOptimizations="TRUE" 209 InlineFunctionExpansion="2" 210 EnableIntrinsicFunctions="TRUE" 211 FavorSizeOrSpeed="1" 212 OmitFramePointers="TRUE" 213 EnableFiberSafeOptimizations="TRUE" 214 OptimizeForProcessor="3" 215 OptimizeForWindowsApplication="TRUE" 216 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 217 RuntimeLibrary="0" 218 UsePrecompiledHeader="3" 219 WarningLevel="3" 220 Detect64BitPortabilityProblems="TRUE" 221 DebugInformationFormat="3"/> 222 <Tool 223 Name="VCCustomBuildTool"/> 224 <Tool 225 Name="VCLinkerTool" 226 OutputFile="$(OutDir)/EvalStats.exe" 227 LinkIncremental="1" 228 GenerateDebugInformation="TRUE" 229 SubSystem="1" 230 OptimizeReferences="2" 231 EnableCOMDATFolding="2" 232 OptimizeForWindows98="1" 223 233 TargetMachine="1"/> 224 234 <Tool -
GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp
r2017 r2100 392 392 // This is important during the subdivision 393 393 394 //MailablePvsData::NewMail();394 //MailablePvsData::NewMail(); 395 395 UpdateViewCellsPvs(front, *frontData.mRays); 396 396 UpdateViewCellsPvs(back, *backData.mRays); -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r2092 r2100 206 206 <Configuration 207 207 Name="Release Internal|Win32" 208 OutputDirectory=" $(ConfigurationName)"209 IntermediateDirectory=" $(ConfigurationName)"208 OutputDirectory="Release" 209 IntermediateDirectory="Release" 210 210 ConfigurationType="4" 211 211 CharacterSet="2"> … … 419 419 </File> 420 420 <File 421 RelativePath=".\DefaultPvs.h"> 422 </File> 423 <File 421 424 RelativePath="..\src\dual_depth.cg"> 422 425 </File> … … 482 485 </File> 483 486 <File 487 RelativePath=".\HashPvs.h"> 488 </File> 489 <File 484 490 RelativePath=".\HierarchyManager.cpp"> 485 491 </File> … … 750 756 <File 751 757 RelativePath="..\src\Pvs.h"> 758 </File> 759 <File 760 RelativePath=".\PvsBase.h"> 752 761 </File> 753 762 <File -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r2077 r2100 106 106 } 107 107 108 /////////////// /////////////108 /////////////// 109 109 // Mailing stuff 110 110 … … 172 172 { 173 173 template<typename T, typename S> 174 friend class PvsIterator;174 friend class PvsIterator; 175 175 176 176 public: 177 177 178 178 Pvs(): mSamples(0), mEntries(), mLastSorted(0), mQueriesSinceSort(0) {} 179 179 180 180 /** creates pvs and initializes it with the given entries. 181 181 Assumes that entries are sorted- 182 182 */ 183 183 Pvs(const vector<PvsEntry<T, S> > &samples); … … 186 186 /** Compresses PVS lossless or lossy. 187 187 */ 188 int Compress() {return 0;} 189 int GetSize() const {return (int)mEntries.size();} 190 bool Empty() const {return mEntries.empty();} 191 192 void Reserve(const int n) { mEntries.reserve(n); } 188 int Compress() 189 { 190 return 0; 191 } 192 193 int GetSize() const 194 { 195 return (int)mEntries.size(); 196 } 197 198 bool Empty() const 199 { 200 return mEntries.empty(); 201 } 202 203 void Reserve(const int n) 204 { 205 mEntries.reserve(n); 206 } 193 207 194 208 /** Normalize the visibility of entries in order to get 195 209 comparable results. 196 210 */ 197 211 void NormalizeMaximum(); 198 212 199 213 /** Merges pvs of a into this pvs. 200 214 Warning: very slow! 201 215 */ 202 216 void MergeInPlace(const Pvs<T, S> &a); 203 217 204 218 /** Difference of pvs to pvs b. 205 219 @returns number of different entries. 206 220 */ 207 221 int Diff(const Pvs<T, S> &b); … … 209 223 /** Finds sample in PVS. 210 224 @param checkDirty if dirty part of the pvs should be checked for entry 211 225 (warning: linear runtime in dirty part) 212 226 @returns iterator on the sample if found, else the place where 213 227 it would be added in the sorted vector. 214 228 */ 215 229 bool Find(T sample, … … 239 253 void Sort(); 240 254 241 /** Sort pvs entries assume that the pvs contains unique entries 242 */ 243 void SimpleSort(); 244 245 /** Adds sample to PVS. Assumes that the pvs is sorted 246 @returns contribution of sample (0 or 1) 247 */ 248 //float AddSamples(const vector<PvsEntry<T, S> > &samples); 255 /** Sort pvs entries assume that the pvs contains unique entries 256 */ 257 void SimpleSort(); 249 258 250 259 /** Adds sample to PVS. … … 269 278 270 279 /** Removes sample from PVS if reference count is zero. 271 280 @param visibleSamples number of references to be removed 272 281 */ 273 282 bool RemoveSample(T sample, const float pdf); … … 293 302 294 303 static void Merge(Pvs<T, S> &mergedPvs, const Pvs<T, S> &a, const Pvs<T, S> &b); 304 305 int GetSamples() const 306 { 307 return mSamples; 308 } 309 310 bool IsDirty() const 311 { 312 return mLastSorted < mEntries.size(); 313 } 314 315 bool RequiresResort() const 316 { 317 // the last part should not be more than log of the sorted part. this 318 // way we can achieve logarithmic behaviour for insertion and find 319 const int n = mEntries.size(); 320 const int dirtySize = n - mLastSorted; 321 322 #define LOG2E 1.442695040f 323 324 const float logN = log((float)max(1, n))/LOG2E; 325 const float logS = log((float)max(1, mLastSorted))/LOG2E; 326 const float logD = log((float)max(1, dirtySize))/LOG2E; 327 328 if (8*(n + 2*dirtySize*logD) < 329 mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN)) 330 { 331 // cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 332 return true; 333 } 334 335 return false; 336 } 337 338 bool RequiresResortLog() const 339 { 340 // the last part should not be more than log of the sorted part. this 341 // way we can achieve logarithmic behaviour for insertion and find 342 const int dirtySize = (int)mEntries.size() - mLastSorted; 343 return dirtySize > 4 * (int)(log((double)mEntries.size()) / log(2.0)); 344 } 345 346 347 int GetLastSorted() const 348 { 349 return mLastSorted; 350 } 351 352 typename PvsIterator<T, S> GetIterator() const; 353 354 protected: 295 355 296 356 static void Merge(Pvs<T, S> &mergedPvs, … … 302 362 const int bSamples); 303 363 304 int GetSamples() const305 {306 return mSamples;307 }308 309 310 bool IsDirty() const311 {312 return mLastSorted < mEntries.size();313 }314 315 bool RequiresResort() const316 {317 // the last part should not be more than log of the sorted part. this318 // way we can achieve logarithmic behaviour for insertion and find319 const int n = mEntries.size();320 const int dirtySize = n - mLastSorted;321 322 #define LOG2E 1.442695040f323 324 const float logN = log((float)max(1, n))/LOG2E;325 const float logS = log((float)max(1, mLastSorted))/LOG2E;326 const float logD = log((float)max(1, dirtySize))/LOG2E;327 328 if (8*(n + 2*dirtySize*logD) <329 mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN)) {330 // cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl;331 return true;332 }333 return false;334 }335 336 bool RequiresResortLog() const337 {338 // the last part should not be more than log of the sorted part. this339 // way we can achieve logarithmic behaviour for insertion and find340 const int dirtySize = (int)mEntries.size() - mLastSorted;341 return dirtySize > 4*(int)(log((double)mEntries.size()) / log(2.0));342 }343 344 345 int GetLastSorted() const346 {347 return mLastSorted;348 }349 350 typename PvsIterator<T, S> GetIterator() const;351 352 protected:353 354 364 /// vector of PVS entries 355 365 vector<PvsEntry<T, S> > mEntries; 356 366 357 367 /// Number of samples used to create the PVS 358 368 int mSamples; 359 369 360 370 /// Last sorted entry in the pvs (important for find and merge) 361 371 int mLastSorted; 362 372 363 373 int mQueriesSinceSort; 364 374 }; 365 375 … … 379 389 { 380 390 std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted; 381 //std::vector<PvsEntry<T, S> >::const_iterator it = mEntries.begin() + mLastSorted;382 391 std::vector<PvsEntry<T, S> >::iterator it_end = mEntries.end(); 383 392 … … 385 394 std::vector<PvsEntry<T, S> >::iterator newEnd = unique(it, it_end); 386 395 sort(it, newEnd); 387 //sort(mEntries.begin(), mEntries.end());388 396 389 397 // now merge sorted ranges … … 452 460 const float diff = bSumPdf - aSumPdf; 453 461 454 if (diff > 0.0f) { 462 if (diff > 0.0f) 463 { 455 464 pvsEnlargement += diff; 456 } else { 465 } 466 else 467 { 457 468 pvsReduction += -diff; 458 469 } 459 470 #else 460 471 if (!entryFound) 472 { 461 473 pvsEnlargement += 1.0f; 474 } 462 475 #endif 463 476 } … … 467 480 float aSumPdf = (*it).mData.mSumPdf; 468 481 float bSumPdf = 0.0f; 469 if (aSumPdf < 0.0f) {470 482 if (aSumPdf < 0.0f) 483 { 471 484 // this entry was already accounted for! 472 485 // just revert it back 473 486 (*it).mData.mSumPdf = -aSumPdf; 474 } else { 487 } 488 else 489 { 475 490 vector<PvsEntry<T, S> >::iterator oit; 476 491 … … 592 607 mergedPvs.mEntries.push_back(*bit); 593 608 } 594 595 //bObjOld = bObj;596 609 } 597 610 … … 669 682 } 670 683 671 /*672 template <typename T, typename S>673 bool Pvs<T, S>::Find(T sample,674 typename vector<PvsEntry<T, S> >::iterator &it,675 const bool checkDirty)676 {677 PvsEntry<T, S> dummy(sample, PvsData());678 mQueriesSinceSort++;679 680 // only check clean part681 vector<PvsEntry<T, S> >::iterator sorted_end = mEntries.begin() + mLastSorted;682 683 // binary search684 it = lower_bound(mEntries.begin(), sorted_end, dummy);685 686 if ((it != mEntries.end()) && ((*it).mObject == sample))687 return true;688 689 // sample not found yet => search further in the unsorted part690 if (checkDirty)691 {692 for (it = sorted_end; (it != mEntries.end()) && ((*it).mObject != sample); ++ it);693 694 if (it != mEntries.end())695 return true;696 }697 698 return false;699 }700 */701 684 702 685 template <typename T, typename S> -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r2071 r2100 1162 1162 1163 1163 1164 inline int AddedPvsSize( ObjectPvspvs1, const ObjectPvs &pvs2)1164 inline int AddedPvsSize(const ObjectPvs &pvs1, const ObjectPvs &pvs2) 1165 1165 { 1166 1166 ObjectPvs interPvs; … … 2267 2267 2268 2268 int entriesInPvs = rootEntries; 2269 const int entryStorage = sizeof(PvsData) + sizeof(int); // one entry into the pvs 2269 // one entry into the pvs 2270 const int entryStorage = sizeof(PvsData) + sizeof(int); 2270 2271 2271 2272 storageFunction.push_back(rootEntries); … … 2319 2320 } 2320 2321 } 2321 2322 2322 2323 2323 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2096 r2100 27 27 #include "PerfTimer.h" 28 28 29 #include "HashPvs.h" 30 29 31 30 32 … … 1543 1545 1544 1546 castSamples += samplesPerPass; 1547 HashPvs<int> dummy; 1545 1548 1546 1549 Real timeDiff = TimeDiff(startTime, GetTime());
Note: See TracChangeset
for help on using the changeset viewer.