Ignore:
Timestamp:
02/04/06 12:46:14 (18 years ago)
Author:
mattausch
Message:

updated vspkdtree for regular sudbivision

File:
1 edited

Legend:

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

    r575 r587  
    1919class Ray; 
    2020class ViewCellsStatistics; 
     21class ViewCellsManager; 
     22 
     23 
    2124 
    2225class BspNodeGeometry 
     
    374377                /// rays piercing this node 
    375378                BoundedRayContainer *mRays; 
    376                 /// area of current node 
    377                 float mArea; 
     379                /// probability of current node 
     380                float mProbability; 
    378381                /// geometry of node as induced by planes 
    379382                BspNodeGeometry *mGeometry; 
     
    397400                mRays(NULL), 
    398401                mPvs(0), 
    399                 mArea(0.0), 
     402                mProbability(0.0), 
    400403                mGeometry(NULL) 
    401404                {} 
     
    407410                                                 BoundedRayContainer *rays, 
    408411                                                 int pvs, 
    409                                                  float area, 
     412                                                 float p, 
    410413                                                 BspNodeGeometry *cell):  
    411414                mNode(node),  
     
    415418                mRays(rays), 
    416419                mPvs(pvs), 
    417                 mArea(area), 
     420                mProbability(p), 
    418421                mGeometry(cell) 
    419422                {} 
     423 
     424 
     425                float GetCost() const 
     426                { 
     427#if 0 
     428                        return mPvs * mProbability; 
     429#endif 
     430#if 1 
     431                        return mProbability; 
     432#endif 
     433#if 0 
     434                        return (float)mPvs; 
     435#endif 
     436#if 0 
     437                        return (float)mRays->size(); 
     438#endif 
     439                } 
     440                 
     441                friend bool operator<(const BspTraversalData &a, const BspTraversalData &b) 
     442                { 
     443                        return a.GetCost() < b.GetCost(); 
     444                } 
    420445    }; 
    421446         
    422         typedef std::stack<BspTraversalData> BspTraversalStack; 
    423          
     447        //typedef std::stack<BspTraversalData> BspTraversalStack; 
     448        typedef std::priority_queue<BspTraversalData> BspTraversalStack; 
     449 
    424450        /** Default constructor reading the environment file and  
    425451                creating an empty tree. 
     
    451477 
    452478        void Construct(const ObjectContainer &objects, 
    453                                    const RayContainer &sampleRays); 
     479                                   const RayContainer &sampleRays, 
     480                                   AxisAlignedBox3 *forcedBoundingBox); 
    454481 
    455482        /** Constructs the tree from a given set of rays. 
     
    458485                created in the leafs and stored in the conatainer 
    459486        */ 
    460         void Construct(const RayContainer &sampleRays); 
     487        void Construct(const RayContainer &sampleRays, 
     488                                   AxisAlignedBox3 *forcedBoundingBox); 
    461489 
    462490        /** Returns list of BSP leaves. 
     
    513541        /** Construct geometry of view cell. 
    514542        */ 
    515         void ConstructGeometry(BspViewCell *vc, BspNodeGeometry &geom) const; 
     543        void ConstructGeometry(ViewCell *vc, BspNodeGeometry &geom) const; 
     544 
     545                         
     546        /** Sets pointer to view cells manager. 
     547        */ 
     548        void SetViewCellsManager(ViewCellsManager *vcm); 
    516549 
    517550        /** Returns random leaf of BSP tree. 
     
    533566        float GetEpsilon() const; 
    534567 
     568        int CollectMergeCandidates(const vector<BspLeaf *> leaves, 
     569                                                           vector<MergeCandidate> &candidates); 
     570 
     571        int CollectMergeCandidates(const VssRayContainer &rays, 
     572                                                   vector<MergeCandidate> &candidates); 
    535573protected: 
    536574 
     
    608646                                                 const BoundedRayContainer &rays, 
    609647                                                 const int pvs, 
    610                                                  const float area, 
     648                                                 const float probability, 
    611649                                                 const BspNodeGeometry &cell) const; 
    612650 
     
    681719        int AddToPolygonSoup(const ObjectContainer &objects,  
    682720                                                 PolygonContainer &polys,  
    683                                                  int maxObjects = 0); 
     721                                                 int maxObjects = 0, 
     722                                                 bool addToBbox = true); 
    684723 
    685724        /** Extracts the meshes of the view cells and and adds them to polygons. 
     
    809848                                  int &sampleContributions,      
    810849                                  int &contributingSamples); 
     850 
     851 
     852 
    811853 
    812854        /// Pointer to the root of the tree. 
     
    847889        int mTermMaxDepth; 
    848890        /// mininum area 
    849         float mTermMinArea; 
     891        float mTermMinProbability; 
    850892        /// mininum PVS 
    851893        int mTermMinPvs; 
     
    893935        bool mUseAreaForPvs; 
    894936 
     937        int mMaxViewCells; 
     938 
    895939        /// epsilon where two points are still considered equal 
    896940        float mEpsilon; 
     941 
     942        ViewCellsManager *mViewCellsManager; 
     943 
    897944 
    898945private: 
Note: See TracChangeset for help on using the changeset viewer.