Changeset 1623 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include
- Timestamp:
- 10/13/06 10:49:29 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBoundingBoxConverter.h
r1621 r1623 66 66 } 67 67 68 //------------------------------------------------------------------------- 69 inline static AxisAlignedBox ScaleBox(const AxisAlignedBox &box) 70 { 71 const float scale = 1.5f; 72 Vector3 max = box.getMaximum(); 73 Vector3 min = box.getMinimum(); 74 Vector3 size = max - min; 75 Vector3 newSize = size*(scale*0.5f); 76 Vector3 center = 0.5f * (min + max); 77 78 Vector3 min = center - newSize; 79 Vector3 max = center + newSize; 80 81 return AxisAlignedBox(min, max); 82 } 68 83 /** find object which fits best to this bounding box 69 84 */ … … 89 104 { 90 105 list<SceneNode *> sceneNodeList; 106 AxisAlignedBox3 enlargedBox = 91 107 AxisAlignedBox mybox = EnlargeBox(box); 92 108 … … 154 170 } 155 171 //----------------------------------------------------------------------- 156 template<typename T>172 /*template<typename T> 157 173 void PlatFormBoundingBoxConverter<T>::FindIntersectingObjects(const AxisAlignedBox &box, 158 174 EntityContainer &objects) const … … 161 177 162 178 // get intersecting scene nodes (= candidates) 163 //AxisAlignedBox mybox = EnlargeBox(box);164 //mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL);165 mSceneMgr->findNodesIn(box, sceneNodeList, NULL);179 AxisAlignedBox mybox = EnlargeBox(box); 180 mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL); 181 //mSceneMgr->findNodesIn(box, sceneNodeList, NULL); 166 182 167 183 list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 168 184 169 //GtpVisibilityPreprocessor::AxisAlignedBoxnodeBox = OgreTypeConverter::ConvertFromOgre(mybox);170 GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(box);185 GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(mybox); 186 //GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(box); 171 187 172 188 // find really intersecting objects … … 201 217 } 202 218 } 203 219 */ 220 template<typename T> 221 void PlatFormBoundingBoxConverter<T>::FindIntersectingObjects(const AxisAlignedBox &box, 222 EntityContainer &objects) const 223 {//return; 224 list<SceneNode *> sceneNodeList; 225 226 // get intersecting scene nodes (= candidates) 227 AxisAlignedBox mybox = EnlargeBox(box); 228 //mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL); 229 mSceneMgr->findNodesIn(box, sceneNodeList, NULL); 230 231 list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 232 233 //GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(mybox); 234 GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(box); 235 236 // find really intersecting objects 237 for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(); ++ sit) 238 { 239 SceneNode *sn = *sit; 240 SceneNode::ObjectIterator oit = sn->getAttachedObjectIterator(); 241 242 while (oit.hasMoreElements()) 243 { 244 MovableObject *mo = oit.getNext(); 245 246 // we are only interested in scene entities 247 if (mo->getMovableType() != "Entity") 248 { 249 continue; 250 } 251 252 //const AxisAlignedBox bbox = EnlargeBox(mo->getWorldBoundingBox()); 253 const AxisAlignedBox bbox = mo->getWorldBoundingBox(); 254 255 const bool overlaps = Overlap(nodeBox, 256 OgreTypeConverter::ConvertFromOgre(bbox) 257 ); 258 //,0.00001); 259 260 if (overlaps) 261 { 262 objects.push_back(static_cast<Entity *>(mo)); 263 } 264 } 265 } 266 } 204 267 #if USE_KD_PVS 205 268 //-------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.