- Timestamp:
- 06/16/05 18:13:33 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp
r115 r135 142 142 _ref(); 143 143 144 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 145 _updateBounds(); 146 #endif 147 144 148 } 145 149 … … 151 155 //update total counts. 152 156 _unref(); 157 158 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 159 _updateBounds(); 160 #endif 153 161 } 154 162 … … 165 173 mWireBoundingBox = new WireBoundingBox(); 166 174 167 mWireBoundingBox->setupBoundingBox(mBox); 175 //mWireBoundingBox->setupBoundingBox(mBox); 176 mWireBoundingBox->setupBoundingBox(mWorldAABB); 168 177 return mWireBoundingBox; 169 178 } … … 171 180 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 172 181 //----------------------------------------------------------------------- 173 int Octree::lastVisited( void)182 int Octree::lastVisited() 174 183 { 175 184 return mLastVisited; … … 181 190 } 182 191 //----------------------------------------------------------------------- 183 int Octree::lastRendered( void)192 int Octree::lastRendered() 184 193 { 185 194 return mLastRendered; … … 196 205 } 197 206 //----------------------------------------------------------------------- 198 bool Octree::isOctreeVisible( void)207 bool Octree::isOctreeVisible() 199 208 { 200 209 return mVisible; … … 210 219 return mDepth; 211 220 } 221 //----------------------------------------------------------------------- 222 AxisAlignedBox Octree::_getWorldAABB(void) const 223 { 224 return mWorldAABB; 225 } 226 //----------------------------------------------------------------------- 227 void 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 } 212 262 #endif //GTP_VISIBILITY_MODIFIED_OGRE 213 263 }
Note: See TracChangeset
for help on using the changeset viewer.