Ignore:
Timestamp:
10/23/08 23:10:16 (16 years ago)
Author:
mattausch
Message:

working on dynamic bvh hierarchy: denug version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h

    r3059 r3064  
    478478        */ 
    479479        BvhNode *GetRoot() { return mRoot; } 
    480         /** Sets the scene camera 
    481         */ 
    482         //void SetCamera(Camera * camera) { mCamera = camera; } 
    483  
     480         
    484481        /////////////// 
    485482        //-- functions collecting nodes based on some criteria 
    486483 
     484        /** Collect all nodes higher or equal to a given depth. 
     485        */ 
    487486        void CollectNodes(BvhNode *node, BvhNodeContainer &nodes, int depth); 
    488487        void CollectNodes(BvhNode *node, BvhNodeContainer &nodes); 
     488        /** Collect the "physical" leaves of the hierarchy 
     489        */ 
    489490        void CollectLeaves(BvhNode *node, BvhLeafContainer &leaves); 
    490         /** Collect only the virtual leaves. 
     491        /** Collect only the virtual leaves (can be anywhere in the Žhierarchy). 
    491492        */ 
    492493        void CollectVirtualLeaves(BvhNode *node, BvhNodeContainer &leaves); 
     
    543544        */ 
    544545        void ResetNodeClassifications(); 
    545         /** Helper function that renders the bounding boxes of the leaves as 
    546                 wireframes for visualization purpose. 
    547         */ 
    548         //void RenderBoundingBoxesForViz(int mode); 
    549546        /** Count triangles the node contains. 
    550547        */ 
     
    557554        void ComputeIds(); 
    558555        /** Assign virtual leaves based on specified number of triangles per leaf. 
     556                That means that we try to set the leaves at a point where we 
     557                have less than numTriangles triangles within this leaf and beyond. 
     558 
     559                Virtual leaves are nodes that are determined to be the leaves 
     560                of the hierarchy during render traversal. These nodes are not necessarily  
     561                the same as the real leaves of the hierarchy and can be anywhere 
     562                in the hierarchy.  
     563                Please refer to the article for more info about virtual leaves 
    559564        */ 
    560565        void SetVirtualLeaves(int numTriangles); 
    561566         
    562567 
    563         //////// 
    564         //-- functions influencing tighter bounds 
     568        //////////// 
     569        //-- functions influencing the tightness of the bounds that are used for testing 
    565570 
    566571 
    567572        /** Sets maximal depth for taking the bounding boxes to test the 
    568573                visibility of a node.  
    569                 Deeper => the bounds adapt more to the geometry. 
     574                Deeper level means that the bounds adapt more to the geometry but 
     575                also that more boxes are rendered 
    570576        */ 
    571577        void SetMaxDepthForTestingChildren(int maxDepth); 
    572  
     578        /** The ratio of area between node and subnodes where  
     579                testing the subnodes as proxy is still considered feasable 
     580        */ 
    573581        void SetAreaRatioThresholdForTestingChildren(float ratio); 
    574582 
     
    583591        void RenderBoundsForViz(BvhNode *node, RenderState *state, bool useTightBounds); 
    584592 
     593        void AddDynamicObject(SceneEntity *ent); 
     594 
    585595 
    586596protected: 
     
    608618         
    609619        void PrepareVertices(); 
    610  
     620        /** Prepare nodes for vbo rendering. 
     621        */ 
    611622        int PrepareBoundsWithDrawArrays(const BvhNodeContainer &nodes); 
     623        /** Render the nodes from the vbo prepared previously. 
     624        */ 
    612625        void RenderBoundsWithDrawArrays(int numNodes, RenderState *state); 
    613626 
     
    643656 
    644657        ///////////////////////////// 
    645  
     658        // functions that are required to build the dynamic part of the hierarchy 
    646659        int SortTriangles(BvhLeaf *leaf,  
    647660                              int axis,  
     
    656669                                   int parentAxis,  
    657670                                                   SceneEntityContainer &entities); 
    658  
    659671        /** Recompute the dynamic branch of the hierarchy. 
    660672        */ 
     
    663675        inline bool TerminationCriteriaMet(BvhLeaf *leaf) const; 
    664676 
     677        /** Returns number of bvh nodes. 
     678        */ 
     679        inline int GetNumStaticNodes() const { return mNumNodes; } 
    665680 
    666681        //////////////////////// 
     
    670685        /// the root of the hierarchy 
    671686        BvhNode *mRoot; 
     687        /// the root of static part of the the hierarchy 
     688        BvhNode *mStaticRoot; 
     689        /// the root of dynamic part of the the hierarchy 
     690        BvhNode *mDynamicRoot; 
    672691        /// pointers to the geometry associated with this node 
    673692        SceneEntity **mGeometry; 
Note: See TracChangeset for help on using the changeset viewer.