Ignore:
Timestamp:
07/06/07 00:38:58 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r2199 r2529  
    5959 
    6060        /** creates pvs and initializes it with the given entries.  
    61         Assumes that entries are sorted- 
     61                Assumes that entries are sorted. 
    6262        */ 
    6363        VerbosePvs(const vector<PvsEntry<T, S> > &samples); 
     
    6666        /** Compresses PVS lossless or lossy. 
    6767        */ 
    68         int Compress()  
    69         { 
    70                 return 0; 
    71         } 
    72          
    73         int GetSize() const  
    74         { 
    75                 return (int)mEntries.size(); 
    76         } 
    77          
    78         bool Empty() const  
    79         { 
    80                 return mEntries.empty(); 
    81         } 
    82  
    83         void Reserve(const int n)  
    84         {  
    85                 mEntries.reserve(n);  
    86         } 
    87  
     68        int Compress() { return 0; } 
     69         
     70        inline int GetSize() const { return (int)mEntries.size(); } 
     71         
     72        inline bool Empty() const { return mEntries.empty(); } 
     73 
     74        inline void Reserve(const int n) { mEntries.reserve(n); } 
    8875        /** Normalize the visibility of entries in order to get  
    89         comparable results. 
     76                comparable results. 
    9077        */ 
    9178        void NormalizeMaximum(); 
    92  
    9379        /** Merges pvs of a into this pvs. 
    94         Warning: very slow! 
     80                Warning: very slow! 
    9581        */ 
    9682        void MergeInPlace(const VerbosePvs<T, S> &a); 
    97  
    9883        /** Difference of pvs to pvs b. 
    9984        @returns number of different entries. 
    10085        */ 
    10186        int Diff(const VerbosePvs<T, S> &b); 
    102  
    10387        /** Finds sample in PVS. 
    10488                @param checkDirty if dirty part of the pvs should be checked for entry  
     
    11296 
    11397        bool GetSampleContribution(T sample, const float pdf, float &contribution); 
    114  
    11598        /** Adds sample to PVS. 
    11699                @returns contribution of sample (0 or 1) 
    117100        */ 
    118101        float AddSample(T sample, const float pdf); 
    119  
    120102        /** Adds sample to PVS without checking for presence of the sample 
    121103                warning: pvs remains unsorted! 
    122104        */ 
    123105        void AddSampleDirty(T sample, const float pdf); 
    124  
    125106        /** Adds sample dirty (on the end of the vector) but 
    126107                first checks if sample is already in clean part of the pvs. 
    127108        */ 
    128109        bool AddSampleDirtyCheck(T sample, const float pdf); 
    129  
    130         /** Sort pvs entries - this should always be called after a 
     110        /** Sort pvs entries. This should always be called after a 
    131111                sequence of AddSampleDirty calls  
    132112        */ 
    133113        void Sort(); 
    134  
    135114        /** Sort pvs entries assume that the pvs contains unique entries 
    136115        */ 
    137116        void SimpleSort(); 
    138  
    139117        /** Adds sample to PVS. 
    140118                @returns PvsData 
     
    142120        typename std::vector<PvsEntry<T, S> >::iterator  
    143121                AddSample2(T sample, const float pdf); 
    144  
    145122        /** Subtracts one pvs from another one. 
    146123                WARNING: could contains bugs 
     
    172149        */ 
    173150        void Clear(const bool trim = true); 
    174  
     151        /** Trim the vector containing the pvs. 
     152        */ 
    175153        void Trim(); 
    176154 
     
    186164                                          const VerbosePvs<T, S> &b); 
    187165 
    188         int GetSamples() const 
    189         { 
    190                 return mSamples; 
    191         } 
    192  
    193         bool IsDirty() const 
    194         { 
    195                 return mLastSorted < mEntries.size(); 
    196         } 
    197  
     166        inline int GetSamples() const { return mSamples; } 
     167 
     168        /** If there is an unsorted part in the pvs. 
     169        */ 
     170        bool IsDirty() const { return mLastSorted < mEntries.size(); } 
     171 
     172        /** If this pvs requires a resort to stay efficient. 
     173        */ 
    198174        bool RequiresResort() const 
    199175        { 
     
    212188                        mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN))  
    213189                { 
    214                                 //              cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 
     190                        // cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 
    215191                        return true; 
    216192                } 
     
    219195        } 
    220196 
     197        /** If this pvs requires a resort to stay efficient. 
     198        */ 
    221199        bool RequiresResortLog() const 
    222200        { 
     
    227205        } 
    228206 
    229         int GetLastSorted() const 
    230         { 
    231                 return mLastSorted; 
    232         } 
     207        inline int GetLastSorted() const { return mLastSorted; } 
    233208 
    234209        typename PvsIterator<T, S> GetIterator() const; 
     
    236211protected: 
    237212 
     213        /** Merge pvs 1 from begin iterator to end iterator with 
     214                pvs 2 from begin iterator to end iterator. 
     215        */ 
    238216        static void Merge(VerbosePvs<T, S> &mergedPvs,  
    239217                                          const typename std::vector<PvsEntry<T, S> >::const_iterator &aBegin, 
     
    243221                                          const int aSamples,  
    244222                                          const int bSamples); 
     223 
    245224 
    246225        ////////////////////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h

    r2176 r2529  
    7373        // $$JB in order to return meaningfull values 
    7474        // it assumes that the sum pdf has been normalized somehow!!! 
    75         inline float GetVisibility()  
    76         {  
    77                 return mSumPdf;  
    78         } 
     75        inline float GetVisibility() { return mSumPdf; } 
    7976 
    8077        /// sum of probability density of visible sample rays 
     
    9693        // $$JB in order to return meaningfull values 
    9794        // it assumes that the sum pdf has been normalized somehow!!! 
    98         float GetVisibility()  
    99         {  
    100                 return mSumPdf;  
    101         } 
     95        inline float GetVisibility() { return mSumPdf; } 
     96 
    10297 
    10398        /////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2173 r2529  
    417417                  //float visibility = mTransferFunction*log10(entry.mData.mSumPdf + 1); // /5.0f 
    418418                  //              glColor3f(visibility, 0.0f, 0.0f); 
    419  
     419                        cerr << "sumpdf: " << entry.mData.mSumPdf << endl; 
    420420                  RgbColor color = RainbowColorMapping(mTransferFunction*log10(entry.mData.mSumPdf + 1)); 
    421421                  glColor3f(color.r, color.g, color.b); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2394 r2529  
    36493649                pvs = root->GetPvs(); 
    36503650                UpdateScalarPvsSize(root, pvs.EvalPvsCost(), pvs.GetSize()); 
     3651 
    36513652                return; 
    36523653        } 
     
    36713672        int i = 0; 
    36723673 
     3674        //////// 
     3675        //-- recursivly compute child pvss 
     3676 
    36733677        for (vit = interior->mChildren.begin(); vit != vit_end; ++ vit, ++ i) 
    36743678        { 
    3675                 ////////////////// 
    3676                 //-- recursivly compute child pvss 
    3677                 UpdatePvsForEvaluation(*vit, pvsList[i]/*objPvs*/); 
     3679                UpdatePvsForEvaluation(*vit, pvsList[i]); 
    36783680        } 
    36793681 
     
    37003702                        {  
    37013703                                intersect->Mail(); 
    3702  
    37033704                                pvs.AddSampleDirty(intersect, pvsData.mSumPdf); 
    37043705                        } 
    37053706                } 
    37063707        } 
    3707  
    3708         if (0) pvs.Sort(); 
    37093708 
    37103709        // store pvs in this node 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r2353 r2529  
    37093709                                BvhNode *parent = obj->GetParent(); 
    37103710 
    3711                                 // add only entries that cannot be exchaned with the parent 
     3711                                // add only entries that cannot be exchanged with the parent 
    37123712                                if (!parent->Mailed(1)) 
    37133713                                { 
Note: See TracChangeset for help on using the changeset viewer.