Ignore:
Timestamp:
06/09/06 01:26:46 (18 years ago)
Author:
mattausch
Message:

started viewspace-objectspace subdivision
removed memory leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h

    r1004 r1006  
    158158        struct VspBspSplitCandidate 
    159159        {   
    160                 /// the current node 
     160                /// the current split plane 
    161161                Plane3 mSplitPlane; 
    162162                /// split axis of this plane (0, 1, 2, or 3 if non-axis-aligned) 
     
    467467                @param plane returns the split plane 
    468468                @param leaf the leaf to be split 
    469                 @param polys the polygon list on which the split decition is based 
    470                 @param rays ray container on which selection may be based 
     469                @param data the traversal data holding the polygons and rays which the split decision is based 
     470                @param frontData the front node traversal data (which may be updated to avoid repcomputations 
     471                @param backData the front node traversal data (which may be updated to avoid repcomputations 
     472                @param splitAxis 0 - 2 if axis aligned split, 3 if polygon-aligned split 
     473 
    471474                @note the polygons can be reordered in the process 
     475                 
    472476                @returns true if the cost of the split is under maxCostRatio 
    473477 
     
    567571                                                                  float &position); 
    568572 
    569         /** Selects an axis aligned split plane. 
    570                 @Returns true if split is valied 
    571         */ 
    572         bool SelectAxisAlignedPlane(Plane3 &plane, const PolygonContainer &polys) const; 
    573  
    574573        /** Subdivides the rays into front and back rays according to the split plane. 
    575574                 
     
    649648                                  int &contributingSamples); 
    650649 
    651  
    652  
    653  
    654  
    655650         
    656651        /** Take 3 ray endpoints, where two are minimum and one a maximum 
     
    701696        /** Returns estimated memory usage of tree. 
    702697        */ 
     698        float GetMemUsage() const; 
    703699        //float GetMemUsage(const VspBspTraversalQueue &tstack) const; 
    704         float GetMemUsage() const; 
    705  
    706  
    707  
     700 
     701 
     702 
     703        /////////////////////////////////////////////////////////// 
     704protected: 
     705         
    708706        /// Pointer to the root of the tree 
    709707        BspNode *mRoot; 
    710                  
     708         
     709        /// the pointer to the view cells manager 
     710        ViewCellsManager *mViewCellsManager; 
     711         
     712        /// View cell corresponding to the space outside the valid view space 
     713        BspViewCell *mOutOfBoundsCell; 
     714 
     715        /// the bsp tree statistics 
    711716        BspTreeStatistics mBspStats; 
    712717 
    713         /// Strategies for choosing next split plane. 
    714         enum {NO_STRATEGY = 0, 
    715                   RANDOM_POLYGON = 1,  
    716                   AXIS_ALIGNED = 2, 
    717                   LEAST_RAY_SPLITS = 256, 
    718                   BALANCED_RAYS = 512, 
    719                   PVS = 1024 
    720                 }; 
     718        /// sorted split candidates used for sweep-heuristics 
     719        vector<SortableEntry> *mSplitCandidates; 
    721720 
    722721        /// box around the whole view domain 
    723722        AxisAlignedBox3 mBox; 
    724723 
    725         bool mUseCostHeuristics; 
     724         
     725        //-- termination critera 
    726726 
    727727        /// minimal number of rays before subdivision termination 
     
    737737        /// minimal accumulated ray length 
    738738        float mTermMinAccRayLength; 
    739  
    740         //HACK 
    741         int mTermMinPolygons; 
     739        /// maximal acceptable cost ratio 
     740        float mTermMaxCostRatio; 
     741        /// tolerance value indicating how often the max cost ratio can be failed 
     742        int mTermMissTolerance; 
     743 
     744 
     745        //-- termination criteria for 
     746        //-- hybrid stategy where only axis aligned split are used until  
     747        //-- a certain point and then also polygon aligned split are taken 
     748          
     749        /// minimal number of rays where axis aligned split is taken 
     750        int mTermMinRaysForAxisAligned; 
     751        /// max ray contribution 
     752        float mTermMaxRayContriForAxisAligned; 
     753        /// weight for heuristics evaluation 
     754        float mAxisAlignedCtDivCi; 
     755        /// spezifies the split border of the axis aligned split 
     756        float mAxisAlignedSplitBorder; 
     757 
     758 
     759        //-- global terminatino criteria 
    742760 
    743761        float mTermMinGlobalCostRatio; 
    744762        int mTermGlobalCostMissTolerance; 
    745  
    746763        int mGlobalCostMisses; 
    747764 
    748         bool mUseSplitCostQueue; 
    749         //-- termination criteria for axis aligned split 
    750  
    751         /// minimal number of rays for axis aligned split 
    752         int mTermMinRaysForAxisAligned; 
    753         // max ray contribution 
    754         float mTermMaxRayContriForAxisAligned; 
    755  
    756         /// strategy to get the best split plane 
    757         int mSplitPlaneStrategy; 
     765        /// maximal number of view cells 
     766        int mMaxViewCells; 
     767        /// maximal tree memory 
     768        float mMaxMemory; 
     769        /// the tree is out of memory 
     770        bool mOutOfMemory; 
     771 
     772 
    758773        /// number of candidates evaluated for the next split plane 
    759774        int mMaxPolyCandidates; 
    760775        /// number of candidates for split planes evaluated using the rays 
    761776        int mMaxRayCandidates; 
     777         
     778 
     779 
     780        //-- axis aligned split criteria 
     781 
     782        /// if only driving axis should be used for choosing the axis-aligned split 
     783        bool mOnlyDrivingAxis; 
     784        /// if heuristics should be used to place the split plane of an axis-aligned split 
     785        bool mUseCostHeuristics; 
     786        /// if driving axis should taken if max cost is exceeded for 
     787        /// all evaluated axis aligned split plane candidates 
     788        bool mUseDrivingAxisIfMaxCostViolated; 
     789        /// minimal relative position where the split axis can be placed 
     790        float mMinBand; 
     791        /// maximal relative position where the split axis can be placed 
     792        float mMaxBand; 
    762793        /// balancing factor for PVS criterium 
    763794        float mCtDivCi; 
    764  
    765         bool mUseDrivingAxisForMaxCost; 
    766         //-- axis aligned split criteria 
    767         float mAxisAlignedCtDivCi; 
    768         /// spezifies the split border of the axis aligned split 
    769         float mAxisAlignedSplitBorder; 
    770  
    771         /// maximal acceptable cost ratio 
    772         float mTermMaxCostRatio; 
    773         /// tolerance value indicating how often the max cost ratio can be failed 
    774         int mTermMissTolerance; 
     795        /// if random split axis should be used 
     796        bool mUseRandomAxis; 
     797        /// if vsp bsp tree should simulate octree 
     798        bool mCirculatingAxis; 
     799 
     800 
     801         
     802        /// priority queue strategy 
     803        enum {BREATH_FIRST, DEPTH_FIRST, COST_BASED}; 
     804        /// if we should use breath first priority for the splits 
     805        int mNodePriorityQueueType; 
     806        /// if split cost queue should be used to compute next best split 
     807        bool mUseSplitCostQueue; 
     808         
     809 
     810         
     811        /// Strategies for choosing next split plane. 
     812        enum {NO_STRATEGY = 0, 
     813                  RANDOM_POLYGON = 1,  
     814                  AXIS_ALIGNED = 2, 
     815                  LEAST_RAY_SPLITS = 256, 
     816                  BALANCED_RAYS = 512, 
     817                  PVS = 1024 
     818                }; 
     819 
     820        /// strategy to get the best split plane 
     821        int mSplitPlaneStrategy; 
    775822 
    776823        //-- factors guiding the split plane heuristics 
     824 
    777825        float mLeastRaySplitsFactor; 
    778826        float mBalancedRaysFactor; 
    779827        float mPvsFactor; 
     828 
    780829 
    781830        /// if area or volume should be used for PVS heuristics 
     
    787836        /// normalizes different bsp split plane criteria 
    788837        float mCostNormalizer; 
    789         /// maximal number of view cells 
    790         int mMaxViewCells; 
    791          
    792         ofstream  mSubdivisionStats; 
    793  
    794838        // if rays should be stored in leaves 
    795839        bool mStoreRays; 
    796          
    797         /// if only driving axis should be used for split 
    798         bool mOnlyDrivingAxis; 
    799  
    800         ViewCellsManager *mViewCellsManager; 
    801  
    802         vector<SortableEntry> *mSplitCandidates; 
    803  
    804          
     840        /// render cost weight between expected value and variance 
    805841        float mRenderCostWeight; 
    806         /// View cell corresponding to the space outside the valid view space 
    807         BspViewCell *mOutOfBoundsCell; 
    808  
    809         /// maximal tree memory 
    810         float mMaxMemory; 
    811         /// the tree is out of memory 
    812         bool mOutOfMemory; 
    813          
     842         
     843 
     844        //-- subdivision statistics 
     845 
     846        /// subdivision stats output file 
     847        ofstream mSubdivisionStats; 
    814848        float mTotalCost; 
    815849        int mTotalPvsSize; 
    816850 
    817         float mMinBand; 
    818         float mMaxBand; 
    819  
    820         //int mSplits; 
    821         /// subdivision stats output file 
    822         ofstream mSubdivsionStats; 
    823         /// if random split axis should be used 
    824         bool mUseRandomAxis; 
     851 
    825852        /// use polygon split whenever there are polys left 
    826853        bool mUsePolygonSplitIfAvailable; 
     
    829856        /// number of currenly generated view cells 
    830857        int mCreatedViewCells; 
    831         /// if vsp bsp tree should simulate octree 
    832         bool mCirculatingAxis; 
    833  
    834         /// if we should use breath first priority for the splits 
    835         int mNodePriorityQueueType; 
    836  
    837         bool mEmptyViewCellsMergeAllowed; 
    838  
    839         // priority queue strategy 
    840         enum {BREATH_FIRST, DEPTH_FIRST, COST_BASED}; 
     858 
     859 
    841860private: 
    842861 
Note: See TracChangeset for help on using the changeset viewer.