Changeset 1607 for GTP/trunk/App/Demos/Vis/HillyTerrain
- Timestamp:
- 10/10/06 20:28:52 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.cpp
r1604 r1607 90 90 //----------------------------------------------------------------------- 91 91 TerrainFrameListener::TerrainFrameListener(RenderWindow* win, Camera* cam, 92 SceneManager *sceneManager,93 CEGUI::Renderer *renderer,94 TerrainContentGenerator *sceneGenerator,95 Camera *vizCamera,96 SceneNode *camNode,97 Light *sunLight,98 TestCullingTerrainApplication *app):92 SceneManager *sceneManager, 93 CEGUI::Renderer *renderer, 94 TerrainContentGenerator *sceneGenerator, 95 Camera *vizCamera, 96 SceneNode *camNode, 97 Light *sunLight, 98 TestCullingTerrainApplication *app): 99 99 mCamera(cam), 100 100 mWindow(win), … … 161 161 mUseViewCells(false), 162 162 mViewCellsLoaded(false), 163 mUseVisibilityFilter(false) 163 mUseVisibilityFilter(false), 164 mFloorDist(2) 164 165 { 165 166 //mInputDevice = PlatformManager::getSingleton().createInputReader(); … … 398 399 } 399 400 400 if (mUseAnimation) // update animations 401 { 401 if (mUseAnimation) 402 { 403 // update animation phases 402 404 mApplication->updateAnimations(evt.timeSinceLastFrame); 403 405 } … … 482 484 } 483 485 486 ////////////// 484 487 //-- set application state 488 485 489 switch (mAppState) 486 490 { … … 516 520 else 517 521 { 518 mApplication->Clamp2FloorPlane( );522 mApplication->Clamp2FloorPlane(mFloorDist); 519 523 } 520 524 … … 967 971 mSceneMgr->setOption("NodeVizScale", &mVizScale); 968 972 } 969 973 //----------------------------------------------------------------------- 974 void TerrainFrameListener::changeFloorDist(const float incr) 975 { 976 mFloorDist += incr; 977 978 if (mFloorDist < 2) 979 { 980 mFloorDist = 2; 981 } 982 } 970 983 //----------------------------------------------------------------------- 971 984 void TerrainFrameListener::zoomVizCamera(int zoom) … … 1629 1642 changeVizScale(1); 1630 1643 } 1644 1645 if (mInputDevice->isKeyDown(KC_7)) 1646 { 1647 changeFloorDist(-1); 1648 } 1649 1650 if (mInputDevice->isKeyDown(KC_8)) 1651 { 1652 changeFloorDist(1); 1653 } 1654 1631 1655 1632 1656 // show the results -
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.h
r1604 r1607 231 231 */ 232 232 void toggleRecord(); 233 234 void changeFloorDist(const float incr); 233 235 234 236 /** Applies visibility query. Collects the visible objects … … 443 445 bool mViewCellsLoaded; 444 446 bool mUseVisibilityFilter; 447 448 float mFloorDist; 445 449 }; 446 450 -
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp
r1604 r1607 693 693 694 694 //----------------------------------------------------------------------- 695 bool TestCullingTerrainApplication::Clamp2FloorPlane( )695 bool TestCullingTerrainApplication::Clamp2FloorPlane(const float dist) 696 696 { 697 697 // clamp to floor plane … … 702 702 703 703 RaySceneQueryResult::iterator rit = qryResult.begin(); 704 704 bool success = false; 705 float yVal = 0; 706 float minVal = 999999999999; 707 705 708 while (rit != qryResult.end() && rit->movable) 706 709 { 707 710 if (rit->movable->getName() != "PlayerCam") 708 711 { 712 // place on the ground object 713 yVal = rit->movable->getWorldBoundingBox().getCenter().y; 714 if (yVal < minVal) 715 minVal = yVal; 716 717 //std::stringstream d; d << "dist: " << dist << endl; 718 //Ogre::LogManager() 719 success = true; 720 } 721 722 ++ rit; 723 } 724 725 // place on the ground object 726 if (success) 709 727 mCamNode->setPosition( 710 728 mCamNode->getPosition().x, 711 rit->movable->getWorldBoundingBox().getCenter().y + 2,729 minVal + dist, 712 730 mCamNode->getPosition().z); 713 714 return true; 715 } 716 717 ++ rit; 718 } 719 731 720 732 OGRE_DELETE(raySceneQuery); 721 return false;733 return success; 722 734 } 723 735 -
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.h
r1604 r1607 121 121 bool Clamp2Terrain(SceneNode *node, int terrainOffs); 122 122 123 /** Clamps camera to floor plane: used for vienna set.124 */ 125 bool Clamp2FloorPlane( );123 /** Clamps camera to floor plane: used e.g., for vienna set. 124 */ 125 bool Clamp2FloorPlane(const float dist); 126 126 127 127 /** Loads iv geometry.
Note: See TracChangeset
for help on using the changeset viewer.