Changeset 2100


Ignore:
Timestamp:
02/07/07 17:43:56 (17 years ago)
Author:
mattausch
Message:

worked on pvs

Location:
GTP/trunk/Lib/Vis
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/GtpVisibility.sln

    r1949 r2100  
    1010Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IVReader", "OnlineCullingCHC\IVReader\src\IVReader.vcproj", "{7319E499-473D-4CE5-9983-725D6E68A55D}" 
    1111        ProjectSection(ProjectDependencies) = postProject 
    12                 {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 
    1312        EndProjectSection 
    1413EndProject 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj

    r1926 r2100  
    7373                                Name="VCCLCompilerTool" 
    7474                                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" 
    7676                                RuntimeLibrary="2" 
    7777                                UsePrecompiledHeader="0" 
     
    225225                        <Tool 
    226226                                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" 
    227236                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;..\include" 
    228237                                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="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;..\..\GtpVisibility\lib\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;" 
     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="&quot;$(OGRE_PATH)\OgreMain\lib\Release&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;..\..\GtpVisibility\lib\Release;..\..\lib\Release;..\lib\Release;&quot;$(OGRE_PATH)\Dependencies\lib\Release&quot;" 
    242252                                GenerateDebugInformation="TRUE" 
    243253                                SubSystem="2" 
    244254                                OptimizeReferences="2" 
    245255                                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) &quot;$(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)&quot;"/> 
     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) &quot;$(OGRE_PATH)\Samples\Common\bin\Release&quot;"/> 
    253264                        <Tool 
    254265                                Name="VCPreBuildEventTool"/> 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj

    r2069 r2100  
    8787                                OmitFramePointers="TRUE" 
    8888                                EnableFiberSafeOptimizations="TRUE" 
    89                                 OptimizeForProcessor="0" 
     89                                OptimizeForProcessor="3" 
    9090                                OptimizeForWindowsApplication="TRUE" 
    9191                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\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" 
    9393                                StringPooling="TRUE" 
    9494                                RuntimeLibrary="2" 
     
    280280                <Configuration 
    281281                        Name="Release Internal|Win32" 
    282                         OutputDirectory="$(ConfigurationName)" 
    283                         IntermediateDirectory="$(ConfigurationName)" 
     282                        OutputDirectory="Release" 
     283                        IntermediateDirectory="Release" 
    284284                        ConfigurationType="2" 
    285285                        CharacterSet="2" 
     
    295295                                OmitFramePointers="TRUE" 
    296296                                EnableFiberSafeOptimizations="TRUE" 
    297                                 OptimizeForProcessor="2" 
    298                                 AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src" 
    299                                 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GTP_VISIBILITY_MODIFIED_OGRE" 
     297                                OptimizeForProcessor="3" 
     298                                OptimizeForWindowsApplication="TRUE" 
     299                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\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" 
    300301                                StringPooling="TRUE" 
    301302                                RuntimeLibrary="2" 
    302303                                BufferSecurityCheck="FALSE" 
    303304                                EnableFunctionLevelLinking="TRUE" 
    304                                 RuntimeTypeInfo="TRUE" 
     305                                RuntimeTypeInfo="FALSE" 
    305306                                UsePrecompiledHeader="0" 
    306307                                WarningLevel="3" 
     
    312313                                Name="VCLinkerTool" 
    313314                                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" 
    315316                                OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 
    316317                                Version="0.99" 
    317318                                LinkIncremental="1" 
    318319                                SuppressStartupBanner="TRUE" 
    319                                 AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;..\..\GtpVisibility\lib\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;..\..\..\Preprocessing\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;&quot;$(CG_LIB_PATH)&quot;;..\..\..\..\..\..\..\NonGTP\Zlib\lib" 
     320                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\Release&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\Release&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;..\..\GtpVisibility\lib\Release;..\..\lib\Release;..\lib\Release;&quot;$(OGRE_PATH)\Dependencies\lib\Release&quot;;..\..\..\Preprocessing\lib\Release;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;&quot;$(CG_LIB_PATH)&quot;;..\..\..\..\..\..\..\NonGTP\Zlib\lib" 
    320321                                ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 
    321                                 GenerateDebugInformation="TRUE" 
     322                                GenerateDebugInformation="FALSE" 
    322323                                SubSystem="2" 
    323324                                OptimizeReferences="2" 
    324325                                EnableCOMDATFolding="2" 
     326                                OptimizeForWindows98="1" 
    325327                                ImportLibrary="$(OutDir)/Plugin_VisibilitySceneManager.lib" 
    326328                                TargetMachine="1"/> 
     
    329331                        <Tool 
    330332                                Name="VCPostBuildEventTool" 
    331                                 CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)"/> 
     333                                CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\Release"/> 
    332334                        <Tool 
    333335                                Name="VCPreBuildEventTool"/> 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/GtpVisibility.vcproj

    r1926 r2100  
    6262                        <Tool 
    6363                                Name="VCCLCompilerTool" 
     64                                Optimization="3" 
    6465                                GlobalOptimizations="TRUE" 
     66                                InlineFunctionExpansion="2" 
     67                                EnableIntrinsicFunctions="TRUE" 
    6568                                FavorSizeOrSpeed="1" 
    6669                                OmitFramePointers="TRUE" 
    67                                 OptimizeForWindowsApplication="TRUE" 
    68                                 AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\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;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\Preprocessing\src" 
     74                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB" 
     75                                StringPooling="TRUE" 
     76                                RuntimeLibrary="2" 
     77                                EnableEnhancedInstructionSet="2" 
     78                                RuntimeTypeInfo="FALSE" 
    7279                                UsePrecompiledHeader="0" 
    7380                                WarningLevel="3" 
     
    188195                        <Tool 
    189196                                Name="VCCLCompilerTool" 
    190                                 OptimizeForWindowsApplication="TRUE" 
    191                                 AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\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;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\Preprocessing\src" 
     207                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB" 
     208                                RuntimeLibrary="2" 
     209                                EnableEnhancedInstructionSet="2" 
     210                                RuntimeTypeInfo="FALSE" 
    195211                                UsePrecompiledHeader="0" 
    196212                                BrowseInformation="1" 
  • GTP/trunk/Lib/Vis/Preprocessing/EvalStats/EvalStats.vcproj

    r1926 r2100  
    205205                        <Tool 
    206206                                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" 
    223233                                TargetMachine="1"/> 
    224234                        <Tool 
  • GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp

    r2017 r2100  
    392392        // This is important during the subdivision 
    393393 
    394 //MailablePvsData::NewMail(); 
     394        //MailablePvsData::NewMail(); 
    395395        UpdateViewCellsPvs(front, *frontData.mRays); 
    396396        UpdateViewCellsPvs(back, *backData.mRays); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r2092 r2100  
    206206                <Configuration 
    207207                        Name="Release Internal|Win32" 
    208                         OutputDirectory="$(ConfigurationName)" 
    209                         IntermediateDirectory="$(ConfigurationName)" 
     208                        OutputDirectory="Release" 
     209                        IntermediateDirectory="Release" 
    210210                        ConfigurationType="4" 
    211211                        CharacterSet="2"> 
     
    419419                        </File> 
    420420                        <File 
     421                                RelativePath=".\DefaultPvs.h"> 
     422                        </File> 
     423                        <File 
    421424                                RelativePath="..\src\dual_depth.cg"> 
    422425                        </File> 
     
    482485                        </File> 
    483486                        <File 
     487                                RelativePath=".\HashPvs.h"> 
     488                        </File> 
     489                        <File 
    484490                                RelativePath=".\HierarchyManager.cpp"> 
    485491                        </File> 
     
    750756                        <File 
    751757                                RelativePath="..\src\Pvs.h"> 
     758                        </File> 
     759                        <File 
     760                                RelativePath=".\PvsBase.h"> 
    752761                        </File> 
    753762                        <File 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r2077 r2100  
    106106        } 
    107107 
    108         //////////////////////////// 
     108        /////////////// 
    109109        //  Mailing stuff 
    110110 
     
    172172{ 
    173173        template<typename T, typename S> 
    174         friend class PvsIterator; 
     174                friend class PvsIterator; 
    175175 
    176176public: 
    177    
     177 
    178178        Pvs(): mSamples(0), mEntries(), mLastSorted(0), mQueriesSinceSort(0) {} 
    179179 
    180180        /** creates pvs and initializes it with the given entries.  
    181                 Assumes that entries are sorted- 
     181        Assumes that entries are sorted- 
    182182        */ 
    183183        Pvs(const vector<PvsEntry<T, S> > &samples); 
     
    186186        /** Compresses PVS lossless or lossy. 
    187187        */ 
    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        } 
    193207 
    194208        /** Normalize the visibility of entries in order to get  
    195                 comparable results. 
     209        comparable results. 
    196210        */ 
    197211        void NormalizeMaximum(); 
    198212 
    199213        /** Merges pvs of a into this pvs. 
    200                 Warning: very slow! 
     214        Warning: very slow! 
    201215        */ 
    202216        void MergeInPlace(const Pvs<T, S> &a); 
    203217 
    204218        /** Difference of pvs to pvs b. 
    205                 @returns number of different entries. 
     219        @returns number of different entries. 
    206220        */ 
    207221        int Diff(const Pvs<T, S> &b); 
     
    209223        /** Finds sample in PVS. 
    210224                @param checkDirty if dirty part of the pvs should be checked for entry  
    211                         (warning: linear runtime in dirty part) 
     225                (warning: linear runtime in dirty part) 
    212226                @returns iterator on the sample if found, else the place where  
    213                         it would be added in the sorted vector. 
     227                it would be added in the sorted vector. 
    214228        */ 
    215229        bool Find(T sample, 
     
    239253        void Sort(); 
    240254 
    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(); 
    249258 
    250259        /** Adds sample to PVS. 
     
    269278 
    270279        /** Removes sample from PVS if reference count is zero. 
    271                 @param visibleSamples number of references to be removed 
     280        @param visibleSamples number of references to be removed 
    272281        */ 
    273282        bool RemoveSample(T sample, const float pdf); 
     
    293302 
    294303        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 
     354protected: 
    295355 
    296356        static void Merge(Pvs<T, S> &mergedPvs,  
     
    302362                                          const int bSamples); 
    303363 
    304         int GetSamples() const 
    305         { 
    306                 return mSamples; 
    307         } 
    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                 //              cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 
    331                 return true; 
    332           } 
    333           return false; 
    334         } 
    335  
    336   bool RequiresResortLog() const 
    337   { 
    338         // the last part should not be more than log of the sorted part. this 
    339         // way we can achieve logarithmic behaviour for insertion and find 
    340         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() const 
    346         { 
    347                 return mLastSorted; 
    348         } 
    349  
    350         typename PvsIterator<T, S> GetIterator() const; 
    351  
    352 protected: 
    353  
    354364        /// vector of PVS entries 
    355365        vector<PvsEntry<T, S> > mEntries;  
    356          
     366 
    357367        /// Number of samples used to create the PVS 
    358368        int mSamples; 
    359    
     369 
    360370        /// Last sorted entry in the pvs (important for find and merge) 
    361371        int mLastSorted; 
    362372 
    363   int mQueriesSinceSort; 
     373        int mQueriesSinceSort; 
    364374}; 
    365375 
     
    379389{ 
    380390        std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted; 
    381         //std::vector<PvsEntry<T, S> >::const_iterator it = mEntries.begin() + mLastSorted; 
    382391        std::vector<PvsEntry<T, S> >::iterator it_end = mEntries.end(); 
    383392 
     
    385394        std::vector<PvsEntry<T, S> >::iterator newEnd = unique(it, it_end); 
    386395        sort(it, newEnd); 
    387         //sort(mEntries.begin(), mEntries.end()); 
    388396         
    389397        // now merge sorted ranges 
     
    452460                const float diff = bSumPdf - aSumPdf; 
    453461 
    454                 if (diff > 0.0f) { 
     462                if (diff > 0.0f)  
     463                { 
    455464                        pvsEnlargement += diff; 
    456                 } else { 
     465                }  
     466                else  
     467                { 
    457468                        pvsReduction += -diff; 
    458469                } 
    459470#else 
    460471                if (!entryFound) 
     472                { 
    461473                        pvsEnlargement += 1.0f; 
     474                } 
    462475#endif 
    463476        } 
     
    467480                float aSumPdf = (*it).mData.mSumPdf; 
    468481                float bSumPdf = 0.0f; 
    469                 if (aSumPdf < 0.0f) { 
    470                  
     482                if (aSumPdf < 0.0f)  
     483                { 
    471484                        // this entry was already accounted for! 
    472485                        // just revert it back 
    473486                        (*it).mData.mSumPdf = -aSumPdf; 
    474                 } else { 
     487                }  
     488                else  
     489                { 
    475490                        vector<PvsEntry<T, S> >::iterator oit; 
    476491                 
     
    592607                                mergedPvs.mEntries.push_back(*bit); 
    593608                        } 
    594                          
    595                         //bObjOld = bObj; 
    596609                } 
    597610 
     
    669682} 
    670683 
    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 part 
    681         vector<PvsEntry<T, S> >::iterator sorted_end = mEntries.begin() + mLastSorted; 
    682  
    683         // binary search 
    684         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 part 
    690         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 */ 
    701684 
    702685template <typename T, typename S> 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r2071 r2100  
    11621162 
    11631163 
    1164 inline int AddedPvsSize(ObjectPvs pvs1, const ObjectPvs &pvs2) 
     1164inline int AddedPvsSize(const ObjectPvs &pvs1, const ObjectPvs &pvs2) 
    11651165{ 
    11661166        ObjectPvs interPvs; 
     
    22672267 
    22682268        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);  
    22702271 
    22712272        storageFunction.push_back(rootEntries); 
     
    23192320        } 
    23202321} 
    2321  
    23222322 
    23232323 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2096 r2100  
    2727#include "PerfTimer.h" 
    2828 
     29#include "HashPvs.h" 
     30 
    2931 
    3032 
     
    15431545                 
    15441546                castSamples += samplesPerPass; 
     1547HashPvs<int> dummy; 
    15451548 
    15461549                Real timeDiff = TimeDiff(startTime, GetTime()); 
Note: See TracChangeset for help on using the changeset viewer.