Changeset 86 for trunk/VUT/work
- Timestamp:
- 05/06/05 01:39:32 (20 years ago)
- Location:
- trunk/VUT/work
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCulling/SceneContentGenerator.cpp
r85 r86 20 20 mMaxPos(Vector3(70.0f, 70.0f, 600.0f)), 21 21 mMinAngle(Vector3(0.0f, 0.0f, 0.0f)), 22 mMaxAngle(Vector3(360, 360, 360)) 22 mMaxAngle(Vector3(360, 360, 360)), 23 mScale(0.05, 0.05, 0.05) 23 24 { 24 25 } … … 67 68 68 69 currentObject->attachObject(ent); 69 currentObject->setScale( 0.1f, 0.1f, 0.1f);70 currentObject->setScale(mScale); 70 71 71 72 currentObject->yaw(Degree(rotation.x)); … … 106 107 return mCount; 107 108 } 109 //----------------------------------------------------------------------- 110 void SceneContentGenerator::SetScale(Vector3 scale) 111 { 112 mScale = scale; 113 } 108 114 } // namespace Ogre -
trunk/VUT/work/TestCulling/SceneContentGenerator.h
r85 r86 35 35 void SetMaxPos(Vector3 maxPos); 36 36 int GetObjectCount(); 37 void SetScale(Vector3 scale); 37 38 38 39 protected: … … 42 43 Vector3 mMaxPos; 43 44 Vector3 mMinPos; 44 45 Vector3 mScale; 46 45 47 SceneManager *mSceneMgr; 46 48 int mCount; // The number of objects on the screen -
trunk/VUT/work/TestCulling/TestCullingApplication.cpp
r85 r86 54 54 55 55 mSceneContentGenerator = new SceneContentGenerator(mSceneMgr); 56 mSceneContentGenerator->GenerateScene(3 30, "robot.mesh");56 mSceneContentGenerator->GenerateScene(3000, "sphere.mesh"); 57 57 58 58 // Create a skybox … … 101 101 CEGUI::Renderer *renderer, 102 102 SceneContentGenerator *sceneContentGenerator) 103 : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), 104 mShutdownRequested(false) 105 { 106 107 // Setup default variables 108 //mOgreHead = NULL; 109 mLMouseDown = false; 110 mRMouseDown = false; 111 mSceneMgr = sceneManager; 112 113 mSceneContentGenerator = sceneContentGenerator; 114 103 : ExampleFrameListener(win, cam, false, true), 104 mSceneMgr(sceneManager), 105 mGUIRenderer(renderer), 106 mShutdownRequested(false), 107 mUseOptimization(false), 108 mLMouseDown(false), 109 mRMouseDown(false), 110 mSceneContentGenerator(sceneContentGenerator), 111 mVisibilityThreshold(0), 112 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING) 113 { 115 114 // Reduce move speed 116 115 mMoveSpeed = 50; 117 116 mRotateSpeed *= 2; 118 119 mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 120 mVisibilityThreshold = 0; 121 117 122 118 // Register this so that we get mouse events. 123 119 mEventProcessor->addMouseListener(this); … … 137 133 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 138 134 mNumObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/NumObjectsInfo"); 135 mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 139 136 140 137 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); … … 146 143 mRenderedNodesInfo->setCaption(": 0"); 147 144 mNumObjectsInfo->setCaption(": 0"); 145 mUseOptimizationInfo->setCaption(": true"); 148 146 149 147 setAlgorithm(mCurrentAlgorithm); 148 toggleUseOptimization(); 150 149 151 150 pOver->show(); … … 226 225 KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); 227 226 KEY_PRESSED(KC_ADD, 0, changeThreshold(10)); 227 KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 228 228 //KEY_PRESSED(KC_T, 1, change); 229 229 … … 250 250 251 251 setAlgorithm(mCurrentAlgorithm); 252 } 253 //----------------------------------------------------------------------- 254 void MouseQueryListener::toggleUseOptimization() 255 { 256 mUseOptimization = !mUseOptimization; 257 258 mSceneMgr->setOption("UseOptimization", &mUseOptimization); 259 260 if(mUseOptimization) 261 mUseOptimizationInfo->setCaption(": true"); 262 else 263 mUseOptimizationInfo->setCaption(": false"); 264 } 265 //----------------------------------------------------------------------- 266 void MouseQueryListener::toggleShowOctree() 267 { 268 mShowOctree = !mShowOctree; 269 270 mSceneMgr->setOption("ShowOctree", &mShowOctree); 252 271 } 253 272 //----------------------------------------------------------------------- -
trunk/VUT/work/TestCulling/TestCullingApplication.h
r85 r86 64 64 void changeThreshold(int incr); 65 65 void changeStats(); 66 void toggleUseOptimization(); 67 void toggleShowOctree(); 66 68 67 69 protected: … … 83 85 OverlayElement *mRenderedNodesInfo; 84 86 OverlayElement *mNumObjectsInfo; 87 OverlayElement *mUseOptimizationInfo; 85 88 86 89 SceneContentGenerator *mSceneContentGenerator; 90 91 bool mUseOptimization; 92 bool mShowOctree; 87 93 }; 88 94 -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r85 r86 96 96 97 97 mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr); 98 99 mTerrainContentGenerator->GenerateScene(500, "ninja.mesh"); 98 100 mTerrainContentGenerator->GenerateScene(500, "robot.mesh"); 101 99 102 // no limitations needed anymore: the user can set 100 103 // objects also on peaks of terrain … … 137 140 CEGUI::Renderer *renderer, 138 141 TerrainContentGenerator *sceneGenerator): 139 ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), 140 mShutdownRequested(false) 141 { 142 // Setup default variables 143 mCurrentObject = NULL; 144 mLMouseDown = false; 145 mRMouseDown = false; 146 mSceneMgr = sceneManager; 147 mTerrainContentGenerator = sceneGenerator; 148 149 // Reduce move speed 142 ExampleFrameListener(win, cam, false, true), 143 mGUIRenderer(renderer), 144 mShutdownRequested(false), 145 mUseOptimization(false), 146 mLMouseDown(false), 147 mRMouseDown(false), 148 mSceneMgr(sceneManager), 149 mCurrentObject(NULL), 150 mTerrainContentGenerator(sceneGenerator), 151 mVisibilityThreshold(0), 152 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING) 153 { 154 // Reduce move speed 150 155 mMoveSpeed = 50; 151 156 mRotateSpeed *= 2; 152 153 mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING;154 mVisibilityThreshold = 0;155 157 156 158 // Register this so that we get mouse events. … … 173 175 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 174 176 mNumObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/NumObjectsInfo"); 177 mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 175 178 176 179 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); … … 182 185 mRenderedNodesInfo->setCaption(": 0"); 183 186 mNumObjectsInfo->setCaption(": 0"); 187 mUseOptimizationInfo->setCaption(": true"); 184 188 185 189 setAlgorithm(mCurrentAlgorithm); 190 toggleUseOptimization(); 191 toggleShowOctree(); 186 192 187 193 pOver->show(); … … 293 299 KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); 294 300 KEY_PRESSED(KC_ADD, 0, changeThreshold(10)); 301 KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 302 KEY_PRESSED(KC_S, 0.3, toggleShowOctree()); 295 303 //KEY_PRESSED(KC_T, 1, change); 296 304 … … 321 329 void MouseQueryListener::setAlgorithm(int algorithm) 322 330 { 331 //OutputDebugString("changing algorithm\n"); 323 332 mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 324 333 mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); … … 347 356 sprintf(str,": %d", mTerrainContentGenerator->GetObjectCount()); 348 357 mNumObjectsInfo->setCaption(str); 358 } 359 //----------------------------------------------------------------------- 360 void MouseQueryListener::toggleUseOptimization() 361 { 362 mUseOptimization = !mUseOptimization; 363 364 mSceneMgr->setOption("UseOptimization", &mUseOptimization); 365 366 if(mUseOptimization) 367 mUseOptimizationInfo->setCaption(": true"); 368 else 369 mUseOptimizationInfo->setCaption(": false"); 370 } 371 //----------------------------------------------------------------------- 372 void MouseQueryListener::toggleShowOctree() 373 { 374 mShowOctree = !mShowOctree; 375 376 mSceneMgr->setOption("ShowOctree", &mShowOctree); 349 377 } 350 378 //----------------------------------------------------------------------- -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r85 r86 63 63 void changeThreshold(int incr); 64 64 void changeStats(); 65 void toggleUseOptimization(); 66 void toggleShowOctree(); 65 67 66 68 protected: … … 80 82 OverlayElement *mTraversedNodesInfo; 81 83 OverlayElement *mHierarchyNodesInfo; 82 //OverlayElement *mSceneNodesInfo;84 OverlayElement *mUseOptimizationInfo; 83 85 OverlayElement *mRenderedNodesInfo; 84 86 OverlayElement *mNumObjectsInfo; … … 89 91 RayQueryExecutor *mRayQueryExecutor; 90 92 TerrainContentGenerator *mTerrainContentGenerator; 93 94 bool mUseOptimization; 95 bool mShowOctree; 91 96 }; 92 97
Note: See TracChangeset
for help on using the changeset viewer.