Ignore:
Timestamp:
06/16/05 18:13:33 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp

    r115 r135  
    142142    _ref(); 
    143143 
     144#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     145        _updateBounds(); 
     146#endif 
     147 
    144148} 
    145149 
     
    151155    //update total counts. 
    152156    _unref(); 
     157 
     158#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     159        _updateBounds(); 
     160#endif 
    153161} 
    154162 
     
    165173        mWireBoundingBox = new WireBoundingBox(); 
    166174 
    167         mWireBoundingBox->setupBoundingBox(mBox); 
     175        //mWireBoundingBox->setupBoundingBox(mBox); 
     176        mWireBoundingBox->setupBoundingBox(mWorldAABB); 
    168177    return mWireBoundingBox; 
    169178} 
     
    171180#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    172181//-----------------------------------------------------------------------        
    173 int Octree::lastVisited(void) 
     182int Octree::lastVisited() 
    174183{ 
    175184        return mLastVisited; 
     
    181190} 
    182191//-----------------------------------------------------------------------        
    183 int Octree::lastRendered(void) 
     192int Octree::lastRendered() 
    184193{ 
    185194        return mLastRendered; 
     
    196205} 
    197206//-----------------------------------------------------------------------        
    198 bool Octree::isOctreeVisible(void) 
     207bool Octree::isOctreeVisible() 
    199208{ 
    200209        return mVisible; 
     
    210219        return mDepth; 
    211220} 
     221//-----------------------------------------------------------------------        
     222AxisAlignedBox Octree::_getWorldAABB(void) const 
     223{ 
     224        return mWorldAABB; 
     225} 
     226//----------------------------------------------------------------------- 
     227void Octree::_updateBounds() 
     228{ 
     229        // Reset bounds first 
     230    mWorldAABB.setNull(); 
     231 
     232    // Update bounds from own attached objects 
     233        NodeList::iterator it, it_end; 
     234        it_end = mNodes.end(); 
     235 
     236    for (it = mNodes.begin(); it != it_end; ++it) 
     237    { 
     238        // Merge world bounds of each object 
     239                mWorldAABB.merge((*it)->_getWorldAABB()); 
     240    } 
     241 
     242    // Merge with children 
     243        for (int i = 0; i < 2; ++i) 
     244    { 
     245        for (int j = 0; j < 2; ++j) 
     246        { 
     247            for (int k = 0; k < 2; ++k) 
     248            { 
     249                if (mChildren[i][j][k] != 0) 
     250                                { 
     251                                        mWorldAABB.merge(mChildren[i][j][k]->_getWorldAABB()); 
     252                                } 
     253            } 
     254        } 
     255        } 
     256        // recursively update parent bounds 
     257        if (mParent) 
     258        { 
     259                mParent->_updateBounds(); 
     260        } 
     261 } 
    212262#endif //GTP_VISIBILITY_MODIFIED_OGRE 
    213263} 
  • trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp

    r115 r135  
    428428            _addOctreeNode( onode, mOctree ); 
    429429    } 
     430#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     431        else // still update because bounding box may be different 
     432        { 
     433                onode -> getOctant() -> _updateBounds(); 
     434        } 
     435#endif // GTP_VISIBILITY_MODIFIED_OGRE 
    430436} 
    431437 
     
    11721178                                                                           bool leaveTransparentsInQueue)//, bool useZPassQueue) 
    11731179{ 
     1180        // delete previously rendered objects from the render queue 
     1181        _deleteRenderedQueueGroups(leaveTransparentsInQueue); 
     1182 
    11741183        //Add stuff to be rendered; 
    11751184    NodeList::iterator it = octant->mNodes.begin(); 
     
    12111220        //-- the actual rendering 
    12121221        SceneManager::_renderVisibleObjects(); 
    1213         // delete all rendered objects from the render queue 
    1214         _deleteRenderedQueueGroups(leaveTransparentsInQueue); 
    12151222} 
    12161223#endif // GTP_VISIBILITY_MODIFIED_OGRE 
Note: See TracChangeset for help on using the changeset viewer.