Changeset 1607


Ignore:
Timestamp:
10/10/06 20:28:52 (18 years ago)
Author:
mattausch
Message:
 
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  
    9090//----------------------------------------------------------------------- 
    9191TerrainFrameListener::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):  
    9999mCamera(cam), 
    100100mWindow(win), 
     
    161161mUseViewCells(false), 
    162162mViewCellsLoaded(false), 
    163 mUseVisibilityFilter(false) 
     163mUseVisibilityFilter(false), 
     164mFloorDist(2) 
    164165{ 
    165166        //mInputDevice = PlatformManager::getSingleton().createInputReader(); 
     
    398399        } 
    399400 
    400         if (mUseAnimation) // update animations 
    401         { 
     401        if (mUseAnimation)  
     402        { 
     403                // update animation phases 
    402404                mApplication->updateAnimations(evt.timeSinceLastFrame); 
    403405        } 
     
    482484        } 
    483485 
     486        ////////////// 
    484487        //-- set application state 
     488 
    485489        switch (mAppState) 
    486490        { 
     
    516520                else 
    517521                { 
    518                         mApplication->Clamp2FloorPlane(); 
     522                        mApplication->Clamp2FloorPlane(mFloorDist); 
    519523                } 
    520524 
     
    967971        mSceneMgr->setOption("NodeVizScale", &mVizScale); 
    968972} 
    969  
     973//----------------------------------------------------------------------- 
     974void TerrainFrameListener::changeFloorDist(const float incr) 
     975{ 
     976        mFloorDist += incr;  
     977 
     978        if (mFloorDist < 2)  
     979        {        
     980                mFloorDist = 2; 
     981        } 
     982} 
    970983//----------------------------------------------------------------------- 
    971984void TerrainFrameListener::zoomVizCamera(int zoom) 
     
    16291642                changeVizScale(1); 
    16301643        } 
     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 
    16311655 
    16321656        // show the results 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.h

    r1604 r1607  
    231231        */ 
    232232        void toggleRecord(); 
     233 
     234        void changeFloorDist(const float incr); 
    233235 
    234236        /** Applies visibility query. Collects the visible objects  
     
    443445        bool mViewCellsLoaded; 
    444446        bool mUseVisibilityFilter; 
     447 
     448        float mFloorDist; 
    445449}; 
    446450 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp

    r1604 r1607  
    693693 
    694694//----------------------------------------------------------------------- 
    695 bool TestCullingTerrainApplication::Clamp2FloorPlane() 
     695bool TestCullingTerrainApplication::Clamp2FloorPlane(const float dist) 
    696696{ 
    697697    // clamp to floor plane 
     
    702702     
    703703        RaySceneQueryResult::iterator rit = qryResult.begin(); 
    704   
     704        bool success = false; 
     705float yVal = 0; 
     706float minVal = 999999999999; 
     707 
    705708        while (rit != qryResult.end() && rit->movable) 
    706709        { 
    707710                if (rit->movable->getName() != "PlayerCam") 
    708711                { 
     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) 
    709727                        mCamNode->setPosition( 
    710728                                mCamNode->getPosition().x, 
    711                                 rit->movable->getWorldBoundingBox().getCenter().y + 2,  
     729                                minVal + dist,  
    712730                                mCamNode->getPosition().z); 
    713          
    714                         return true; 
    715                 } 
    716  
    717                 ++ rit; 
    718         } 
    719      
     731 
    720732        OGRE_DELETE(raySceneQuery); 
    721         return false; 
     733        return success; 
    722734} 
    723735 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.h

    r1604 r1607  
    121121        bool Clamp2Terrain(SceneNode *node, int terrainOffs); 
    122122 
    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); 
    126126 
    127127        /** Loads iv geometry. 
Note: See TracChangeset for help on using the changeset viewer.