Changeset 86 for trunk/VUT/work


Ignore:
Timestamp:
05/06/05 01:39:32 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/work
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/work/TestCulling/SceneContentGenerator.cpp

    r85 r86  
    2020mMaxPos(Vector3(70.0f, 70.0f, 600.0f)),  
    2121mMinAngle(Vector3(0.0f, 0.0f, 0.0f)), 
    22 mMaxAngle(Vector3(360, 360, 360)) 
     22mMaxAngle(Vector3(360, 360, 360)), 
     23mScale(0.05, 0.05, 0.05) 
    2324{ 
    2425} 
     
    6768 
    6869        currentObject->attachObject(ent); 
    69         currentObject->setScale(0.1f, 0.1f, 0.1f); 
     70        currentObject->setScale(mScale); 
    7071                 
    7172        currentObject->yaw(Degree(rotation.x)); 
     
    106107        return mCount; 
    107108} 
     109//----------------------------------------------------------------------- 
     110void SceneContentGenerator::SetScale(Vector3 scale) 
     111{ 
     112        mScale = scale; 
     113} 
    108114} // namespace Ogre 
  • trunk/VUT/work/TestCulling/SceneContentGenerator.h

    r85 r86  
    3535        void SetMaxPos(Vector3 maxPos); 
    3636        int GetObjectCount(); 
     37        void SetScale(Vector3 scale); 
    3738 
    3839protected: 
     
    4243        Vector3 mMaxPos; 
    4344        Vector3 mMinPos; 
    44          
     45        Vector3 mScale; 
     46 
    4547        SceneManager *mSceneMgr; 
    4648        int mCount;             // The number of objects on the screen 
  • trunk/VUT/work/TestCulling/TestCullingApplication.cpp

    r85 r86  
    5454 
    5555        mSceneContentGenerator = new SceneContentGenerator(mSceneMgr); 
    56         mSceneContentGenerator->GenerateScene(330, "robot.mesh"); 
     56        mSceneContentGenerator->GenerateScene(3000, "sphere.mesh"); 
    5757 
    5858        // Create a skybox 
     
    101101                                                                           CEGUI::Renderer *renderer, 
    102102                                                                           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), 
     104mSceneMgr(sceneManager), 
     105mGUIRenderer(renderer),  
     106mShutdownRequested(false),  
     107mUseOptimization(false), 
     108mLMouseDown(false), 
     109mRMouseDown(false), 
     110mSceneContentGenerator(sceneContentGenerator), 
     111mVisibilityThreshold(0), 
     112mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING) 
     113{ 
    115114    // Reduce move speed 
    116115        mMoveSpeed = 50; 
    117116        mRotateSpeed *= 2; 
    118  
    119         mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 
    120         mVisibilityThreshold = 0; 
    121      
     117  
    122118        // Register this so that we get mouse events. 
    123119        mEventProcessor->addMouseListener(this); 
     
    137133        mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 
    138134        mNumObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/NumObjectsInfo"); 
     135        mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 
    139136 
    140137        mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 
     
    146143        mRenderedNodesInfo->setCaption(": 0"); 
    147144        mNumObjectsInfo->setCaption(": 0"); 
     145        mUseOptimizationInfo->setCaption(": true"); 
    148146 
    149147        setAlgorithm(mCurrentAlgorithm); 
     148        toggleUseOptimization(); 
    150149 
    151150    pOver->show(); 
     
    226225        KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); 
    227226        KEY_PRESSED(KC_ADD, 0, changeThreshold(10)); 
     227        KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 
    228228        //KEY_PRESSED(KC_T, 1, change); 
    229229       
     
    250250 
    251251        setAlgorithm(mCurrentAlgorithm); 
     252} 
     253//----------------------------------------------------------------------- 
     254void 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//----------------------------------------------------------------------- 
     266void MouseQueryListener::toggleShowOctree() 
     267{ 
     268        mShowOctree = !mShowOctree; 
     269 
     270        mSceneMgr->setOption("ShowOctree", &mShowOctree); 
    252271} 
    253272//----------------------------------------------------------------------- 
  • trunk/VUT/work/TestCulling/TestCullingApplication.h

    r85 r86  
    6464        void changeThreshold(int incr); 
    6565        void changeStats(); 
     66        void toggleUseOptimization(); 
     67        void toggleShowOctree(); 
    6668 
    6769protected: 
     
    8385        OverlayElement *mRenderedNodesInfo; 
    8486        OverlayElement *mNumObjectsInfo; 
     87        OverlayElement *mUseOptimizationInfo; 
    8588 
    8689        SceneContentGenerator *mSceneContentGenerator; 
     90 
     91        bool mUseOptimization; 
     92        bool mShowOctree; 
    8793}; 
    8894 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp

    r85 r86  
    9696 
    9797        mTerrainContentGenerator = new TerrainContentGenerator(mSceneMgr); 
     98         
     99        mTerrainContentGenerator->GenerateScene(500, "ninja.mesh"); 
    98100        mTerrainContentGenerator->GenerateScene(500, "robot.mesh"); 
     101 
    99102        // no limitations needed anymore: the user can set  
    100103        // objects also on peaks of terrain 
     
    137140                                                                           CEGUI::Renderer *renderer, 
    138141                                                                           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 
     142ExampleFrameListener(win, cam, false, true),  
     143mGUIRenderer(renderer),  
     144mShutdownRequested(false),  
     145mUseOptimization(false), 
     146mLMouseDown(false), 
     147mRMouseDown(false), 
     148mSceneMgr(sceneManager), 
     149mCurrentObject(NULL), 
     150mTerrainContentGenerator(sceneGenerator), 
     151mVisibilityThreshold(0), 
     152mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING) 
     153{ 
     154        // Reduce move speed 
    150155        mMoveSpeed = 50; 
    151156        mRotateSpeed *= 2; 
    152  
    153         mCurrentAlgorithm = GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 
    154         mVisibilityThreshold = 0; 
    155157     
    156158        // Register this so that we get mouse events. 
     
    173175        mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 
    174176        mNumObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/NumObjectsInfo"); 
     177        mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 
    175178 
    176179        mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 
     
    182185        mRenderedNodesInfo->setCaption(": 0"); 
    183186        mNumObjectsInfo->setCaption(": 0"); 
     187        mUseOptimizationInfo->setCaption(": true"); 
    184188 
    185189        setAlgorithm(mCurrentAlgorithm); 
     190        toggleUseOptimization(); 
     191        toggleShowOctree(); 
    186192 
    187193    pOver->show(); 
     
    293299        KEY_PRESSED(KC_SUBTRACT, 0, changeThreshold(-10)); 
    294300        KEY_PRESSED(KC_ADD, 0, changeThreshold(10)); 
     301        KEY_PRESSED(KC_O, 0.3, toggleUseOptimization()); 
     302        KEY_PRESSED(KC_S, 0.3, toggleShowOctree()); 
    295303        //KEY_PRESSED(KC_T, 1, change); 
    296304       
     
    321329void MouseQueryListener::setAlgorithm(int algorithm) 
    322330{ 
     331        //OutputDebugString("changing algorithm\n"); 
    323332        mAlgorithmInfo->setCaption(": " + mCurrentAlgorithmCaptions[mCurrentAlgorithm]); 
    324333        mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); 
     
    347356        sprintf(str,": %d", mTerrainContentGenerator->GetObjectCount());  
    348357        mNumObjectsInfo->setCaption(str); 
     358} 
     359//----------------------------------------------------------------------- 
     360void 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//----------------------------------------------------------------------- 
     372void MouseQueryListener::toggleShowOctree() 
     373{ 
     374        mShowOctree = !mShowOctree; 
     375 
     376        mSceneMgr->setOption("ShowOctree", &mShowOctree); 
    349377} 
    350378//----------------------------------------------------------------------- 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h

    r85 r86  
    6363        void changeThreshold(int incr); 
    6464        void changeStats(); 
     65        void toggleUseOptimization(); 
     66        void toggleShowOctree(); 
    6567 
    6668protected: 
     
    8082    OverlayElement *mTraversedNodesInfo; 
    8183        OverlayElement *mHierarchyNodesInfo; 
    82         //OverlayElement *mSceneNodesInfo; 
     84        OverlayElement *mUseOptimizationInfo; 
    8385        OverlayElement *mRenderedNodesInfo; 
    8486        OverlayElement *mNumObjectsInfo; 
     
    8991        RayQueryExecutor *mRayQueryExecutor; 
    9092        TerrainContentGenerator *mTerrainContentGenerator; 
     93 
     94        bool mUseOptimization; 
     95        bool mShowOctree; 
    9196}; 
    9297 
Note: See TracChangeset for help on using the changeset viewer.