Ignore:
Timestamp:
03/18/07 01:27:51 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyInterface.h

    r2258 r2259  
    9797        void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 
    9898        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 
     99        GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *root) { return NULL;} 
    99100}; 
    100101 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeHierarchyInterface.h

    r2258 r2259  
    9696        void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 
    9797 
    98         void TraverseNode2(GtpVisibility::HierarchyNode *node); 
     98        void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 
    9999 
    100         HierarchyNode *GetRandomLeaf() { return NULL;} 
     100        GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *root) { return NULL;} 
    101101 
    102102        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 
     103 
    103104}; 
    104105 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOctreeHierarchyInterface.h

    r2258 r2259  
    5555        void TraverseNode2(GtpVisibility::HierarchyNode *node); 
    5656 
    57         HierarchyNode *GetRandomLeaf(); 
     57        GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *node); 
    5858 
    5959        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const; 
    6060 
     61        void RenderNodeRecursive(GtpVisibility::HierarchyNode *node); 
     62 
     63 
    6164protected: 
     65 
    6266        /** Returns pointer to the bounding box of the node. 
    6367                @param node current hierarchy node 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreSceneNodeHierarchyInterface.h

    r2258 r2259  
    4848        void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 
    4949        void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 
    50         HierarchyNode *GetRandomLeaf() { return NULL;} 
     50        GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *root) { return NULL;} 
    5151        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 
    5252 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp

    r2258 r2259  
    5151} 
    5252//----------------------------------------------------------------------- 
    53 HierarchyNode *OctreeHierarchyInterface::GetRandomLeaf()  
     53GtpVisibility::HierarchyNode *OctreeHierarchyInterface::GetRandomLeaf(GtpVisibility::HierarchyNode *root)  
    5454{  
    55         return NULL; 
    56 } 
    57 //----------------------------------------------------------------------- 
    58 bool OctreeHierarchyInterface::GIsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const 
    59 { 
    60         return static_cast<Octree *>(node)->isOctreeFullyVisible(); 
     55        if (IsLeaf(root)) 
     56                return root; 
     57 
     58        Octree *octree = static_cast<Octree *>(root); 
     59 
     60        int mask = (int) (rand() * 8); 
     61         
     62        // random decision 
     63        Octree *child = octree->mChildren[mask & 1][mask & 2][mask & 3]; 
     64 
     65        return GetRandomLeaf(child); 
    6166} 
    6267//----------------------------------------------------------------------- 
     
    214219} 
    215220//----------------------------------------------------------------------- 
     221void OctreeHierarchyInterface::RenderNodeRecursive(GtpVisibility::HierarchyNode *node) 
     222{ 
     223#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     224        Octree *octant = static_cast<Octree *>(node); 
     225 
     226        if (octant->lastRendered() != mFrameId) 
     227        { 
     228                octant->setLastRendered(mFrameId); 
     229                OctreeSceneManager *ocm =  
     230                        static_cast<OctreeSceneManager *>(mSceneManager); 
     231 
     232                ocm->_renderOctantRecursive(mCamera,  
     233                                                                        octant,  
     234                                                                        mOnlyShadowCasters,  
     235                                                                        mLeavePassesInQueue); 
     236 
     237                mVisibleNodes.push_back(node); 
     238        } 
     239#endif   
     240} 
     241//----------------------------------------------------------------------- 
    216242bool OctreeHierarchyInterface::IsNodeVisible(GtpVisibility::HierarchyNode *node) const 
    217243{ 
     
    223249} 
    224250//----------------------------------------------------------------------- 
     251bool OctreeHierarchyInterface::IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const 
     252{ 
     253#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     254        return static_cast<Octree *>(node)->isOctreeFullyVisible(); 
     255#else 
     256        return true; 
     257#endif 
     258} 
     259//----------------------------------------------------------------------- 
    225260unsigned int OctreeHierarchyInterface::LastVisited(GtpVisibility::HierarchyNode *node) const 
    226261{ 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h

    r2258 r2259  
    163163        virtual void TraverseNode2(GtpVisibility::HierarchyNode *node) = 0; 
    164164 
    165         virtual HierarchyNode *GetRandomLeaf() = 0; 
    166         virtual bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const; 
     165        virtual HierarchyNode *GetRandomLeaf(HierarchyNode *root) = 0; 
     166        virtual bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const = 0; 
    167167 
    168168protected: 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/include/RandomUpdateCullingManager.h

    r2258 r2259  
    3030 
    3131protected: 
     32 
    3233        /** Decides if node is considered to be visible depeding on the  
    3334                assumed visibility factor. 
     
    3536        */ 
    3637        bool DecideVisible(HierarchyNode *node) const; 
    37  
    3838 
    3939        /** Skip query for this node. 
     
    4545        unsigned int mAssumedVisibility; 
    4646 
    47         /** Threshold for rand function to return positive result with respect to 
    48                 mAssumedVisibility. 
     47        /** Threshold for rand function to return positive result  
     48                with respect to mAssumedVisibility. 
    4949        */ 
    5050        int mThreshold; 
     51 
     52        int mRandomCandidates; 
    5153}; 
    5254 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/RandomUpdateCullingManager.cpp

    r2258 r2259  
    1010        // initialise random generator in case we use assumed visibility 
    1111        srand(time(NULL)); 
     12 
     13        mRandomCandidates = 1; 
    1214} 
    1315//----------------------------------------------------------------------- 
     
    1820        // initialise random generator in case we use assumed visibility 
    1921        srand(time(NULL)); 
     22 
     23        mRandomCandidates = 1; 
    2024} 
    2125//----------------------------------------------------------------------- 
     
    4549                                // in case geometry is in interior node:  
    4650                                // ensure that we only traverse once 
    47                                 if (!mHierarchyInterface->IsNodeVisible(node)) 
     51                                if (!mHierarchyInterface->IsNodeVisible(node) && 
     52                                        !mHierarchyInterface->IsNodeFullyVisible(node)) 
    4853                                { 
    4954                                        mHierarchyInterface->TraverseNode(node); 
     
    105110                                { 
    106111                                        // node fully visible => test only random leaves 
    107                                         /*for (int i = 0; i < mRandomCandidates; ++ i) 
     112                                        for (int i = 0; i < mRandomCandidates; ++ i) 
    108113                                        { 
    109114                                                HierarchyNode *randomLeaf = mHierarchyInterface->GetRandomLeaf(node); 
     
    116121 
    117122                                                queryQueue.push(QueryPair(node,  
    118                                                         mHierarchyInterface->IssueNodeOcclusionQuery(node, wasVisible))); 
    119                                         }*/ 
     123                                                        mHierarchyInterface->IssueNodeOcclusionQuery(node))); 
     124                                                 
     125                                                mHierarchyInterface->TraverseNode2(node); 
     126                                        } 
    120127 
    121128                                        continue; 
     
    151158                } 
    152159        } 
     160 
     161        // update the fully visible classifications 
     162        mHierarchyInterface->DetermineFullVisibility(mHierarchyInterface->GetHierarchyRoot()); 
    153163} 
    154164//----------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.