Ignore:
Timestamp:
07/10/06 01:57:41 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1101 r1106  
    181181        int splits[3]; 
    182182         
    183         // totals number of rays 
    184         int rays; 
    185183        // maximal reached depth 
    186184        int maxDepth; 
     
    194192        // max depth nodes 
    195193        int minPvsNodes; 
    196         // nodes with minimum PVS 
    197         int minRaysNodes; 
    198         // max ray contribution nodes 
    199         int maxRayContribNodes; 
    200194        // minimum area nodes 
    201195        int minProbabilityNodes; 
    202196        /// nodes termination because of max cost ratio; 
    203197        int maxCostNodes; 
    204         // max number of rays per node 
     198        // max number of objects per node 
    205199        int maxObjectRefs; 
     200        int objectRefs; 
    206201        /// samples contributing to pvs 
    207202        int contributingSamples; 
     
    214209        /// accumulated number of rays refs 
    215210        int accumRays; 
     211        /// potentially visible objects from this leaf 
    216212        int pvs; 
     213 
    217214        // accumulated depth (used to compute average) 
    218215        int accumDepth; 
     
    230227        // TODO: computation wrong 
    231228        double AvgDepth() const { return accumDepth / (double)Leaves();};  
    232         double AvgRays() const { return accumRays / (double)Leaves();};  
     229         
    233230 
    234231        void Reset()  
     
    244241                maxDepthNodes = 0; 
    245242                minPvsNodes = 0; 
    246                 minRaysNodes = 0; 
    247                 maxRayContribNodes = 0; 
     243         
    248244                minProbabilityNodes = 0; 
    249245                maxCostNodes = 0; 
     
    254250                maxPvs = 0; 
    255251                invalidLeaves = 0; 
    256                 accumRays = 0; 
     252                objectRefs = 0; 
    257253        } 
     254 
    258255 
    259256        void Print(ostream &app) const; 
     
    558555        public: 
    559556                static VspTree* sVspTree; 
    560                 /// parent data 
     557                /// parent node traversal data 
    561558                VspTraversalData mParentData; 
    562559                 
     
    619616        /** Returns box which bounds the whole tree. 
    620617        */ 
    621         AxisAlignedBox3 GetBoundingBox()const; 
     618        AxisAlignedBox3 GetBoundingBox() const; 
    622619 
    623620        /** Returns root of the view space partitioning tree. 
     
    10601057        /// number of currenly generated view cells 
    10611058        int mCreatedViewCells; 
    1062  
    1063 private: 
    1064  
    1065         /// Generates unique ids for PVS criterium 
    1066         static void GenerateUniqueIdsForPvs(); 
    1067  
    1068         //-- unique ids for PVS criterium 
    1069         static int sFrontId;  
    1070         static int sBackId; 
    1071         static int sFrontAndBackId; 
    10721059}; 
    10731060 
     
    10881075        public: 
    10891076                /// the current node 
    1090                 KdNode *mNode; 
     1077                KdLeaf *mNode; 
    10911078                /// current depth 
    10921079                int mDepth; 
    10931080                /// rays piercing this node 
    1094                 RayInfoContainer *mRays; 
     1081                //RayInfoContainer *mRays; 
    10951082                /// the probability that this node contains view point 
    10961083                float mProbability; 
     
    11061093                float mPriority; 
    11071094 
    1108                  
    1109                 /** Returns average ray contribution. 
    1110                 */ 
    1111                 float GetAvgRayContribution() const 
    1112                 { 
    1113                         return (float)mPvs / ((float)mRays->size() + Limits::Small); 
    1114                 } 
    1115  
    11161095 
    11171096                OspTraversalData(): 
    11181097                mNode(NULL), 
    11191098                mDepth(0), 
    1120                 mRays(NULL), 
    11211099                mPvs(0), 
    11221100                mProbability(0.0), 
     
    11261104                {} 
    11271105                 
    1128                 OspTraversalData(KdNode *node,  
     1106                OspTraversalData(KdLeaf *node,  
    11291107                                                 const int depth,  
    1130                                                  RayInfoContainer *rays, 
    11311108                                                 const int pvs, 
    11321109                                                 const float p, 
     
    11341111                mNode(node),  
    11351112                mDepth(depth),  
    1136                 mRays(rays), 
    11371113                mPvs(pvs), 
    11381114                mProbability(p), 
     
    11441120 
    11451121                OspTraversalData(const int depth,  
    1146                                                  RayInfoContainer *rays, 
    11471122                                                 const AxisAlignedBox3 &box):  
    11481123                mNode(NULL),  
    11491124                mDepth(depth),  
    1150                 mRays(rays), 
    11511125                mPvs(0), 
    11521126                mProbability(0), 
     
    11671141                void Clear() 
    11681142                { 
    1169                         DEL_PTR(mRays); 
    11701143                } 
    11711144 
     
    11891162                {}; 
    11901163 
    1191                 int Type() const { return VIEW_SPACE; } 
     1164                int Type() const { return OBJECT_SPACE; } 
    11921165         
    11931166                void EvalPriority() 
     
    12311204        /** Returns bounding box of the specified node. 
    12321205        */ 
    1233         AxisAlignedBox3 GetBoundingBox(KdNode *node) const; 
    1234  
    1235         /** Returns list of BSP leaves with pvs smaller than 
     1206        AxisAlignedBox3 GetBBox(KdNode *node) const; 
     1207 
     1208        /** Returns list of leaves with pvs smaller than 
    12361209                a certain threshold. 
    12371210                @param onlyUnmailed if only the unmailed leaves should be considered 
    12381211                @param maxPvs the maximal pvs of a leaf to be added (-1 means unlimited) 
    12391212        */ 
    1240         void CollectLeaves(vector<VspLeaf *> &leaves,  
    1241                                            const bool onlyUnmailed = false, 
    1242                                            const int maxPvs = -1) const; 
    1243  
    1244         /** Returns box which bounds the whole tree. 
     1213         
     1214        void CollectLeaves(vector<KdLeaf *> &leaves) const; 
     1215 
     1216 
     1217        /** Returns bounding box of the whole tree (= bbox of root node) 
    12451218        */ 
    12461219        AxisAlignedBox3 GetBoundingBox()const; 
     
    14061379                @returns the root of the subdivision 
    14071380        */ 
     1381        KdInterior *SubdivideNode(KdLeaf *leaf, 
     1382                const AxisAlignedPlane &splitPlane, 
     1383                const AxisAlignedBox3 &box, 
     1384                OspTraversalData &frontData, 
     1385                OspTraversalData &backData); 
     1386 
    14081387        void SplitObjects(const AxisAlignedPlane & splitPlane, 
    14091388                                          const ObjectContainer &objects, 
    1410                                           ObjectContainer &back, 
    1411                                           ObjectContainer &front); 
    1412  
    1413         KdInterior *SubdivideNode(KdLeaf *leaf, 
    1414                                                           const AxisAlignedPlane &splitPlane, 
    1415                                                           const AxisAlignedBox3 &box, 
    1416                                                           AxisAlignedBox3 &backBBox, 
    1417                                                           AxisAlignedBox3 &frontBBox); 
     1389                                          ObjectContainer &front, 
     1390                                          ObjectContainer &back); 
    14181391 
    14191392        void ProcessLeafObjects(KdLeaf *leaf, KdLeaf *parent) const; 
     
    14391412                const int axis, 
    14401413                float &position, 
    1441                 int &objectsBack, 
    1442                 int &objectsFront); 
     1414                int &objectsFront, 
     1415                int &objectsBack); 
    14431416 
    14441417        /** Subdivides the rays into front and back rays according to the split plane. 
     
    15531526        //-- local termination 
    15541527 
    1555         /// minimal number of rays before subdivision termination 
    1556         int mTermMinRays; 
    15571528        /// maximal possible depth 
    15581529        int mTermMaxDepth; 
    15591530        /// mininum probability 
    15601531        float mTermMinProbability; 
    1561         /// mininum PVS 
    1562         int mTermMinPvs; 
     1532        /// minimal number of objects 
     1533        int mTermMinObjects; 
    15631534        /// maximal contribution per ray 
    15641535        float mTermMaxRayContribution; 
     
    15691540 
    15701541 
     1542 
    15711543        //-- global criteria 
    15721544        float mTermMinGlobalCostRatio; 
     
    15751547 
    15761548        /// maximal number of view cells 
    1577         int mMaxViewCells; 
     1549        int mTermMaxLeaves; 
    15781550        /// maximal tree memory 
    15791551        float mMaxMemory; 
     
    15901562        /// if only driving axis should be used for split 
    15911563        bool mOnlyDrivingAxis; 
    1592         /// if random split axis should be used 
    1593         bool mUseRandomAxis; 
    1594         /// if vsp bsp tree should simulate octree 
    1595         bool mCirculatingAxis; 
    1596         /// minimal relative position where the split axis can be placed 
    1597         float mMinBand; 
    1598         /// maximal relative position where the split axis can be placed 
    1599         float mMaxBand; 
    1600  
    1601  
     1564         
    16021565        /// current time stamp (used for keeping split history) 
    16031566        int mTimeStamp; 
     
    16161579        int mTotalPvsSize; 
    16171580        /// number of currenly generated view cells 
    1618         int mCreatedViewCells; 
    1619  
     1581        int mCreatedLeaves; 
     1582 
     1583        /// represents min and max band for sweep 
    16201584        float mSplitBorder; 
    1621  
    1622  
    1623 private: 
    1624  
    1625         /// Generates unique ids for PVS criterium 
    1626         static void GenerateUniqueIdsForPvs(); 
    1627  
    1628         //-- unique ids for PVS criterium 
    1629         static int sFrontId;  
    1630         static int sBackId; 
    1631         static int sFrontAndBackId; 
    16321585}; 
    16331586 
Note: See TracChangeset for help on using the changeset viewer.