Changeset 1206 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src
- Timestamp:
- 08/17/06 13:56:10 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp
r1203 r1206 8 8 */ 9 9 10 #include <OgreCamera.h>11 10 #include "OgreKdTree.h" 12 11 #include "OgreKdRenderable.h" 13 12 #include "OgreKdTreeSceneNode.h" 14 13 #include "OgreKdTreeSceneManager.h" 14 #include "OgreKdTreeCamera.h" 15 15 16 16 #include <OgreStringConverter.h> … … 1184 1184 1185 1185 //------------------------------------------------------------------------- 1186 void KdTree::queueVisibleObjects( Camera* cam, RenderQueue* queue, bool onlyShadowCasters,1186 void KdTree::queueVisibleObjects(KdTreeCamera* cam, RenderQueue* queue, bool onlyShadowCasters, 1187 1187 bool showBoxes, KdTree::NodeList& visibleNodes) 1188 1188 { … … 1194 1194 //------------------------------------------------------------------------- 1195 1195 void KdTree::recQueueVisibleObjects(KdTree::Node * node, unsigned long currentFrame, 1196 Camera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, KdTree::NodeList& visibleNodes) 1197 { 1196 KdTreeCamera* cam, RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, 1197 KdTree::NodeList& visibleNodes, bool fullVis) 1198 { 1199 KdTreeCamera::NodeVisibility vis = KdTreeCamera::KDNV_PART; 1198 1200 // test visibility 1199 if (cam->isVisible(node->mAABB)) 1201 //if (cam->isVisible(node->mAABB)) 1202 if (fullVis || 1203 ((vis = cam->getVisibilityEnhanced(node->mAABB)) != KdTreeCamera::KDNV_NONE)) 1204 //((vis = (cam->*getVisibility)(node->mAABB)) != KdTreeCamera::KDNV_NONE)) 1200 1205 { 1201 1206 visibleNodes.push_back(node); … … 1205 1210 if (node->getLeftChild()) 1206 1211 recQueueVisibleObjects(node->getLeftChild(), currentFrame, 1207 cam, queue, onlyShadowCasters, showBoxes, visibleNodes); 1212 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, 1213 (fullVis || vis == KdTreeCamera::KDNV_FULL) ? true : false); 1208 1214 if (node->getRightChild()) 1209 1215 recQueueVisibleObjects(node->getRightChild(), currentFrame, 1210 cam, queue, onlyShadowCasters, showBoxes, visibleNodes); 1216 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, 1217 (fullVis || vis == KdTreeCamera::KDNV_FULL) ? true : false); 1211 1218 } 1212 1219 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
r1204 r1206 80 80 } 81 81 82 void KdTreeSceneManager::setEnhancedVis(bool enhanced) 83 { 84 for (CameraList::iterator it = mCameras.begin(); it != mCameras.end(); it ++) 85 { 86 KDCAMPTR_CAST(it->second)->setEnhancedVisMode(enhanced); 87 } 88 } 89 82 90 bool KdTreeSceneManager::setOption(const String& strKey, const void* pValue) 83 91 { … … 133 141 mKdTree = new KdTree(mMaxDepth, mBuildMethod, mHiLiteLevel, mShowAllBoxes, mShowNodes); 134 142 mKdTree->build(static_cast<KdTreeSceneNode *>(mSceneRoot)); 143 return true; 144 } 145 else if (strKey == "EnhancedVisibility") 146 { 147 bool enh = *static_cast<const bool *>(pValue); 148 setEnhancedVis(enh); 135 149 return true; 136 150 } … … 338 352 *static_cast<Real *>(pDestValue) = PlaneEvent::KI; 339 353 return true; 354 } 355 else if (strKey == "EnhancedVisibility") 356 { 357 *static_cast<bool *>(pDestValue) = 358 KDCAMPTR_CAST(mCameras.begin()->second)->getEnhancedVisMode(); 340 359 } 341 360 else if (strKey == "BuildMethod") … … 441 460 } 442 461 462 Camera* KdTreeSceneManager::createCamera(const String& name) 463 { 464 // Check name not used 465 if (mCameras.find(name) != mCameras.end()) 466 { 467 OGRE_EXCEPT( 468 Exception::ERR_DUPLICATE_ITEM, 469 "A camera with the name " + name + " already exists", 470 "SceneManager::createCamera" ); 471 } 472 473 Camera *c = new KdTreeCamera(name, this); 474 mCameras.insert(CameraList::value_type(name, c)); 475 476 return c; 477 } 478 443 479 SceneNode* KdTreeSceneManager::createSceneNode(void) 444 480 { … … 543 579 mVisibleNodes.clear(); 544 580 if (mKdTree) 545 mKdTree->queueVisibleObjects( cam, getRenderQueue(), onlyShadowCasters, mShowBoxes, mVisibleNodes);581 mKdTree->queueVisibleObjects(KDCAMPTR_CAST(cam), getRenderQueue(), onlyShadowCasters, mShowBoxes, mVisibleNodes); 546 582 } 547 583 } … … 565 601 getRenderQueue()->clear(); 566 602 if (mKdTree) 567 mKdTree->queueVisibleObjects( cam, getRenderQueue(), onlyShadowCasters, mShowBoxes, mVisibleNodes);603 mKdTree->queueVisibleObjects(KDCAMPTR_CAST(cam), getRenderQueue(), onlyShadowCasters, mShowBoxes, mVisibleNodes); 568 604 } 569 605
Note: See TracChangeset
for help on using the changeset viewer.