Ignore:
Timestamp:
09/12/05 18:24:44 (19 years ago)
Author:
mattausch
Message:

debugged bsp stuff

File:
1 edited

Legend:

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

    r263 r264  
    107107public: 
    108108        BspNode(); 
     109        virtual ~BspNode(); 
    109110        BspNode(BspInterior *parent); 
    110111 
     
    126127        void SetParent(BspInterior *parent); 
    127128 
     129        /** Returns pointer to polygons. 
     130        */ 
    128131        PolygonContainer *GetPolygons(); 
    129132 
    130         /** Adds polygons to node. 
    131         */ 
    132         void AddPolygons(PolygonContainer *polys); 
    133  
    134133protected: 
     134 
     135        /** Adds or discards polygons according to storePolys. 
     136        */ 
     137        void ProcessPolygons(PolygonContainer *polys, const bool storePolys); 
     138 
    135139 
    136140        /// parent of this node 
    137141        BspInterior *mParent; 
    138142 
    139         PolygonContainer mPolygons; 
     143        /// store polygons created during BSP splits 
     144        PolygonContainer *mPolygons; 
    140145}; 
    141146 
     
    165170                @param backPolys returns the polygons in the back of the split plane 
    166171                @param splits number of splits 
    167         */ 
    168         void SplitPolygons(PolygonContainer *polys, PolygonContainer *frontPolys,  
     172                @returns true if one or more polygons are inside of the split plane 
     173        */ 
     174        bool SplitPolygons(PolygonContainer *polys, PolygonContainer *frontPolys,  
    169175                                           PolygonContainer *backPolys, int &splits, bool storePolys = false); 
    170176 
     
    181187                @param storePolys if the polygons should be stored or discarded 
    182188        */ 
    183         void ProcessPolygon(Polygon3 *poly, bool storePolys); 
     189        void ProcessPolygon(Polygon3 *poly, const bool storePolys); 
    184190 
    185191        /// Splitting plane corresponding to this node 
     
    201207        BspLeaf(ViewCell *viewCell); 
    202208        BspLeaf(BspInterior *parent); 
     209        BspLeaf(BspInterior *parent, ViewCell *viewCell); 
    203210 
    204211        /** @return true since it is an interior node  
     
    231238                /// the current node 
    232239                BspNode *mNode; 
    233                 /// parent of current node 
    234                 BspInterior *mParent; 
    235240                /// polygonal data for splitting 
    236241                PolygonContainer *mPolygons; 
    237242                /// current depth 
    238243                int mDepth; 
    239                  
     244                /// if the node is an inside or outside node with respect to the parent plane 
     245                bool mIsInside; 
    240246                BspTraversalData() {} 
    241247                 
    242                 BspTraversalData(BspNode *node, BspInterior *parent, PolygonContainer *polys, const int depth):  
    243                 mNode(node), mParent(parent), mPolygons(polys), mDepth(depth) {} 
     248                BspTraversalData(BspNode *node, PolygonContainer *polys, const int depth, const bool inside):  
     249                mNode(node), mPolygons(polys), mDepth(depth), mIsInside(inside) {} 
    244250    }; 
    245251 
     
    341347        /** Subdivide leaf. 
    342348                @param leaf the leaf to be subdivided 
    343                 @param parent the parent node of this leaf 
    344349                @param polys the input polygons 
    345                 @param depth the current tree depth 
    346350                @param frontPolys the polygons of the front child node as a result from splitting 
    347351                @param backPolys the polygons of the back child node as a result from splitting 
    348         */ 
    349         BspNode *SubdivideNode(BspLeaf *leaf,  
    350                                                    BspInterior *parent,  
    351                                                    PolygonContainer *polys,  
    352                                                    const int depth,  
    353                                                    PolygonContainer *frontPolys,  
    354                                                    PolygonContainer *backPolys); 
     352                @param if the polygons are outside or inside with respect to the interior node plane 
     353                @returns the root of the subdivision 
     354        */ 
     355        BspInterior *SubdivideNode(BspLeaf *leaf,  
     356                                                           PolygonContainer *polys,  
     357                                                           PolygonContainer *frontPolys,  
     358                                                           PolygonContainer *backPolys, bool &inside); 
    355359 
    356360        /** Filters polygons down the tree. 
Note: See TracChangeset for help on using the changeset viewer.