Ignore:
Timestamp:
01/17/06 23:28:10 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r544 r547  
    5252                /// rays piercing this node 
    5353                RayInfoContainer *mRays; 
    54                 /// area of current node 
    55                 float mArea; 
     54                /// the probability that this node contains view point 
     55                float mProbability; 
    5656                /// geometry of node as induced by planes 
    5757                BspNodeGeometry *mGeometry; 
     
    7777                mRays(NULL), 
    7878                mPvs(0), 
    79                 mArea(0.0), 
     79                mProbability(0.0), 
    8080                mGeometry(NULL), 
    8181                mMaxCostMisses(0) 
     
    8787                                                        const int depth,  
    8888                                                        RayInfoContainer *rays, 
    89                                                         int pvs, 
    90                                                         float area, 
     89                                                        const int pvs, 
     90                                                        const float p, 
    9191                                                        BspNodeGeometry *geom):  
    9292                mNode(node),  
     
    9595                mRays(rays), 
    9696                mPvs(pvs), 
    97                 mArea(area), 
     97                mProbability(p), 
    9898                mGeometry(geom), 
    9999                mMaxCostMisses(0) 
     
    109109                mRays(rays), 
    110110                mPvs(0), 
    111                 mArea(0), 
     111                mProbability(0), 
    112112                mGeometry(geom), 
    113113                mMaxCostMisses(0) 
     
    119119                { 
    120120#if 1 
    121                         return mPvs * mArea; 
     121                        return mPvs * mProbability; 
    122122#endif 
    123123#if 0 
     
    128128#endif 
    129129#if 0 
    130                         return mArea * (float)mRays->size(); 
     130                        return mProbabiliy * (float)mRays->size(); 
    131131#endif 
    132132                } 
     
    190190                @param viewCells returns the view cells  
    191191        */ 
    192         void CollectViewCells(ViewCellContainer &viewCells) const; 
     192        void CollectViewCells(ViewCellContainer &viewCells, bool onlyValid) const; 
    193193 
    194194        /** A ray is cast possible intersecting the tree. 
     
    250250        /** Merges view cells according to some cost heuristics. 
    251251        */ 
    252         int MergeViewCells(const VssRayContainer &rays); 
     252        int MergeViewCells(const VssRayContainer &rays, const ObjectContainer &objects); 
    253253         
    254254        /** Refines view cells using shuffling, i.e., border leaves  
     
    298298 
    299299        void CollectViewCells(BspNode *root,  
     300                                                  bool onlyValid,  
    300301                                                  ViewCellContainer &viewCells, 
    301302                                                  bool onlyUnmailed = false) const; 
    302303 
    303         /** returns maximal valid pvs. 
    304         */ 
    305         int GetMaxPvs() { return mMaxPvs;} 
    306  
     304         
    307305        /** Checks validy of view cells. 
    308306                if not valid, sets regions invalid and deletes view cell. 
     
    339337        }; 
    340338 
     339        /** faster evaluation of split plane cost for kd axis aligned cells. 
     340        */ 
    341341        float EvalAxisAlignedSplitCost(const VspBspTraversalData &data, 
    342342                                                                   const AxisAlignedBox3 &box, 
    343343                                                                   const int axis, 
    344                                                                    const float &position) const; 
     344                                                                   const float &position, 
     345                                                                   float &pFront, 
     346                                                                   float &pBack) const; 
    345347 
    346348        /** Returns view cell corresponding to  
     
    409411                                                 BspNodeGeometry &geomFront, 
    410412                                                 BspNodeGeometry &geomBack, 
    411                                                  float &areaFront, 
    412                                                  float &areaBack) const; 
     413                                                 float &pFront, 
     414                                                 float &pBack) const; 
    413415 
    414416        /** Subdivide leaf. 
     
    464466                                                                 BspNodeGeometry **frontGeom, 
    465467                                                                 BspNodeGeometry **backGeom, 
    466                                                                  float &frontArea, 
    467                                                                  float &backArea, 
    468                                                                  bool useKdSplit); 
     468                                                                 float &pFront, 
     469                                                                 float &pBack, 
     470                                                                 const bool useKdSplit); 
    469471 
    470472        /** Sorts split candidates for surface area heuristics for axis aligned splits. 
     
    482484                                                                  const int &axis, 
    483485                                                                  float &position); 
    484  
    485         /** Evaluates cost ratio for axis aligned splits. 
    486         */ 
    487         /*float EvalCostRatio(const VspBspTraversalData &tData, 
    488                                                 const AxisAlignedBox3 &box, 
    489                                                 const int axis, 
    490                                                 const float position, 
    491                                                 int &raysBack, 
    492                                                 int &raysFront, 
    493                                                 int &pvsBack, 
    494                                                 int &pvsFront);*/ 
    495486 
    496487        /** Selects an axis aligned split plane. 
     
    606597                                         BspViewCell *vc2) const; 
    607598 
    608         /** 
    609                 Checks if this traversal data corresponds to 
    610                 a valid view space region. 
    611         */ 
    612         bool CheckValid(const VspBspTraversalData &data) const; 
    613  
     599         
    614600        /** Propagates valid flag up the tree. 
    615601        */ 
     
    646632        /// maximal possible depth 
    647633        int mTermMaxDepth; 
    648         /// mininum area 
    649         float mTermMinArea; 
     634        /// mininum probability 
     635        float mTermMinProbability; 
    650636        /// mininum PVS 
    651637        int mTermMinPvs; 
     
    654640        /// minimal accumulated ray length 
    655641        float mTermMinAccRayLength; 
     642 
     643        ofstream mStats; 
    656644 
    657645        //-- termination criteria for axis aligned split 
     
    686674        float mPvsFactor; 
    687675 
    688         /// if area or accumulated ray lenght should be used for PVS heuristics 
    689         bool mPvsUseArea; 
     676        /// if area or volume should be used for PVS heuristics 
     677        bool mUseAreaForPvs; 
    690678        /// tolerance for polygon split 
    691679        float mEpsilon; 
     
    719707        bool mUseRaysForMerge; 
    720708         
    721         /// maximal allowed pvs so that view cell is valid 
    722         int mMaxPvs; 
    723  
    724         float mMaxPvsRatio; 
    725  
    726709        /// View cell corresponding to the space outside the valid view space 
    727710        BspViewCell *mOutOfBoundsCell; 
    728  
    729         /// if invalid space should be shown 
    730         bool mShowInvalidSpace; 
    731711 
    732712        int mCurrentViewCellsId; 
     
    797777        /// overall cost used to normalize cost ratio 
    798778        static float sOverallCost; 
     779        // if area or volume should be used for the merge heuristics 
     780        static bool sUseArea; 
    799781 
    800782        /** Evaluates the merge costs of the leaves. 
Note: See TracChangeset for help on using the changeset viewer.