Changeset 106


Ignore:
Timestamp:
05/20/05 20:28:30 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT
Files:
2 deleted
7 edited

Legend:

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

    r104 r106  
    1515//----------------------------------------------------------------------- 
    1616SceneContentGenerator::SceneContentGenerator(SceneManager *sm): 
    17 mSceneMgr(sm), mCount(0), 
     17mSceneMgr(sm), mObjectCount(0), 
    1818mMinPos(Vector3(-70.0f, -70.0f, 0.0f)), 
    1919mMaxPos(Vector3(70.0f, 70.0f, 600.0f)),  
     
    3232        Vector3 translationRatio; 
    3333 
    34         int currentCount = mCount; 
     34        int currentCount = mObjectCount; 
    3535        int limit = 0; 
    3636 
    3737        //-- create random values between zero and one 
    38         while ((mCount - currentCount < numObjects) && (limit < 50000)) 
     38        while ((mObjectCount - currentCount < numObjects) && (limit < 50000)) 
    3939        { 
    4040                rotationRatio.x = rand() / (float) RAND_MAX; 
     
    5959{ 
    6060        char name[25]; 
    61         sprintf(name, "Entity%d", mCount++); 
     61        sprintf(name, "Entity%d", mObjectCount++); 
    6262                 
    6363        Entity *ent = mSceneMgr->createEntity(name, objName); 
     
    9898int SceneContentGenerator::GetObjectCount() 
    9999{ 
    100         return mCount; 
     100        return mObjectCount; 
    101101} 
    102102//----------------------------------------------------------------------- 
  • trunk/VUT/work/TestCulling/SceneContentGenerator.h

    r86 r106  
    4646 
    4747        SceneManager *mSceneMgr; 
    48         int mCount;             // The number of objects on the screen 
     48        int mObjectCount;               // The number of objects on the screen 
    4949}; 
    5050 
  • trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.cpp

    r104 r106  
    6969{ 
    7070        Vector3 queryResult; 
    71          
     71        Vector3 pos(position.x, 5000, position.z); 
    7272        if (mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y)) 
    7373        { 
  • trunk/VUT/work/TestCullingTerrain/TerrainContentGenerator.h

    r104 r106  
    2222}; 
    2323 
    24 /** Class which fills a terrain with content in a random fashion  
     24/**  
     25        Class which randomly fills a terrain with objects. 
    2526*/ 
    2627class TerrainContentGenerator: public SceneContentGenerator 
     
    3031        ~TerrainContentGenerator(); 
    3132 
     33        /**  
     34                Generates objects and places it on the terrain 
     35        */ 
    3236        SceneNode *GenerateSceneObject(const Vector3 &position,  
    3337                const Vector3 &rotation, const String &objName); 
    34  
     38         
     39        /** maximum height where objects can be put into the terrain */ 
    3540        void SetMaxHeight(Real maxHeight); 
    3641         
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp

    r105 r106  
    192192mCamNode(camNode), 
    193193mCullCamera(false), 
    194 mDirection(Vector3::ZERO), 
    195 mDistance(0) 
     194mState(WALKTHROUGH), 
     195mCurrentFrame(1) 
    196196{ 
    197197        // Reduce move speed 
     
    241241        mSceneMgr->setOption("RenderNodesForViz", &mRenderNodesForViz); 
    242242 
    243         // Create the walking list 
    244         /*Vector3 queryResult; 
    245         mWalkList.push_back(Vector3(1550.0f, 5000.0f, 250.0f)); 
    246         mWalkList.push_back(Vector3(100.0f, 5000.0f, 750.0f)); 
    247  
    248         mTerrainContentGenerator->GenerateSceneObject(mCamera->getPosition(), Vector3::ZERO, "knot.mesh"); 
    249         mTerrainContentGenerator->GenerateSceneObject(Vector3(1550.0f, 5000.0f, 250.0f), Vector3::ZERO, "knot.mesh"); 
    250         mTerrainContentGenerator->GenerateSceneObject(Vector3(100.0f, 5000.0f, 750.0f), Vector3::ZERO, "knot.mesh"); 
    251 */ 
    252243        pOver->show(); 
    253244}  
     
    337328        switch (mState) 
    338329        { 
    339         case STATE_RECORD: 
     330        case REPLAY: 
     331                SetCurrentCameraPath(mCamNode); 
     332                mCamNode->setPosition(mCameraPath[mCurrentFrame].position); 
     333                mCamNode->setOrientation(mCameraPath[mCurrentFrame].orientation); 
     334                (mCurrentFrame++) % mCameraPath.size(); 
     335                break; 
     336        case WALKTHROUGH: 
    340337                Clamp2Terrain(); 
    341         case STATE_REPLAY: 
    342                  
    343                 mCamera->setPosition(mPosition[mCurrentFrame]); 
    344                 mCamera->setOrientation( 
    345         case STATE_: 
    346          
    347  
    348         // save for walkthrough 
    349         if(mState == STATE_RECORD) 
    350         { 
    351                 mPositions.push_back(mCamera->GetPosition()); 
    352                 mOrientations.push_back(mCamera->GetOrientation()); 
    353         } 
    354          
    355  
     338 
     339        case RECORD: 
     340                AddCameraPath(mCamNode); 
     341                break; 
     342        default: 
     343                break; 
     344        }; 
     345         
    356346        if (mShowVisualization) 
    357347        { 
     
    413403        KEY_PRESSED(KC_3, 0, zoomVizCamera(50)); 
    414404        KEY_PRESSED(KC_4, 0, zoomVizCamera(-50)); 
    415          
     405        KEY_PRESSED(KC_F1, 0, setState(RECORD)); 
     406        KEY_PRESSED(KC_F2, 0, setState(REPLAY)); 
     407        KEY_PRESSED(KC_F3, 0, setState(WALKTHROUGH)); 
    416408        updateStats(); 
    417409 
     
    593585        e->consume(); 
    594586} 
     587//----------------------------------------------------------------------- 
     588void MouseQueryListener::AddCameraPath(SceneNode *camNode) 
     589{ 
     590        frame_info info; 
     591        info.orientation = mCamNode->getOrientation(); 
     592        info.position = mCamNode->getPosition(); 
     593        mCameraPath.push_back(info); 
     594} 
     595//----------------------------------------------------------------------- 
     596void MouseQueryListener::SetCurrentCameraPath(SceneNode *camNode) 
     597{ 
     598        mCamNode->setPosition(mCameraPath[mCurrentFrame].position); 
     599        mCamNode->setOrientation(mCameraPath[mCurrentFrame].orientation); 
     600        (mCurrentFrame++) % mCameraPath.size(); 
     601} 
     602 
    595603/**************************************************************/ 
    596604/*      VisualizationRenderTargetListener implementation      */ 
    597605/**************************************************************/ 
     606 
    598607VisualizationRenderTargetListener::VisualizationRenderTargetListener(SceneManager *sceneMgr) 
    599608:RenderTargetListener(), mSceneMgr(sceneMgr) 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h

    r105 r106  
    88#include "VisibilityEnvironment.h" 
    99#include <OgreRenderTargetListener.h> 
    10 #include <vector.h> 
     10#include <vector> 
    1111 
    1212Real timeDelay = 0; 
     
    2626        "Coherent Hierarchical Culling" 
    2727}; 
    28 typedef struct frame_info 
     28 
     29/** The information about camera position and orienation per frame */ 
     30typedef struct 
    2931{ 
     32        Vector3 position; 
     33        Quaternion orientation; 
     34} frame_info; 
    3035 
    31 } 
    32         Position 
    33 typedef std::pair<Vector3 frame_pair 
     36 
    3437class VisualizationRenderTargetListener: public RenderTargetListener 
    3538{ 
     
    4750{ 
    4851public: 
    49  
     52         
    5053    MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager,  
    5154                CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator, Camera *vizCamera, 
     
    9295        void zoomVizCamera(int zoom); 
    9396        void moveCamera(); 
     97        void AddCameraPath(SceneNode *camNode); 
     98        void SetCurrentCameraPath(SceneNode *camNode); 
     99 
     100        enum {WALKTHROUGH, REPLAY} State; 
    94101 
    95102 
    96103protected: 
    97104        void Clamp2Terrain(); 
    98  
    99         bool NextLocation(); 
    100  
     105         
    101106    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down 
    102107    SceneManager *mSceneMgr;           // A pointer to the scene manager 
     
    107112        int mCurrentAlgorithm; 
    108113        int mVisibilityThreshold; 
    109  
     114         
    110115        OverlayElement *mAlgorithmInfo; 
    111116        OverlayElement *mThresholdInfo; 
     
    120125 
    121126        SceneNode *mCurrentObject;         // The newly created object 
    122         int mCount;                        // The number of robots on the screen 
     127        int mObjectCount;                 // The number of robots on the screen 
    123128 
    124129        RayQueryExecutor *mRayQueryExecutor; 
     
    136141        Camera *mVizCamera; 
    137142        SceneNode *mCamNode; 
    138         Real mWalkSpeed; 
    139         Real mDistance; 
    140         Vector3 mDestination; 
    141         Vector3 mDirection; 
    142  
     143         
    143144        //std::deque<Vector3> mWalkList;   // The list of points we are walking to 
    144         vector< 
    145         std::vector<Ogre::Vector3> mPositions; 
    146         std::vector<Ogre::Quaternion> mOrientations; 
    147  
     145        std::vector<frame_info> mCameraPath; 
     146                 
     147        int mCurrentFrame; 
     148        // the current application state 
     149        int mState; 
    148150}; 
    149151 
Note: See TracChangeset for help on using the changeset viewer.