Changeset 470 for trunk/VUT


Ignore:
Timestamp:
12/19/05 02:50:17 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/GtpVisibilityPreprocessor/src
Files:
4 edited

Legend:

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

    r469 r470  
    8484typedef HierarchyViewCell<VspKdLeaf *> VspKdViewCell; 
    8585 
    86 /*class BspViewCell: public ViewCell 
    87 { 
    88 public: 
    89         BspViewCell(): mBspLeaves(0) {} 
    90         BspViewCell(Mesh *mesh):  
    91                 ViewCell(mesh), mBspLeaves(0) {} 
    9286 
    93         /// Leaves of the hierarchy which are part of this view cell. 
    94         std::vector<BspLeaf *> mBspLeaves; 
    95 }; 
    96 */ 
    97 /*class VspKdViewCell: public ViewCell 
    98 { 
    99 public: 
    100         VspKdViewCell(): mLeaves(0) {} 
    101         VspKdViewCell(Mesh *mesh):  
    102                 ViewCell(mesh), mLeaves(0) {} 
    103  
    104         /// Leaves of the hierarchy which are part of this view cell. 
    105         std::vector<VspKdLeaf *> mLeaves; 
    106 }; 
     87/** Statistics for a view cell partition. 
    10788*/ 
    10889class ViewCellsStatistics: public StatisticsBase 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r469 r470  
    1717mConstructionSamples(0), 
    1818mPostProcessSamples(0), 
    19 mVisualizationSamples(0) 
     19mVisualizationSamples(0), 
     20mTotalAreaValid(false), 
     21mTotalArea(0.0f) 
    2022{ 
    2123        // post processing stuff 
     
    277279} 
    278280 
     281float ViewCellsManager::GetVolume(ViewCell *viewCell) const 
     282{ 
     283        return viewCell->GetVolume(); 
     284} 
     285 
     286 
     287 
     288float ViewCellsManager::GetArea(ViewCell *viewCell) const 
     289{ 
     290        return 0.0f; 
     291} 
     292 
     293 
     294 
     295float ViewCellsManager::GetTotalArea() 
     296{ 
     297        // if already computed 
     298        if (mTotalAreaValid) 
     299                return mTotalArea; 
     300 
     301        mTotalArea = 0; 
     302        ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 
     303 
     304        for (it = mViewCells.begin(); it != it_end; ++ it) 
     305        mTotalArea += GetArea(*it); 
     306         
     307        mTotalAreaValid = true; 
     308 
     309        return mTotalArea; 
     310} 
     311 
    279312/**********************************************************************/ 
    280313/*                   BspViewCellsManager implementation               */ 
     
    349382} 
    350383 
    351  
    352 float BspViewCellsManager::GetProbability(ViewCell *viewCell) const 
     384float BspViewCellsManager::GetArea(ViewCell *viewCell) const 
    353385{ 
    354386        PolygonContainer geom; 
     
    358390         
    359391        const float area = Polygon3::GetArea(geom); 
    360         const float accArea = mBspTree->GetBoundingBox().SurfaceArea(); 
    361  
    362392        CLEAR_CONTAINER(geom); 
    363393 
    364         return area / accArea; 
    365 } 
    366  
     394        return area; 
     395} 
     396 
     397 
     398float BspViewCellsManager::GetProbability(ViewCell *viewCell) const 
     399{ 
     400        PolygonContainer geom; 
     401 
     402        // compute view cell area 
     403        mBspTree->ConstructGeometry(dynamic_cast<BspViewCell *>(viewCell), geom); 
     404         
     405        const float area = Polygon3::GetArea(geom); 
     406        const float viewspaceArea = GetTotalArea();// mBspTree->GetBoundingBox().SurfaceArea(); 
     407 
     408        CLEAR_CONTAINER(geom); 
     409 
     410        return area / viewspaceArea; 
     411} 
    367412 
    368413float BspViewCellsManager::GetRendercost(ViewCell *viewCell, float objRendercost) const 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h

    r469 r470  
    189189                                  VssRayContainer &savedRays) const; 
    190190 
     191  /** Returns total area of view cells. 
     192  */ 
     193  float GetTotalArea(); 
     194 
     195  /** Returns area of one view cell. 
     196  */ 
     197  float GetArea(ViewCell *viewCell) const; 
     198 
     199  /** Returns volume of view cells. 
     200  */ 
     201  float GetVolume(ViewCell *viewCell) const; 
     202 
    191203protected: 
    192204                 
     
    209221        int mMinPvs; 
    210222        int mMaxPvs; 
     223 
     224        float mTotalAreaValid; 
     225        float mTotalArea; 
    211226}; 
    212227 
     
    248263        float GetProbability(ViewCell *viewCell) const; 
    249264        float GetRendercost(ViewCell *viewCell, float objRendercost) const; 
     265 
     266        float GetArea(ViewCell *viewCell) const; 
    250267 
    251268protected: 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp

    r469 r470  
    21632163 
    21642164        //Debug << mMinViewCells << " " << mMaxCostRatio << endl; 
    2165  
    21662165        // use priority queue to merge leaves 
    21672166        while (!mergeQueue.empty() && 
Note: See TracChangeset for help on using the changeset viewer.