Ignore:
Timestamp:
08/22/07 08:01:21 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2539 r2544  
    2525 
    2626 
    27 //class ObjectPvs; 
    28  
    2927 
    3028/** Statistics for a view cell partition. 
    3129*/ 
    32  
    3330class ViewCellsStatistics: public StatisticsBase 
    3431{ 
     
    8481 
    8582 
     83/** Statistics for a view cells tree. 
     84*/ 
    8685class ViewCellsTreeStats 
    8786{ 
     
    142141 
    143142 
    144 /** 
    145         A view cell. View cells are regions in space. The visibility informations, 
    146         i.e., the primitives seen by the view cell are stored in a PVs. 
    147         A view cell can be represented in many different ways, e.g., 
    148         a mesh representation. 
     143/** This class represents a view cell, which is a region in view space.  
     144        The objects seen by the view cell are stored in a pvs. 
     145        A view cell can be represented in many different ways, e.g., as a mesh. 
    149146*/ 
    150147class ViewCell: public MeshInstance 
     
    156153 
    157154        ViewCell(); 
    158  
    159155        /** Constructor taking a mesh representing the shape of the viewcell. 
    160156        */ 
    161157        ViewCell(Mesh *mesh); 
    162  
    163158        /** Default destructor. 
    164159        */ 
    165160        virtual ~ViewCell(); 
    166         /** Returns Pvs. 
     161        /** Returns const reference to pvs. 
    167162        */ 
    168163        const ObjectPvs &GetPvs() const; 
    169         /** Returns pvs. 
     164        /** Returns reference to pvs. 
    170165        */ 
    171166        ObjectPvs &GetPvs(); 
     
    222217        */ 
    223218        bool GetValid() const; 
    224  
    225219        /** Returns estimated render cost of this view cell. 
    226220        */ 
    227221        float GetRenderCost() const; 
    228  
    229222        /** set color for visiualizations. 
    230223        */ 
    231224        void SetColor(const RgbColor &color); 
    232  
    233225        /** get color for visualuzations. 
    234226        */ 
    235227    RgbColor GetColor() const; 
    236  
    237228        /** Adds a sample to the pvs. 
    238229                @param sample the sample to be added 
     
    241232        */ 
    242233        bool AddPvsSample(Intersectable *sample, const float pdf, float &contribution); 
    243  
    244234        /** if this is a view cell correspending to a leaf in a hierarchy. 
    245235        */ 
     
    257247        */ 
    258248        void SetMergeCost(const float mergeCost); 
    259  
    260249        /** Returns merge cost needed to merge this leaf from other cells. 
    261250                @hack The function is available for leaves also to have a common interface, 
     
    391380{ 
    392381public: 
    393         ViewCellLeaf()  {  mActiveViewCell = this; } 
    394         ViewCellLeaf(Mesh *mesh): 
    395         ViewCell(mesh) { mActiveViewCell = this; } 
     382         
     383        ViewCellLeaf()   
     384        {   
     385                mActiveViewCell = this;  
     386        } 
     387         
     388        ViewCellLeaf(Mesh *mesh): ViewCell(mesh)  
     389        {  
     390                mActiveViewCell = this;  
     391        } 
    396392 
    397393        bool IsLeaf() const 
     
    454450public: 
    455451 
     452        /** Default constructor. 
     453        */ 
    456454        ViewCellsTree(); 
    457  
    458455        /** View cells tree constructor taking a view cell mnanager as parameter 
    459456        */ 
    460457        ViewCellsTree(ViewCellsManager *vcm); 
     458        /** Destructor. 
     459        */ 
    461460        ~ViewCellsTree(); 
    462  
    463461        /** Returns number of leaves this view cell consists of. 
    464462        */ 
    465463        int GetNumInitialViewCells(ViewCell *vc) const; 
    466  
    467464        /** Collects leaves corresponding to a view cell. 
    468465        */ 
    469466        void CollectLeaves(ViewCell *vc, ViewCellContainer &leaves) const; 
    470  
    471467        /** Merges view cells according to some cost heuristics. 
    472468        */ 
    473469        int ConstructMergeTree(const VssRayContainer &rays, const ObjectContainer &objects); 
    474          
    475470        /** Refines view cells using shuffling, i.e., border leaves  
    476471                of two view cells are exchanged if the resulting view cells 
     
    479474        */ 
    480475        int RefineViewCells(const VssRayContainer &rays, const ObjectContainer &objects); 
    481          
    482476        /** Assign colors to the viewcells so that they can be renderered interactively without 
    483477            color flickering.   
    484478        */ 
    485479        void AssignRandomColors(); 
    486  
    487480        /** Updates view cell stats for this particular view cell. 
    488481        */ 
    489482        void UpdateViewCellsStats(ViewCell *vc, ViewCellsStatistics &vcStat); 
    490  
    491483        /** Get costs resulting from each merge step.  
    492484        */ 
    493485        void GetCostFunction(vector<float> &costFunction); 
    494          
    495486        /** Returns storage cost resulting from each merge step. 
    496487        */ 
    497488        void GetStorageFunction(vector<int> &storageCost); 
    498  
    499489        /** Returns optimal set of view cells for a given number of view cells. 
    500490        */ 
    501491        void CollectBestViewCellSet(ViewCellContainer &viewCells, const int numViewCells); 
    502  
    503492        /** Root of view cells tree. 
    504493        */ 
    505494        ViewCell *GetRoot() const; 
    506  
    507495        /** Returns pvs of view cell. 
    508496                @note pvs is returned per reference if tree is not compressed, 
     
    510498        */ 
    511499        void GetPvs(ViewCell *vc, ObjectPvs &pvs) const; 
    512  
    513500        /** Returns pvs size (i.e. the render cost of the stored objects) 
    514501        */ 
    515502        float GetTrianglesInPvs(ViewCell *vc) const; 
    516    
    517503        /** Returns number of entries associated with this view cell.  
    518504 
     
    522508        */ 
    523509        int GetPvsEntries(ViewCell *vc) const; 
    524  
    525510        /** Returns the number of physically stored entries in the view cells sub tree. 
    526511                This can vary based on the current storage method 
    527512        */ 
    528513        int CountStoredPvsEntries(ViewCell *root) const; 
    529  
    530514        /** Returns memory cost of this view cell. 
    531515        */ 
    532516        float GetMemoryCost(ViewCell *vc) const; 
    533  
    534517        /** Sets method of storage for view cells. 
    535518        */ 
    536519        void SetViewCellsStorage(int type); 
    537  
    538520        /** pvs storage methods  
    539521        */ 
    540522        enum {PVS_IN_INTERIORS, COMPRESSED, PVS_IN_LEAVES}; 
    541  
    542523        /** If view cells in this tree have compressed pvs. 
    543524        */ 
    544525        int ViewCellsStorage() const; 
    545  
    546526        /** Returns active view cell that is in the path of this view cell. 
    547527        */ 
     
    736716        int mMaxMergesPerPass; 
    737717        float mAvgCostMaxDeviation; 
     718 
     719        int *mPvsIds; 
     720        ObjectContainer mTempObjects; 
    738721}; 
    739722 
Note: See TracChangeset for help on using the changeset viewer.