Ignore:
Timestamp:
09/12/06 19:30:31 (18 years ago)
Author:
mattausch
Message:

started with global objects sorting for bvh split heuristics

File:
1 edited

Legend:

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

    r1323 r1345  
    283283public: 
    284284         
     285        struct SortableEntry; 
     286        typedef vector<SortableEntry> SortableEntryContainer; 
     287 
    285288        /** Additional data which is passed down the BSP tree during traversal. 
    286289        */ 
     
    294297                mProbability(0.0), 
    295298                mMaxCostMisses(0),  
    296                 mPriority(0), 
    297299                mAxis(0) 
     300                //mObjectsStart(0), 
     301                //mObjectsEnd(0) 
    298302                {} 
    299303                 
     
    307311                mProbability(v), 
    308312                mMaxCostMisses(0), 
    309                 mPriority(0), 
    310313                mAxis(0) 
     314                //mObjectsStart(0) 
     315                //mObjectsEnd(0) 
    311316                {} 
    312  
    313  
    314                 /** Returns cost of the traversal data. 
    315                 */ 
    316                 float GetCost() const 
    317                 { 
    318                         return mPriority; 
    319                 } 
    320317 
    321318                /// deletes contents and sets them to NULL 
     
    337334                /// current axis 
    338335                int mAxis; 
    339                 /// current priority 
    340                 float mPriority; 
    341  
    342  
    343                 friend bool operator<(const BvhTraversalData &a, const BvhTraversalData &b) 
    344                 { 
    345                         return a.GetCost() < b.GetCost(); 
    346                 } 
     336                /// start of objects 
     337                SortableEntryContainer::const_iterator mObjectsStart; 
     338                /// end of objects 
     339                SortableEntryContainer::const_iterator mObjectsEnd; 
    347340    }; 
    348341 
     
    544537                } 
    545538        }; 
    546   
     539 
    547540        /** Evaluate balanced object partition. 
    548541        */ 
     
    586579         
    587580        /** Subdivides leaf. 
    588                 @param leaf the leaf to be subdivided 
     581                @param sc the subdivisionCandidate holding all necessary data for subdivision            
    589582                 
    590                 @param polys the polygons to be split 
    591                 @param frontPolys returns the polygons in front of the split plane 
    592                 @param backPolys returns the polygons in the back of the split plane 
    593                  
    594                 @param rays the polygons to be filtered 
    595                 @param frontRays returns the polygons in front of the split plane 
    596                 @param backRays returns the polygons in the back of the split plane 
    597  
    598                 @returns the root of the subdivision 
     583                @param frontData returns the traversal data for the front node 
     584                @param backData returns the traversal data for the back node 
     585 
     586                @returns the new interior node = the of the subdivision 
    599587        */ 
    600588        BvhInterior *SubdivideNode( 
    601                 const ObjectContainer &frontObjects, 
    602                 const ObjectContainer &backObjects, 
    603                 const BvhTraversalData &tData, 
     589                const BvhSubdivisionCandidate &sc, 
    604590                BvhTraversalData &frontData, 
    605591                BvhTraversalData &backData); 
     
    636622                @param axis the current split axis 
    637623        */ 
    638         void SortSubdivisionCandidates( 
    639                 const BvhTraversalData &data, 
     624        static void SortSubdivisionCandidates( 
     625                const ObjectContainer &objects, 
     626                vector<SortableEntry> **subdivisionCandidates, 
    640627                const int axis); 
    641628 
     
    724711protected: 
    725712         
     713        /// pre-sorted subdivision candidtes for all three directions. 
     714        vector<SortableEntry> *mGlobalSubdivisionCandidates[3]; 
     715 
    726716        /// pointer to the hierarchy of view cells 
    727717        ViewCellsTree *mViewCellsTree; 
Note: See TracChangeset for help on using the changeset viewer.