- Timestamp:
- 05/11/05 17:51:44 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h
r92 r93 50 50 GtpVisibility::VisibilityManager *getVisibilityManager( void ); 51 51 52 //writes out into the Ogre log file52 //writes out statis into the Ogre log file 53 53 void WriteLog(); 54 54 -
trunk/VUT/Ogre/include/OgreVisibilityTerrainSceneManager.h
r92 r93 63 63 }; 64 64 65 //} // namespace GtpVisibility66 65 } // namespace Ogre 67 66 -
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r87 r93 145 145 } 146 146 147 //} // namespace GtpVisibility148 147 } // namespace Ogre -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r92 r93 78 78 GtpVisibility::HierarchyInterface::InitFrame(root); 79 79 mPreviousNode = NULL; 80 80 81 SetCamera(cam); 81 82 } -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r92 r93 145 145 return mVisibilityManager; 146 146 } 147 //----------------------------------------------------------------------- 147 148 void VisibilityOctreeSceneManager::WriteLog() 148 149 { 149 150 std::stringstream d; 150 151 151 d << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", "152 d << "Algorithm: " << mVisibilityManager->GetCullingManagerType() << ", " 152 153 << "Hierarchy nodes: " << mNumOctreeNodes << ", " << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " 153 154 << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", " -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r87 r93 6 6 #include <OgreRenderSystem.h> 7 7 #include <OgreCamera.h> 8 #include <OgreLogManager.h> 8 9 9 10 #include <windows.h> … … 139 140 return mVisibilityManager; 140 141 } 142 //----------------------------------------------------------------------- 143 void VisibilityTerrainSceneManager::WriteLog() 144 { 145 std::stringstream d; 146 147 d << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", " 148 << "Hierarchy nodes: " << mNumOctreeNodes << ", " << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " 149 << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", " 150 << "Query culled nodes: " << mVisibilityManager->GetCullingManager()->GetNumQueryCulledNodes() << ", " 151 << "Frustum culled nodes: " << mVisibilityManager->GetCullingManager()->GetNumFrustumCulledNodes() << ", " 152 << "Queries issued: " << mVisibilityManager->GetCullingManager()->GetNumQueriesIssued() << "\n"; 153 154 LogManager::getSingleton().logMessage(d.str()); 155 } 141 156 } // namespace Ogre -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r87 r93 105 105 mGUIRenderer(renderer), 106 106 mShutdownRequested(false), 107 mUseOptimization(false),108 107 mLMouseDown(false), 109 108 mRMouseDown(false), … … 111 110 mVisibilityThreshold(0), 112 111 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING), 113 mShowOctree(true), 114 mUseCulling(false) 112 mShowOctree(false), 113 mUseCulling(true), 114 mUseOptimization(false), 115 mUseCullCamera(false) 115 116 { 116 117 // Reduce move speed … … 150 151 151 152 setAlgorithm(mCurrentAlgorithm); 152 toggleUseOptimization(); 153 154 mSceneMgr->setOption("UseOptimization", &mUseOptimization); 155 mSceneMgr->setOption("UseCulling", &mUseCulling); 156 mSceneMgr->setOption("CullCamera", &mUseCullCamera); 157 mSceneMgr->setOption("ShowOctree", &mShowOctree); 153 158 154 159 pOver->show(); … … 231 236 KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 232 237 KEY_PRESSED(KC_C, 0.3, toggleUseCulling()); 233 238 KEY_PRESSED(KC_V, 0.3, toggleCullCamera()); 239 234 240 updateStats(); 235 241 … … 280 286 281 287 mSceneMgr->setOption("UseCulling", &mUseCulling); 288 } 289 //----------------------------------------------------------------------- 290 void MouseQueryListener::toggleCullCamera() 291 { 292 mUseCullCamera = !mUseCullCamera; 293 294 mSceneMgr->setOption("CullCamera", &mUseCullCamera); 282 295 } 283 296 //----------------------------------------------------------------------- -
trunk/VUT/work/TestCulling/TestCullingApplication.h
r87 r93 67 67 void toggleShowOctree(); 68 68 void toggleUseCulling(); 69 void toggleCullCamera(); 69 70 70 71 protected: … … 94 95 bool mShowOctree; 95 96 bool mUseCulling; 97 bool mUseCullCamera; 98 99 Camera *mCullCamera; 96 100 }; 97 101 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r87 r93 25 25 TestCullingTerrainApplication::~TestCullingTerrainApplication() 26 26 { 27 delete mTerrainContentGenerator; 28 } 29 //----------------------------------------------------------------------- 30 void TestCullingTerrainApplication::createCamera( void ) 27 if(mTerrainContentGenerator) 28 delete mTerrainContentGenerator; 29 //if(mCullCamera) delete mCullCamera; 30 } 31 //----------------------------------------------------------------------- 32 void TestCullingTerrainApplication::createCamera() 31 33 { 32 34 // Create the camera 33 35 mCamera = mSceneMgr->createCamera("PlayerCam"); 34 35 // Position it at 500 in Z direction 36 mCamera->setPosition(Vector3(128,25,128)); 37 38 // Look back along -Z 39 mCamera->lookAt(Vector3(0,0,-300)); 40 mCamera->setNearClipDistance(1); 41 mCamera->setFarClipDistance(1000); 36 37 // Set a nice viewpoint 38 mCamera->setPosition(707, 2500, 528); 39 mCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329)); 40 41 //--create cull camera 42 mCullCamera = mSceneMgr->createCamera("CullCamera"); 43 mCullCamera->setPosition(707, 2500, 528); 44 mCullCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329)); 45 46 mCullCamera->setNearClipDistance(1); 47 mCamera->setNearClipDistance(1); 48 49 // Infinite far plane? 50 if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE)) 51 { 52 mCullCamera->setFarClipDistance(0); 53 mCamera->setFarClipDistance(0); 54 } 55 else 56 { 57 mCullCamera->setFarClipDistance(1000); 58 mCamera->setFarClipDistance(1000); 59 } 60 42 61 } 43 62 //----------------------------------------------------------------------- … … 60 79 mWindow->getViewport(0)->setBackgroundColour(fadeColour); 61 80 //mSceneMgr->setFog( FOG_LINEAR, fadeColour, .001, 500, 1000); 81 mWindow->addViewport(mCullCamera, 10, 0.5, 0.5, 1, 1); 62 82 63 83 // Create a skybox 64 //mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 500, false);84 mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 5000, false); 65 85 //mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8, 500, false ); 66 86 … … 79 99 #endif 80 100 mSceneMgr->setWorldGeometry(terrain_cfg); 81 // Infinite far plane?82 if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE))83 {84 mCamera->setFarClipDistance(0);85 }86 87 // Set a nice viewpoint88 mCamera->setPosition(707, 2500, 528);89 mCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329));90 101 91 102 // CEGUI setup … … 122 133 { 123 134 mFrameListener= new MouseQueryListener(mWindow, mCamera, mSceneMgr, 124 mGUIRenderer, mTerrainContentGenerator );135 mGUIRenderer, mTerrainContentGenerator, mCullCamera); 125 136 mFrameListener->showDebugOverlay(true); 126 137 mRoot->addFrameListener(mFrameListener); … … 138 149 SceneManager *sceneManager, 139 150 CEGUI::Renderer *renderer, 140 TerrainContentGenerator *sceneGenerator): 151 TerrainContentGenerator *sceneGenerator, 152 Camera *cullCamera): 141 153 ExampleFrameListener(win, cam, false, true), 142 154 mGUIRenderer(renderer), 143 155 mShutdownRequested(false), 144 mUseOptimization(false),145 156 mLMouseDown(false), 146 157 mRMouseDown(false), … … 150 161 mVisibilityThreshold(0), 151 162 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING), 152 mShowOctree(true), 153 mUseCulling(false) 163 mShowOctree(false), 164 mUseCulling(true), 165 mUseOptimization(false), 166 mUseCullCamera(false), 167 mCullCamera(cullCamera) 154 168 { 155 169 // Reduce move speed … … 191 205 192 206 setAlgorithm(mCurrentAlgorithm); 193 toggleUseOptimization(); 194 toggleShowOctree(); 195 toggleUseCulling(); 207 208 mSceneMgr->setOption("UseOptimization", &mUseOptimization); 209 mSceneMgr->setOption("UseCulling", &mUseCulling); 210 mSceneMgr->setOption("CullCamera", &mUseCullCamera); 211 mSceneMgr->setOption("ShowOctree", &mShowOctree); 196 212 197 213 pOver->show(); … … 287 303 mCamera->getPosition().z); 288 304 } 289 305 306 camPos = mCullCamera->getPosition(); 307 308 if(mRayQueryExecutor->executeRayQuery(&queryResult, 309 Vector3(camPos.x, 5000.0f, camPos.z), Vector3::NEGATIVE_UNIT_Y)) 310 { 311 mCullCamera->setPosition(mCullCamera->getPosition().x, queryResult.y + 10, 312 mCullCamera->getPosition().z); 313 } 314 290 315 return ExampleFrameListener::frameStarted(evt); 291 316 } … … 306 331 KEY_PRESSED(KC_S, 0.3, toggleShowOctree()); 307 332 KEY_PRESSED(KC_C, 0.3, toggleUseCulling()); 308 333 KEY_PRESSED(KC_V, 0.3, toggleCullCamera()); 334 KEY_PRESSED(KC_X, 0.3, fixCullCamera()); 335 309 336 updateStats(); 310 337 … … 389 416 mSceneMgr->setOption("UseCulling", &mUseCulling); 390 417 } 418 //----------------------------------------------------------------------- 419 void MouseQueryListener::toggleCullCamera() 420 { 421 mUseCullCamera = !mUseCullCamera; 422 mSceneMgr->setOption("CullCamera", &mUseCullCamera); 423 } 424 //----------------------------------------------------------------------- 425 void MouseQueryListener::fixCullCamera() 426 { 427 mCullCamera->setPosition(mCamera->getPosition()); 428 mCullCamera->setOrientation(mCamera->getOrientation()); 429 } 430 391 431 //----------------------------------------------------------------------- 392 432 void MouseQueryListener::keyPressed(KeyEvent* e) -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r87 r93 30 30 31 31 MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, 32 CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator );32 CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator, Camera *cullCamera); 33 33 34 34 ~MouseQueryListener(); … … 66 66 void toggleShowOctree(); 67 67 void toggleUseCulling(); 68 void toggleCullCamera(); 69 void fixCullCamera(); 68 70 69 71 protected: … … 97 99 bool mShowOctree; 98 100 bool mUseCulling; 101 bool mUseCullCamera; 102 103 Camera *mCullCamera; 99 104 }; 100 105 … … 113 118 CEGUI::OgreCEGUIRenderer *mGUIRenderer; 114 119 CEGUI::System *mGUISystem; 115 // RayQueryExecutor *mRayQueryExecutor;116 120 117 121 Vector3 mMinTranslation; … … 123 127 TerrainContentGenerator *mTerrainContentGenerator; 124 128 129 Camera *mCullCamera; 130 125 131 private: 126 132 void chooseSceneManager(void);
Note: See TracChangeset
for help on using the changeset viewer.