Changeset 2308 for OGRE


Ignore:
Timestamp:
04/02/07 11:59:11 (18 years ago)
Author:
mattausch
Message:
 
Location:
OGRE/trunk/ogre_changes/Ogre1.2/PlugIns/OctreeSceneManager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OGRE/trunk/ogre_changes/Ogre1.2/PlugIns/OctreeSceneManager/include/OgreOctree.h

    r2257 r2308  
    177177        */ 
    178178        bool isOctreeVisible(void); 
    179         void setOctreeFullyVisible(bool visible); 
    180         /** Returns true if this node is marked visible, false otherwise.  
     179         
     180        /** Returns true if all children of this nodes are fully visible, false otherwise.  
    181181        */ 
    182182        bool isOctreeFullyVisible(void); 
     
    201201        void _updateBounds(); 
    202202 
     203        void _incNumChildren(); 
     204 
     205        void setOctreeFullyVisible(bool visible); 
     206 
     207        float getVisibilityRatio(); 
     208 
     209        void setNumVisibleLeaves(int leaves); 
     210        int getNumVisibleLeaves(); 
     211 
     212        void setNumLeaves(int leaves); 
     213        int getNumLeaves(); 
     214 
    203215protected: 
    204216         
     
    209221        int mLastVisited; 
    210222        bool mVisible; 
     223 
    211224        bool mFullyVisible; 
     225 
     226        int mNumVisibleLeaves; 
     227        int mNumLeaves; 
    212228#endif // GTP_VISIBILITY_MODIFIED_OGRE 
    213229}; 
  • OGRE/trunk/ogre_changes/Ogre1.2/PlugIns/OctreeSceneManager/src/OgreOctree.cpp

    r2257 r2308  
    8787      mHalfSize( 0, 0, 0 ) 
    8888#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    89         , mLastVisited(0), mVisible(false), mLastRendered(-1), mFullyVisible(false) 
     89        , mLastVisited(0), mVisible(false), mLastRendered(-1) 
     90        , mNumLeaves(1), mNumVisibleLeaves(0) 
     91        , mFullyVisible(false) 
    9092#endif //GTP_VISIBILITY_MODIFIED_OGRE 
    9193{ 
     
    105107 
    106108    mNumNodes = 0; 
     109 
     110#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     111        // recursively update number of children 
     112        if (0) _incNumChildren(); 
     113#endif; 
    107114} 
    108115 
     
    214221bool Octree::isOctreeFullyVisible() 
    215222{ 
     223        // all childrens are visible 
     224#if 0 
     225        return mNumChildren == mNumVisibleChildren; 
     226#else 
    216227        return mFullyVisible; 
    217 } 
    218 //-----------------------------------------------------------------------        
     228#endif 
     229} 
     230//-----------------------------------------------------------------------        
     231float Octree::getVisibilityRatio() 
     232{ 
     233        // all childrens are visible 
     234        return (float)mNumVisibleLeaves / (float)mNumLeaves; 
     235} 
     236//----------------------------------------------------------------------- 
     237void Octree::setNumVisibleLeaves(int leaves) 
     238{ 
     239        int mNumVisibleLeaves = leaves; 
     240} 
     241//----------------------------------------------------------------------- 
     242int Octree::getNumVisibleLeaves() 
     243{ 
     244        return mNumVisibleLeaves; 
     245} 
     246//----------------------------------------------------------------------- 
     247void Octree::setNumLeaves(int leaves) 
     248{ 
     249        mNumLeaves = leaves; 
     250} 
     251//----------------------------------------------------------------------- 
     252int Octree::getNumLeaves() 
     253{ 
     254        return mNumLeaves; 
     255} 
     256//----------------------------------------------------------------------- 
    219257Octree *Octree::getParent() 
    220258{ 
     
    267305                mParent->_updateBounds(); 
    268306        } 
    269  } 
     307} 
     308 
     309 
     310void Octree::_incNumChildren() 
     311{ 
     312/*      ++ mNumChildren; 
     313 
     314        if (mParent)     
     315        { 
     316                mParent->_incNumChildren(); 
     317        }*/ 
     318} 
    270319 
    271320#endif //GTP_VISIBILITY_MODIFIED_OGRE 
Note: See TracChangeset for help on using the changeset viewer.