Changeset 1155


Ignore:
Timestamp:
07/26/06 09:22:09 (18 years ago)
Author:
mattausch
Message:

added support for kd pvs sampling

Location:
GTP/trunk/Lib/Vis
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1151 r1155  
    5454mMaxPvsRatio(1.0), 
    5555mViewCellPvsIsUpdated(false), 
    56 mPreprocessor(NULL) 
     56mPreprocessor(NULL), 
     57mStoreKdPvs(false) 
    5758{ 
    5859        mViewSpaceBox.Initialize(); 
     
    13611362float 
    13621363ViewCellsManager::ComputeSampleContributions(const VssRayContainer &rays, 
    1363                                                                                          const bool addRays, 
     1364                                                                                         const bool addRays,                                                                     
    13641365                                                                                         const bool storeViewCells 
    13651366                                                                                         ) 
     
    13721373 
    13731374  float sum = 0.0f; 
     1375 
    13741376  for (it = rays.begin(); it != it_end; ++ it)  
    13751377  { 
    13761378          sum += ComputeSampleContributions(*(*it), addRays, storeViewCells); 
    1377           //ComputeSampleContributions(*(*it), addRays); 
    1378           //    sum += (*it)->mPvsContribution; 
    13791379  } 
    13801380 
     
    18671867        CastLineSegment(origin, termination, viewcells); 
    18681868 
    1869         //const bool storeViewcells = !addRays; 
    1870 //return 0; 
    18711869        if (storeViewCells) 
    1872         { 
    1873                 // copy viewcells memory efficiently 
     1870        {       // copy viewcells memory efficiently 
    18741871                ray.mViewCells.reserve(viewcells.size()); 
    18751872                ray.mViewCells = viewcells; 
     
    19091906        } 
    19101907 
    1911          
     1908        // if addrays is true, sampled entities are stored in the pvs 
    19121909        if (addRays) 
    19131910        { 
     
    19191916                        { 
    19201917                                // if ray not outside of view space 
    1921                                  if (ray.mTerminationObject) 
    1922                                          viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 
    1923  
     1918 
     1919                                // add kd cell 
     1920                                if (ray.mTerminationObject) 
     1921                                { 
     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                                 
    19241933#if 0 
    19251934                                 if (ray.mOriginObject) 
     
    24462455 
    24472456 
     2457void ViewCellsManager::SetStoreKdPvs(const bool storeKdPvs) 
     2458{ 
     2459        mStoreKdPvs = storeKdPvs; 
     2460} 
     2461 
     2462 
     2463bool ViewCellsManager::GetStoreKdPVs() const 
     2464{ 
     2465        return mStoreKdPvs; 
     2466} 
     2467 
    24482468 
    24492469/*******************************************************************/ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1145 r1155  
    101101        */ 
    102102        float ComputeSampleContributions(const VssRayContainer &rays, 
    103                                                                    const bool addContributions, 
    104                                                                    const bool storeViewCells); 
    105  
    106         /** Add sample contributions to the viewcells they intersect */ 
     103                                                                         const bool addContributions, 
     104                                                                         const bool storeViewCells); 
     105 
     106        /** Add sample contributions to the viewcells they intersect  
     107        */ 
    107108        void AddSampleContributions(const VssRayContainer &rays); 
    108109   
     
    116117        */ 
    117118        virtual float ComputeSampleContributions(VssRay &ray,  
    118                                                                                          const bool addRays,  
     119                                                                                         const bool addRays, 
    119120                                                                                         const bool storeViewCells); 
    120121 
     
    475476 
    476477 
    477         /** Returns true if this view cell is equivalent to a node of the spatial hierarchy. 
     478        /** Returns true if the view cell is equivalent to a  
     479                node of the spatial hierarchy. This function can be used for merged 
     480                view cell. 
     481                e.g. to see if the spatial tree can be reduced on this location 
    478482        */ 
    479483        virtual bool EqualToSpatialNode(ViewCell *viewCell) const; 
     484 
     485        /** If true, the kd nodes are stored instead of the object pvs. 
     486        */ 
     487        void SetStoreKdPvs(const bool storeKdPvs); 
     488 
     489        /** Returns true if the kd nodes are stored instead of the object pvs. 
     490        **/ 
     491        bool GetStoreKdPVs() const; 
    480492 
    481493protected: 
     
    592604        bool mPruneEmptyViewCells; 
    593605 
    594         /// if the pvss in the view cell leaves and the interiors are up to date 
     606        /// if the values in the view cell leaves and the interiors are up to date 
     607        /// this is meant for lazy storing of the pvs, where only a scalar indicating 
     608        /// pvs size is stored in interiors and not the pvs itself. 
    595609        bool mViewCellPvsIsUpdated; 
    596610 
     
    658672        /// if pvs should be exported with view cells 
    659673        bool mExportPvs; 
     674 
     675        bool mStoreKdPvs; 
    660676}; 
    661677 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp

    r1149 r1155  
    508508        { 
    509509                mBoundingBox.Initialize(); 
    510  
    511510                VssRayContainer::const_iterator rit, rit_end = rays.end(); 
    512511 
Note: See TracChangeset for help on using the changeset viewer.