Ignore:
Timestamp:
07/07/06 16:14:33 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1097 r1099  
    1010#include "RayInfo.h" 
    1111#include "gzstream.h" 
    12 #include "mixkit/MxHeap.h" 
     12#include "FlexibleHeap.h" 
    1313 
    1414 
     
    4848/** Candidate for a view space / object space split. 
    4949*/ 
    50 class SplitCandidate: public MxHeapable 
     50class SplitCandidate: public Heapable 
    5151 
    5252public: 
     
    6262 
    6363        /// priority of this split 
    64         float mPriority; 
    65          
    66         /// pointers used for building up heap 
    67         SplitCandidate *mParent; 
    68         SplitCandidate *mLeft; 
    69         SplitCandidate *mRight; 
    70  
    71         SplitCandidate(): mPriority(0)  
     64        //float mPriority; 
     65         
     66        SplitCandidate() 
    7267        {}; 
    7368 
     
    7570        {} 
    7671 
     72        virtual void EvalPriority() = 0; 
    7773        virtual int Type() const = 0; 
    78  
    79         /** Returns cost of the traversal data. 
    80         */ 
    81         float GetPriority() const 
    82         { 
    83                 return mPriority; 
    84         } 
    85  
    86         /*friend bool operator<(const SplitCandidate &a, const SplitCandidate &b) 
    87         { 
    88                 return a.GetPriority() < b.GetPriority(); 
    89         }*/ 
    9074}; 
    9175 
     
    462446 
    463447 
     448#if 0 
    464449typedef std::priority_queue<SplitCandidate *,  
    465450                                                        std::vector<SplitCandidate *>,  
    466451                                                        GtPriority<std::vector<SplitCandidate *>::value_type> > SplitQueue; 
    467  
    468 #if TODO 
    469 /** candidate for a view space split 
    470 */ 
    471 class OspSplitCandidate: public SplitCandidate 
    472  
    473         /// parent data 
    474         OspTraversalData mParentData; 
    475                  
    476         VspOspSplitCandidate(): mRenderCost(0)  
    477         {}; 
    478  
    479         int Type() const { return OSP_CANDIDATE; }  
    480  
    481         VspOspSplitCandidate(const AxisAlignedPlane &plane, const VspOspTraversalData &tData):  
    482         mSplitPlane(plane), mParentData(tData), mRenderCost(0) 
    483         {} 
    484 }; 
    485452#endif 
     453 
     454typedef FlexibleHeap<SplitCandidate *> SplitQueue; 
    486455 
    487456/** View Space Partitioning tree. 
     
    588557        {   
    589558        public: 
     559                static VspTree* sVspTree; 
    590560                /// parent data 
    591561                VspTraversalData mParentData; 
    592562                 
    593                 VspSplitCandidate() 
     563                VspSplitCandidate(const VspTraversalData &tData): mParentData(tData) 
    594564                {}; 
    595565 
    596566                int Type() const { return VIEW_SPACE; } 
     567 
     568                void EvalPriority() 
     569                { 
     570                        sVspTree->EvalSplitCandidate(*this);     
     571                } 
    597572 
    598573                VspSplitCandidate(const AxisAlignedPlane &plane, const VspTraversalData &tData):  
     
    796771        /** Evaluates candidate for splitting. 
    797772        */ 
    798         void EvalSplitCandidate(VspTraversalData &tData, VspSplitCandidate &splitData); 
     773        void EvalSplitCandidate(VspSplitCandidate &splitData); 
    799774 
    800775        /** Evaluates render cost decrease of next split. 
     
    12061181        {   
    12071182        public: 
     1183                static OspTree* sOspTree; 
     1184 
    12081185                /// parent data 
    12091186                OspTraversalData mParentData; 
    12101187                 
    1211                 OspSplitCandidate() 
     1188                OspSplitCandidate(const OspTraversalData &tData): mParentData(tData) 
    12121189                {}; 
    12131190 
    12141191                int Type() const { return VIEW_SPACE; } 
     1192         
     1193                void EvalPriority() 
     1194                { 
     1195                        sOspTree->EvalSplitCandidate(*this);     
     1196                } 
    12151197 
    12161198                OspSplitCandidate(const AxisAlignedPlane &plane, const OspTraversalData &tData):  
     
    13761358        /** Evaluates candidate for splitting. 
    13771359        */ 
    1378         void EvalSplitCandidate(OspTraversalData &tData, OspSplitCandidate &splitData); 
     1360        void EvalSplitCandidate(OspSplitCandidate &splitData); 
    13791361 
    13801362        /** Computes priority of the traversal data and stores it in tData. 
     
    17061688        SplitCandidate *NextSplitCandidate(); 
    17071689 
    1708         void RepairQueue(); 
     1690        void RepairQueue(const vector<SplitCandidate *> &dirtyList); 
    17091691 
    17101692        AxisAlignedBox3 mBoundingBox; 
Note: See TracChangeset for help on using the changeset viewer.