Changeset 1206 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Timestamp:
- 08/17/06 13:56:10 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h
r1203 r1206 34 34 namespace Ogre 35 35 { 36 class KdTreeCamera; 36 37 class KdRenderable; 37 38 struct SplitInfo; … … 519 520 520 521 // test visibility of objects and add to render queue 521 void queueVisibleObjects( Camera* cam, RenderQueue* queue, bool onlyShadowCasters,522 void queueVisibleObjects(KdTreeCamera* cam, RenderQueue* queue, bool onlyShadowCasters, 522 523 bool showBoxes, KdTree::NodeList& visibleNodes); 523 524 … … 555 556 556 557 // recursive rendering function 557 void recQueueVisibleObjects(KdTree::Node * node, unsigned long currentFrame, Camera* cam, 558 RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, KdTree::NodeList& visibleNodes); 558 void recQueueVisibleObjects(KdTree::Node * node, unsigned long currentFrame, KdTreeCamera* cam, 559 RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, 560 KdTree::NodeList& visibleNodes, bool fullVis = false); 559 561 560 562 // recursively find visible nodes -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h
r1203 r1206 15 15 #include <VisibilityManager.h> 16 16 #include "OgreKdTree.h" 17 #include "OgreKdTreeCamera.h" 17 18 18 19 #define KDTREE_MAX_DEPTH 12 … … 38 39 /************************************************************************/ 39 40 41 /** Override from Scenemanager to create Camera as instance of KdTreeCamera 42 */ 43 virtual Camera* createCamera(const String& name); 44 40 45 /** Override from SceneManager to create SceneNodes as instance of KdTreeSceneNode 41 46 */ … … 171 176 */ 172 177 void WriteLog(); 178 179 /** Switches between simple & enhanced visibility 180 */ 181 void setEnhancedVis(bool enhanced); 173 182 174 183 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj
r1195 r1206 273 273 </File> 274 274 <File 275 RelativePath="..\include\OgreKdTreeCamera.h"> 276 </File> 277 <File 275 278 RelativePath="..\include\OgreKdTreeHierarchyInterface.h"> 276 279 </File> … … 287 290 <File 288 291 RelativePath="..\src\OgreKdTree.cpp"> 292 </File> 293 <File 294 RelativePath="..\src\OgreKdTreeCamera.cpp"> 289 295 </File> 290 296 <File -
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.