Ignore:
Timestamp:
12/23/05 11:05:33 (19 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h

    r478 r479  
    1616class VspKdLeaf; 
    1717class KdLeaf; 
    18  
    19 /** 
    20         View cell with an optional mesh representation 
    21 */ 
    22 class ViewCell: public MeshInstance 
    23 { 
    24 public: 
    25         ViewCell(); 
    26  
    27         /** Constructor taking a mesh representing the shape of the viewcell. 
    28         */ 
    29         ViewCell(Mesh *mesh); 
    30  
    31         /** Default destructor. 
    32         */ 
    33         virtual ~ViewCell() {} 
    34         /** Returns Pvs. 
    35         */ 
    36         const ObjectPvs &GetPvs() const; 
    37         ObjectPvs &GetPvs(); 
    38  
    39         int Type() const; 
    40  
    41         /** Adds a passing ray to the passing ray container. 
    42         */ 
    43         void AddPassingRay(const Ray &ray, const int contributions); 
    44  
    45         /** Returns volume of the view cell. 
    46         */ 
    47         float GetVolume() const; 
    48  
    49         /** Returns area of the view cell. 
    50         */ 
    51         float GetArea() const; 
    52  
    53         /** Sets the volume of the view cell. 
    54         */ 
    55         void SetVolume(float volume); 
    56          
    57         /** Sets the area of the view cell. 
    58         */ 
    59         void SetArea(float area); 
    60  
    61         /// Ray set description of the rays passing through this node. 
    62         PassingRaySet mPassingRays; 
    63  
    64         /// Rays piercing this view cell. 
    65         RayContainer mPiercingRays; 
    66  
    67 protected: 
    68  
    69         /// the potentially visible objects 
    70         ObjectPvs mPvs; 
    71  
    72         float mVolume; 
    73         float mArea; 
    74 }; 
    75  
    76 /** 
    77         View cell belonging to a hierarchy. 
    78 */ 
    79 template<typename T> 
    80 class HierarchyViewCell: public ViewCell 
    81 { 
    82 public: 
    83         HierarchyViewCell<T>(): mLeaves(0) {} 
    84         HierarchyViewCell<T>(Mesh *mesh): 
    85                 ViewCell(mesh), mLeaves(0) {} 
    86  
    87         /// Leaves of the hierarchy which are part of this view cell. 
    88         std::vector<T> mLeaves; 
    89 }; 
    90  
    91 typedef HierarchyViewCell<BspLeaf *> BspViewCell; 
    92 typedef HierarchyViewCell<KdLeaf *> KdViewCell; 
    93 typedef HierarchyViewCell<VspKdLeaf *> VspKdViewCell; 
    94  
    9518 
    9619/** Statistics for a view cell partition. 
     
    15275}; 
    15376 
     77/** 
     78        View cell with an optional mesh representation 
     79*/ 
     80class ViewCell: public MeshInstance 
     81{ 
     82public: 
     83        ViewCell(); 
     84 
     85        /** Constructor taking a mesh representing the shape of the viewcell. 
     86        */ 
     87        ViewCell(Mesh *mesh); 
     88 
     89        /** Default destructor. 
     90        */ 
     91        virtual ~ViewCell() {} 
     92        /** Returns Pvs. 
     93        */ 
     94        const ObjectPvs &GetPvs() const; 
     95        ObjectPvs &GetPvs(); 
     96 
     97        int Type() const; 
     98 
     99        /** Adds a passing ray to the passing ray container. 
     100        */ 
     101        void AddPassingRay(const Ray &ray, const int contributions); 
     102 
     103        /** Returns volume of the view cell. 
     104        */ 
     105        float GetVolume() const; 
     106 
     107        /** Returns area of the view cell. 
     108        */ 
     109        float GetArea() const; 
     110 
     111        /** Sets the volume of the view cell. 
     112        */ 
     113        void SetVolume(float volume); 
     114         
     115        /** Sets the area of the view cell. 
     116        */ 
     117        void SetArea(float area); 
     118        virtual void UpdateViewCellsStats(ViewCellsStatistics &vcStat); 
     119 
     120        /// Ray set description of the rays passing through this node. 
     121        PassingRaySet mPassingRays; 
     122 
     123        /// Rays piercing this view cell. 
     124        RayContainer mPiercingRays; 
     125 
     126protected: 
     127 
     128        /// the potentially visible objects 
     129        ObjectPvs mPvs; 
     130 
     131        float mVolume; 
     132        float mArea; 
     133}; 
     134 
     135/** 
     136        View cell belonging to a hierarchy. 
     137*/ 
     138template<typename T> 
     139class HierarchyViewCell: public ViewCell 
     140{ 
     141public: 
     142        HierarchyViewCell<T>(): mLeaves(0) {} 
     143        HierarchyViewCell<T>(Mesh *mesh): 
     144                ViewCell(mesh), mLeaves(0) {} 
     145 
     146        void UpdateViewCellsStats(ViewCellsStatistics &vcStat) 
     147        { 
     148                ViewCell::UpdateViewCellsStats(vcStat); 
     149 
     150                if ((int)mLeaves.size() > vcStat.maxLeaves) 
     151                        vcStat.maxLeaves = (int)mLeaves.size(); 
     152        } 
     153 
     154        /// Leaves of the hierarchy which are part of this view cell. 
     155        std::vector<T> mLeaves; 
     156}; 
     157 
     158 
     159typedef HierarchyViewCell<BspLeaf *> BspViewCell; 
     160typedef HierarchyViewCell<KdLeaf *> KdViewCell; 
     161typedef HierarchyViewCell<VspKdLeaf *> VspKdViewCell; 
     162 
     163 
    154164#endif 
Note: See TracChangeset for help on using the changeset viewer.