Changeset 882


Ignore:
Timestamp:
05/03/06 10:28:20 (18 years ago)
Author:
mattausch
Message:

added new active view cell concept

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
9 edited

Legend:

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

    r863 r882  
    3434 
    3535// pvs penalty can be different from pvs size 
    36 inline float EvalPvsPenalty(const int pvs,  
    37                                                         const int lower, 
    38                                                         const int upper) 
     36inline static float EvalPvsPenalty(const int pvs,  
     37                                                                   const int lower, 
     38                                                                   const int upper) 
    3939{ 
    4040        // clamp to minmax values 
     
    26462646                        if (!onlyValid || node->TreeValid()) 
    26472647                        { 
    2648                                 ViewCell *leafVc = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 
     2648                                ViewCellLeaf *leafVc = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 
    26492649 
    26502650                                ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leafVc); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp

    r878 r882  
    629629int KdTree::CastLineSegment(const Vector3 &origin, 
    630630                                                        const Vector3 &termination, 
    631                                                         vector<ViewCell *> &viewcells) 
     631                                                        ViewCellContainer &viewcells) 
    632632{ 
    633633        int hits = 0; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r881 r882  
    3030int ViewCell::sMailId = 21843194198; 
    3131int ViewCell::sReservedMailboxes = 1; 
    32 int ViewCell::sLastUpdated = 0; 
     32 
    3333 
    3434//int upperPvsLimit = 120; 
     
    3939 
    4040// pvs penalty can be different from pvs size 
    41 inline static float EvalPvsPenalty(const int pvs, const int lower, const int upper) 
     41inline static float EvalPvsPenalty(const int pvs,  
     42                                                                   const int lower,  
     43                                                                   const int upper) 
    4244{ 
    4345        // clamp to minmax values 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp

    r873 r882  
    178178 
    179179 
    180 BspLeaf::BspLeaf(ViewCell *viewCell):  
     180BspLeaf::BspLeaf(ViewCellLeaf *viewCell):  
    181181mViewCell(viewCell) 
    182182{ 
     
    190190 
    191191 
    192 BspLeaf::BspLeaf(BspInterior *parent, ViewCell *viewCell):  
     192BspLeaf::BspLeaf(BspInterior *parent, ViewCellLeaf *viewCell):  
    193193BspNode(parent), mViewCell(viewCell), mPvs(NULL) 
    194194{ 
    195195} 
    196196 
    197 ViewCell *BspLeaf::GetViewCell() const 
     197ViewCellLeaf *BspLeaf::GetViewCell() const 
    198198{ 
    199199        return mViewCell; 
    200200} 
    201201 
    202 void BspLeaf::SetViewCell(ViewCell *viewCell) 
     202void BspLeaf::SetViewCell(ViewCellLeaf *viewCell) 
    203203{ 
    204204        mViewCell = viewCell; 
     
    482482 
    483483 
    484 void BspTree::InsertViewCell(ViewCell *viewCell) 
     484void BspTree::InsertViewCell(ViewCellLeaf *viewCell) 
    485485{ 
    486486        PolygonContainer *polys = new PolygonContainer(); 
     
    540540                                 
    541541                                // extract view cells associated with the split polygons 
    542                                 ViewCell *frontViewCell = GetOrCreateOutOfBoundsCell(); 
    543                                 ViewCell *backViewCell = GetOrCreateOutOfBoundsCell(); 
     542                                ViewCellLeaf *frontViewCell = GetOrCreateOutOfBoundsCell(); 
     543                                ViewCellLeaf *backViewCell = GetOrCreateOutOfBoundsCell(); 
    544544                         
    545545                                BspTraversalData frontData(interior->GetFront(),  
     
    10971097                if (DotProd((*it)->GetNormal(), splitPlane.mNormal) > 0) 
    10981098                { 
    1099                         backData.mViewCell = dynamic_cast<ViewCell *>((*it)->mParent); 
     1099                        backData.mViewCell = dynamic_cast<ViewCellLeaf *>((*it)->mParent); 
    11001100                        foundBack = true; 
    11011101                } 
    11021102                else 
    11031103                { 
    1104                         frontData.mViewCell = dynamic_cast<ViewCell *>((*it)->mParent); 
     1104                        frontData.mViewCell = dynamic_cast<ViewCellLeaf *>((*it)->mParent); 
    11051105                        foundFront = true; 
    11061106                } 
     
    20822082int BspTree::CastLineSegment(const Vector3 &origin, 
    20832083                                                         const Vector3 &termination, 
    2084                                                          vector<ViewCell *> &viewcells) 
     2084                                                         ViewCellContainer &viewcells) 
    20852085{ 
    20862086        int hits = 0; 
     
    21972197                if (node->IsLeaf())  
    21982198                { 
    2199                         ViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->mViewCell; 
     2199                        ViewCellLeaf *viewCell = dynamic_cast<BspLeaf *>(node)->mViewCell; 
    22002200 
    22012201                        if (!viewCell->Mailed())  
     
    26292629    BoundedRayContainer::const_iterator it, it_end = rays.end(); 
    26302630 
    2631         ViewCell *vc = leaf->GetViewCell(); 
     2631        ViewCellLeaf *vc = leaf->GetViewCell(); 
    26322632 
    26332633        // add contributions from samples to the PVS 
     
    32733273  nodeStack.push(mRoot); 
    32743274   
    3275   ViewCell *viewcell = NULL; 
     3275  ViewCellLeaf *viewcell = NULL; 
    32763276   
    32773277  while (!nodeStack.empty())  { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h

    r881 r882  
    1212namespace GtpVisibilityPreprocessor { 
    1313 
    14 class ViewCell; 
     14class ViewCellLeaf; 
    1515//class BspViewCell; 
    1616class Plane3; 
     
    2323class ViewCellsManager; 
    2424class ViewCellsTree; 
     25class ViewCell; 
    2526class ViewCellLeaf; 
    2627 
     
    374375public: 
    375376        BspLeaf(); 
    376         BspLeaf(ViewCell *viewCell); 
     377        BspLeaf(ViewCellLeaf *viewCell); 
    377378        BspLeaf(BspInterior *parent); 
    378         BspLeaf(BspInterior *parent, ViewCell *viewCell); 
     379        BspLeaf(BspInterior *parent, ViewCellLeaf *viewCell); 
    379380 
    380381        ~BspLeaf(); 
     
    386387        /** Returns pointer of view cell. 
    387388        */ 
    388         ViewCell *GetViewCell() const; 
     389        ViewCellLeaf *GetViewCell() const; 
    389390 
    390391        /** Sets pointer to view cell. 
    391392        */ 
    392         void SetViewCell(ViewCell *viewCell); 
     393        void SetViewCell(ViewCellLeaf *viewCell); 
    393394 
    394395        /// Rays piercing this leaf. 
     
    404405         
    405406        /// if NULL this does not correspond to feasible viewcell 
    406         ViewCell *mViewCell; 
     407        ViewCellLeaf *mViewCell; 
    407408}; 
    408409 
     
    426427                int mDepth; 
    427428                /// the view cell associated with this subdivsion 
    428                 ViewCell *mViewCell; 
     429                ViewCellLeaf *mViewCell; 
    429430                /// rays piercing this node 
    430431                BoundedRayContainer *mRays; 
     
    459460                                                 PolygonContainer *polys,  
    460461                                                 const int depth,  
    461                                                  ViewCell *viewCell, 
     462                                                 ViewCellLeaf *viewCell, 
    462463                                                 BoundedRayContainer *rays, 
    463464                                                 int pvs, 
     
    598599        /** Construct geometry of view cell. 
    599600        */ 
    600         void ConstructGeometry(ViewCell *vc, BspNodeGeometry &geom) const; 
     601        void ConstructGeometry(ViewCell* vc, BspNodeGeometry &geom) const; 
    601602 
    602603                         
     
    721722                (i.e., possibly more than one leaf). 
    722723        */ 
    723         void InsertViewCell(ViewCell *viewCell); 
     724        void InsertViewCell(ViewCellLeaf *viewCell); 
    724725        /** Inserts polygons down the tree. The polygons are filtered until a leaf is reached, 
    725726                then further subdivided. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r881 r882  
    18721872void ViewCellsManager::SetViewCellsActive() 
    18731873{ 
    1874         ++ ViewCell::sLastUpdated; 
    1875  
     1874        // collect leaf view cells and set the pointers to the currently 
     1875        // active view cells 
    18761876        ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 
    18771877        for (it = mViewCells.begin(); it != it_end; ++ it) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r879 r882  
    3434 
    3535// pvs penalty can be different from pvs size 
    36 inline float EvalPvsPenalty(const int pvs,  
    37                                                         const int lower, 
    38                                                         const int upper) 
     36inline static float EvalPvsPenalty(const int pvs,  
     37                                                                   const int lower, 
     38                                                                   const int upper) 
    3939{ 
    4040        // clamp to minmax values 
     
    269269 
    270270int VspBspTree::AddToPolygonSoup(const ViewCellContainer &viewCells, 
    271                                                           PolygonContainer &polys, 
    272                                                           int maxObjects) 
     271                                                                PolygonContainer &polys, 
     272                                                                int maxObjects) 
    273273{ 
    274274        int limit = (maxObjects > 0) ? 
     
    11471147  RayInfoContainer::const_iterator it, it_end = rays.end(); 
    11481148   
    1149   ViewCell *vc = leaf->GetViewCell(); 
     1149  ViewCellLeaf *vc = leaf->GetViewCell(); 
    11501150   
    11511151  // add contributions from samples to the PVS 
     
    25892589                        if (!onlyValid || node->TreeValid()) 
    25902590                        { 
    2591                                 ViewCell *leafVc = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 
     2591                                ViewCellLeaf *leafVc = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 
    25922592 
    25932593                                ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leafVc); 
     
    32603260int VspBspTree::CastLineSegment(const Vector3 &origin, 
    32613261                                                                const Vector3 &termination, 
    3262                                                                 vector<ViewCell *> &viewcells) 
     3262                                                                ViewCellContainer &viewcells) 
    32633263{ 
    32643264        int hits = 0; 
     
    37553755        nodeStack.push(mRoot); 
    37563756   
    3757         ViewCell *viewcell = NULL; 
     3757        ViewCellLeaf *viewcell = NULL; 
    37583758   
    37593759        while (!nodeStack.empty())   
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h

    r879 r882  
    1313namespace GtpVisibilityPreprocessor { 
    1414 
    15 class ViewCell; 
     15class ViewCellLeaf; 
    1616//class BspViewCell; 
    1717class Plane3; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.cpp

    r863 r882  
    20692069int VspKdTree::CastLineSegment(const Vector3 &origin, 
    20702070                                                           const Vector3 &termination, 
    2071                                                            vector<ViewCell *> &viewcells) 
     2071                                                           ViewCellContainer &viewcells) 
    20722072{ 
    20732073        int hits = 0; 
Note: See TracChangeset for help on using the changeset viewer.