Changeset 471 for trunk


Ignore:
Timestamp:
12/19/05 13:07:21 (19 years ago)
Author:
mattausch
Message:

fixed rendersimulator

Location:
trunk/VUT/GtpVisibilityPreprocessor/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.cpp

    r469 r471  
    884884      KdLeaf *leaf = (KdLeaf *)node; 
    885885          // kdtree used as view cell container => create view cell 
    886           leaf->mViewCell = new KdViewCell(); 
    887       vc.push_back(leaf->mViewCell); 
     886          KdViewCell *viewCell = new KdViewCell(); 
     887          leaf->mViewCell = viewCell; 
     888          // push back pointer to this leaf 
     889          viewCell->mLeaves.push_back(leaf); 
     890      vc.push_back(viewCell); 
    888891    } else { 
    889892      KdInterior *interior = (KdInterior *)node; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h

    r470 r471  
    2424public: 
    2525        ViewCell(); 
    26          
     26 
    2727        /** Constructor taking a mesh representing the shape of the viewcell. 
    2828        */ 
     
    3232        */ 
    3333        virtual ~ViewCell() {} 
    34         /** Returns Pvs.  
     34        /** Returns Pvs. 
    3535        */ 
    3636        const ObjectPvs &GetPvs() const; 
     
    3838 
    3939        int Type() const; 
    40          
     40 
    4141        /** Adds a passing ray to the passing ray container. 
    4242        */ 
    43         void AddPassingRay(const Ray &ray, const int contributions);     
     43        void AddPassingRay(const Ray &ray, const int contributions); 
    4444 
    4545        /** Returns volume of the view cell. 
     
    5151        void SetVolume(float size); 
    5252 
    53         /// Ray set description of the rays passing through this node.   
     53        /// Ray set description of the rays passing through this node. 
    5454        PassingRaySet mPassingRays; 
    5555 
     
    7373public: 
    7474        HierarchyViewCell<T>(): mLeaves(0) {} 
    75         HierarchyViewCell<T>(Mesh *mesh):  
     75        HierarchyViewCell<T>(Mesh *mesh): 
    7676                ViewCell(mesh), mLeaves(0) {} 
    7777 
     
    8787/** Statistics for a view cell partition. 
    8888*/ 
     89 
    8990class ViewCellsStatistics: public StatisticsBase 
    9091{ 
     
    9697        /// size of the PVS 
    9798        int pvs; 
    98    
     99 
    99100        /// largest PVS of all view cells 
    100101        int maxPvs; 
     
    109110        int leaves; 
    110111 
    111         /// largest number of leaves covered by one view cell   
     112        /// largest number of leaves covered by one view cell 
    112113        int maxLeaves; 
    113114 
    114115    // Constructor 
    115         ViewCellsStatistics()  
     116        ViewCellsStatistics() 
    116117        { 
    117118                Reset(); 
     
    120121        double AvgLeaves() const {return (double)leaves / (double)viewCells;}; 
    121122        double AvgPvs() const {return (double)pvs / (double)viewCells;}; 
    122    
    123         void Reset()  
     123 
     124        void Reset() 
    124125        { 
    125                 viewCells = 0;   
    126                 pvs = 0;   
     126                viewCells = 0; 
     127                pvs = 0; 
    127128                maxPvs = 0; 
    128129 
     
    135136        void Print(ostream &app) const; 
    136137 
    137         friend ostream &operator<<(ostream &s, const ViewCellsStatistics &stat)  
     138        friend ostream &operator<<(ostream &s, const ViewCellsStatistics &stat) 
    138139        { 
    139140                stat.Print(s); 
    140141                return s; 
    141         }   
     142        } 
    142143}; 
    143144 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r470 r471  
    396396 
    397397 
    398 float 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; 
     398float BspViewCellsManager::GetProbability(ViewCell *viewCell) 
     399{ 
     400        // compute view cell area as subsititute for probability 
     401        return GetArea(viewCell) / mBspTree->GetBoundingBox().SurfaceArea(); 
     402        //return GetArea(viewCell) / GetTotalArea(); 
    411403} 
    412404 
     
    898890} 
    899891 
    900 float KdViewCellsManager::GetProbability(ViewCell *viewCell) const 
    901 { 
    902         KdViewCell *vc = dynamic_cast<KdViewCell *>(viewCell); 
    903  
    904         AxisAlignedBox3 box = mKdTree->GetBox(vc->mLeaves[0]); 
    905  
    906         return box.SurfaceArea(); 
     892float KdViewCellsManager::GetProbability(ViewCell *viewCell) 
     893{ 
     894        // compute view cell area as subsititute for probability 
     895        AxisAlignedBox3 box = mKdTree->GetBox(mKdTree->GetRoot()); 
     896 
     897        return GetArea(viewCell) / box.SurfaceArea(); 
     898        //return GetArea(viewCell) / GetTotalArea(); 
    907899} 
    908900 
     
    11611153} 
    11621154 
    1163 float VspKdViewCellsManager::GetProbability(ViewCell *viewCell) const 
    1164 { 
    1165 /*      AxisAlignedBox3 box = mKdTree->GetBox(*it); 
    1166                          
     1155float VspKdViewCellsManager::GetProbability(ViewCell *viewCell) 
     1156{ 
    11671157        // volume or area substitutes for view point probability 
    1168         if (0) 
    1169                 return box.GetVolume();  
    1170         else 
    1171                 return box.SurfaceArea(); 
    1172 */ 
    1173         return dynamic_cast<VspKdViewCell *>(viewCell)->GetVolume(); 
     1158        AxisAlignedBox3 box = mVspKdTree->GetBBox(mVspKdTree->GetRoot()); 
     1159 
     1160        return GetArea(viewCell) / box.SurfaceArea(); 
     1161        //return GetArea(viewCell) / GetTotalArea(); 
    11741162} 
    11751163 
     
    13891377} 
    13901378 
    1391 float VspBspViewCellsManager::GetProbability(ViewCell *viewCell) const 
    1392 { 
    1393         PolygonContainer geom; 
    1394  
    1395         // compute view cell area 
    1396         mVspBspTree->ConstructGeometry(dynamic_cast<BspViewCell *>(viewCell), geom); 
    1397          
    1398         const float area = Polygon3::GetArea(geom); 
    1399         const float accArea = mVspBspTree->GetBoundingBox().SurfaceArea(); 
    1400  
    1401         CLEAR_CONTAINER(geom); 
    1402  
    1403         return area / accArea; 
     1379float VspBspViewCellsManager::GetProbability(ViewCell *viewCell) 
     1380{ 
     1381        return GetArea(viewCell) / mVspBspTree->GetBoundingBox().SurfaceArea(); 
     1382        //return GetArea(viewCell) / GetTotalArea(); 
    14041383} 
    14051384 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h

    r470 r471  
    172172  /** Returns probability that view point lies in one view cell. 
    173173  */ 
    174   virtual float GetProbability(ViewCell *viewCell) const = 0; 
     174  virtual float GetProbability(ViewCell *viewCell) = 0; 
    175175 
    176176  /** Returns render cost of a single view cell given the render cost of an object. 
     
    261261                                                ViewCellContainer &viewcells); 
    262262         
    263         float GetProbability(ViewCell *viewCell) const; 
     263        float GetProbability(ViewCell *viewCell); 
    264264        float GetRendercost(ViewCell *viewCell, float objRendercost) const; 
    265265 
     
    327327        virtual void PrintStatistics(ostream &s) const; 
    328328 
    329         float GetProbability(ViewCell *viewCell) const; 
     329        float GetProbability(ViewCell *viewCell); 
    330330        float GetRendercost(ViewCell *viewCell, float objRendercost) const; 
    331331 
     
    377377                                                ViewCellContainer &viewcells); 
    378378 
    379         float GetProbability(ViewCell *viewCell) const; 
     379        float GetProbability(ViewCell *viewCell); 
    380380        float GetRendercost(ViewCell *viewCell, float objRendercost) const; 
    381381 
     
    421421                                                ViewCellContainer &viewcells); 
    422422 
    423         float GetProbability(ViewCell *viewCell) const; 
     423        float GetProbability(ViewCell *viewCell); 
    424424        float GetRendercost(ViewCell *viewCell, float objRendercost) const; 
    425425 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp

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