Ignore:
Timestamp:
09/13/06 17:15:26 (18 years ago)
Author:
mattausch
Message:

implemented the global version of the bounding volume construction

File:
1 edited

Legend:

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

    r1345 r1357  
    3535class VspTree; 
    3636class ViewCellsContainer; 
    37 //class BvhSubdivisionCandidate; 
    3837 
    3938 
     
    149148        /** The bounding box specifies the node extent. 
    150149        */ 
     150        inline  
    151151        AxisAlignedBox3 GetBoundingBox() const 
    152152        { return mBoundingBox; } 
    153153 
    154154 
     155        inline  
    155156        void SetBoundingBox(const AxisAlignedBox3 &boundingBox)  
    156157        { mBoundingBox = boundingBox; } 
     
    298299                mMaxCostMisses(0),  
    299300                mAxis(0) 
    300                 //mObjectsStart(0), 
    301                 //mObjectsEnd(0) 
    302                 {} 
     301                { 
     302                        mSortedObjects[0] = mSortedObjects[1] = mSortedObjects[2] = NULL; 
     303                } 
    303304                 
    304305                BvhTraversalData(BvhLeaf *node,  
     
    312313                mMaxCostMisses(0), 
    313314                mAxis(0) 
    314                 //mObjectsStart(0) 
    315                 //mObjectsEnd(0) 
    316                 {} 
    317  
    318                 /// deletes contents and sets them to NULL 
     315                { 
     316                        mSortedObjects[0] = mSortedObjects[1] = mSortedObjects[2] = NULL; 
     317                } 
     318 
     319                /** Deletes contents and sets them to NULL. 
     320                */ 
    319321                void Clear() 
    320322                { 
    321323                        DEL_PTR(mNode); 
     324                        /*DEL_PTR(mSortedObjects[0]); 
     325                        DEL_PTR(mSortedObjects[1]); 
     326                        DEL_PTR(mSortedObjects[2]);*/ 
    322327                } 
    323328 
     
    334339                /// current axis 
    335340                int mAxis; 
    336                 /// start of objects 
    337                 SortableEntryContainer::const_iterator mObjectsStart; 
    338                 /// end of objects 
    339                 SortableEntryContainer::const_iterator mObjectsEnd; 
     341                /// the sorted objects for the three dimensions 
     342                ObjectContainer *mSortedObjects[3];              
    340343    }; 
    341344 
    342         /** Candidate for a view space split. 
     345 
     346        /** Candidate for a object space split. 
    343347        */ 
    344348        class BvhSubdivisionCandidate: public SubdivisionCandidate 
     
    618622 
    619623         
    620         /** Sorts split candidates for cost heuristics using axis aligned splits. 
     624        /** Prepare split candidates for cost heuristics using axis aligned splits. 
    621625                @param node the current node 
    622626                @param axis the current split axis 
    623627        */ 
    624         static void SortSubdivisionCandidates( 
    625                 const ObjectContainer &objects, 
    626                 vector<SortableEntry> **subdivisionCandidates, 
     628        void PrepareLocalSubdivisionCandidates( 
     629                const BvhTraversalData &tData, 
    627630                const int axis); 
    628631 
    629         /** Computes best cost for axis aligned planes. 
     632        static void CreateLocalSubdivisionCandidates( 
     633                const ObjectContainer &objects,  
     634                SortableEntryContainer **subdivisionCandidates, 
     635                const bool sort, 
     636                const int axis); 
     637 
     638        /** Computes object partition with the best cost according to the heurisics. 
     639                @param tData the traversal data 
     640                @param axis the split axis 
     641                @param objectsFront the objects in the front child bv 
     642                @param objectsBack the objects in the back child bv 
     643                @param backObjectsStart the iterator marking the position where the back objects begin 
     644 
     645                @returns relative cost (relative to parent cost) 
    630646        */ 
    631647        float EvalLocalCostHeuristics( 
     
    633649                const int axis, 
    634650                ObjectContainer &objectsFront, 
    635                 ObjectContainer &objectsFBack); 
     651                ObjectContainer &objectsBack); 
    636652 
    637653        /** Evaluates the contribution to the front and back volume 
     
    708724        float EvalViewCellsVolume(const ObjectContainer &objects) const; 
    709725 
     726        void CreateInitialSortedObjectList(BvhTraversalData &tData); 
     727 
     728        void AssignSortedObjects( 
     729                const BvhSubdivisionCandidate &sc, 
     730                BvhTraversalData &frontData, 
     731                BvhTraversalData &backData); 
     732 
    710733 
    711734protected: 
     
    735758 
    736759 
    737         //-- local termination 
     760        //////////////////////////////// 
     761        //-- local termination criteria 
    738762 
    739763        /// maximal possible depth 
     
    751775 
    752776 
    753         //-- global criteria 
     777        //////////////////////////////////// 
     778        //-- global termination criteria 
    754779 
    755780        float mTermMinGlobalCostRatio; 
     
    765790 
    766791 
     792        //////////////////////////////////////// 
    767793        //-- split heuristics based parameters 
    768794         
     
    772798        /// if only driving axis should be used for split 
    773799        bool mOnlyDrivingAxis; 
    774          
    775800        /// current time stamp (used for keeping split history) 
    776801        int mTimeStamp; 
    777802        // if rays should be stored in leaves 
    778803        bool mStoreRays; 
    779  
    780         /// epsilon for geometric comparisons 
    781         float mEpsilon; 
    782  
    783         /// subdivision stats output file 
     804        // subdivision stats output file 
    784805        ofstream  mSubdivisionStats; 
    785806        /// keeps track of cost during subdivision 
     
    789810        /// number of currenly generated view cells 
    790811        int mCreatedLeaves; 
    791  
    792812        /// represents min and max band for sweep 
    793813        float mSplitBorder; 
    794  
    795814        /// weight between render cost decrease and node render cost 
    796815        float mRenderCostDecreaseWeight; 
    797  
    798816        /// stores the kd node intersectables used for pvs 
    799817        BvhIntersectableMap mBvhIntersectables; 
    800818 
     819        bool mUseGlobalSorting; 
    801820}; 
    802821 
Note: See TracChangeset for help on using the changeset viewer.