Ignore:
Timestamp:
06/20/08 19:33:41 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BinaryLoader.cpp

    r2786 r2792  
    207207        { 
    208208                SceneEntity *ent = LoadSceneEntity(str); 
    209                 ent->id = i; 
    210209                entities[i] = ent; 
    211210        } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp

    r2790 r2792  
    7979mTestNodesIdx(-1), 
    8080mIndicesPtr(-1), 
    81 mIndices(NULL), 
    8281mId(0), 
    8382mIsMaxDepthForVirtualLeaf(false), 
     
    9594{ 
    9695        mVisibility.Reset(); 
    97  
    9896        mLastRenderedFrame = -999; 
    9997} 
     
    111109 
    112110 
     111BvhInterior::~BvhInterior()  
     112{ 
     113        DEL_PTR(mBack); 
     114        DEL_PTR(mFront);  
     115} 
     116 
     117 
    113118BvhLeaf::~BvhLeaf() 
    114119{ 
     
    151156Bvh::~Bvh()  
    152157{ 
    153         if (mVertices) delete []mVertices;  
     158        if (mVertices) delete [] mVertices;  
    154159        if (mIndices) delete [] mIndices; 
    155160        if (mTestIndices) delete [] mTestIndices; 
     
    157162 
    158163        if (mRoot) delete mRoot; 
     164 
     165        // delete vbo 
     166        glDeleteBuffersARB(1, &mVboId); 
    159167} 
    160168 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h

    r2790 r2792  
    190190        int mLast; 
    191191 
    192         /// these nodes can be tested instead of the current node 
     192        /// the bounding boxes of these nodes are queries instead of the current node 
    193193        int mTestNodesIdx; 
    194          
     194        /// the number of tighter bounding volumes used for this node 
    195195        int mNumTestNodes; 
    196  
     196        /// used for efficient element array rendering 
    197197        int mIndicesPtr; 
    198198 
     
    203203        /// the index of this node 
    204204        unsigned int mId; 
    205         /// indices used for draw array rendering 
    206         unsigned int *mIndices; 
    207205        /// the bounding box 
    208206        AxisAlignedBox3 mBox; 
     
    342340        */ 
    343341        inline BvhNode *GetFront() { return mFront; } 
    344         /** recursivly delete tree. 
    345         */ 
    346         virtual ~BvhInterior() { if (mBack) delete mBack; if (mFront) delete mFront;} 
    347  
     342        /** Recursivly delete hierarchy. 
     343        */ 
     344        virtual ~BvhInterior(); 
    348345 
    349346protected: 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp

    r2790 r2792  
    2727                        { 
    2828                                BvhNode *node = query->GetNodes()[i]; 
    29                                 OcclusionQuery *q = IssueOcclusionQuery(node, false); 
     29                                OcclusionQuery *q = IssueOcclusionQuery(node); 
    3030                                mQueryQueue.push(q); 
    3131                        } 
     
    9191                                mVQueue.pop(); 
    9292                                 
    93                                 OcclusionQuery *query = IssueOcclusionQuery(node, true); 
     93                                OcclusionQuery *query = IssueOcclusionQuery(node); 
    9494 
    9595                                mQueryQueue.push(query); 
     
    128128                                         
    129129                                        // identify nodes that we cannot skip queries for 
    130                                         const bool testFeasible = (!wasVisible || (node->IsVirtualLeaf() &&  
     130                                        const bool queryFeasible = (!wasVisible || (node->IsVirtualLeaf() &&  
    131131                                                (node->GetAssumedVisibleFrameId() <= mFrameId))); 
    132132 
     
    139139                                         
    140140                                        // skip testing previously visible interior nodes 
    141                                         if (testFeasible) 
     141                                        if (queryFeasible) 
    142142                                        { 
    143143                                                if (!wasVisible) 
     
    202202                mVQueue.pop(); 
    203203 
    204                 OcclusionQuery *query = IssueOcclusionQuery(node, true); 
     204                OcclusionQuery *query = IssueOcclusionQuery(node); 
    205205                mQueryQueue.push(query); 
    206206        } 
     
    264264 
    265265        //cout <<"size: " << query->GetSize() << endl; 
    266         IssueOcclusionQuery(*query, false); 
     266        IssueOcclusionQuery(*query); 
    267267 
    268268        return query; 
     
    284284                        BvhNode *node = mIQueue.front(); 
    285285                        mIQueue.pop(); 
    286                         query = IssueOcclusionQuery(node, false); 
     286                        query = IssueOcclusionQuery(node); 
    287287                } 
    288288 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCTraverser.cpp

    r2782 r2792  
    88CHCTraverser::CHCTraverser()  
    99{} 
     10 
     11 
     12OcclusionQuery *CHCTraverser::IssueOcclusionQueryWithGeometry(BvhNode *node) 
     13{ 
     14        OcclusionQuery *query = mQueryHandler.RequestQuery(); 
     15        query->AddNode(node); 
     16 
     17        ++ mStats.mNumIssuedQueries; 
     18 
     19        query->BeginQuery(); 
     20 
     21        RenderNode(node); 
     22 
     23        if (mUseRenderQueue) 
     24        { 
     25                mRenderQueue.Render(); 
     26                mRenderQueue.Clear(); 
     27        } 
     28 
     29        query->EndQuery(); 
     30 
     31        return query; 
     32} 
    1033 
    1134 
     
    6588                                         
    6689                                        // identify nodes that we cannot skip queries for 
    67                                         const bool testFeasible = (!wasVisible ||  
     90                                        const bool queryFeasible = (!wasVisible ||  
    6891                                                (node->IsVirtualLeaf() && (node->GetAssumedVisibleFrameId() <= mFrameId))); 
    6992 
     
    7295                                         
    7396                                        // skip testing previously visible interior nodes 
    74                                         if (testFeasible) 
     97                                        if (queryFeasible) 
    7598                                        { 
    76                                                 OcclusionQuery *query = IssueOcclusionQuery(node, wasVisible); 
     99                                                OcclusionQuery *query; 
     100 
     101                                                // if this node is a previous visible leaf: 
     102                                                // leaves will be rendered anyway => we can directly query the real geometry  
     103                                                if (wasVisible && mUseOptimization) 
     104                                                        query = IssueOcclusionQueryWithGeometry(node); 
     105                                                else 
     106                                                        query = IssueOcclusionQuery(node); 
     107 
    77108                                                mQueryQueue.push(query); 
    78109                                        } 
     
    103134                } 
    104135        } 
     136 
     137        /// Empty render queue. 
     138        if (mUseRenderQueue) 
     139        { 
     140                mRenderQueue.Render(); 
     141                mRenderQueue.Clear(); 
     142        } 
    105143} 
    106144 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCTraverser.h

    r2782 r2792  
    1818         
    1919protected: 
     20        /** Optimized query querying the node geometry instead 
     21                of the bounding box 
     22        */ 
     23        OcclusionQuery *IssueOcclusionQueryWithGeometry(BvhNode *node); 
     24 
    2025        /** Traverses and renders the scene with the specified method 
    2126        */ 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp

    r2782 r2792  
    3737        } 
    3838 
    39         // render the rest of the objects 
     39        // render the contents of the render queue 
    4040        if (mUseRenderQueue) 
    4141        { 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp

    r2790 r2792  
    2525        mNumRenderedNodes = 0; 
    2626 
    27         mNumPreviouslyVisibleNodeQueries = 0; 
    2827        mNumIssuedQueries = 0; 
    2928        mNumStateChanges = 0; 
     
    166165{ 
    167166        mUseRenderQueue = useRenderQueue; 
    168         std::cout << "using render queue: " << mUseRenderQueue << std::endl; 
     167        //std::cout << "using render queue: " << mUseRenderQueue << std::endl; 
    169168} 
    170169 
     
    179178{ 
    180179        mUseOptimization = useOptimization; 
     180        //cout << "using optimization: " << mUseOptimization << endl; 
    181181} 
    182182 
     
    214214 
    215215 
    216 OcclusionQuery *RenderTraverser::IssueOcclusionQuery(BvhNode *node, bool wasVisible) 
     216OcclusionQuery *RenderTraverser::IssueOcclusionQuery(BvhNode *node) 
    217217{ 
    218218        OcclusionQuery *query = mQueryHandler.RequestQuery(); 
    219219        query->AddNode(node); 
    220220 
    221         IssueOcclusionQuery(*query, wasVisible); 
     221        IssueOcclusionQuery(*query); 
    222222 
    223223        return query; 
     
    225225 
    226226 
    227 void RenderTraverser::IssueOcclusionQuery(const OcclusionQuery &query, bool wasVisible) 
     227void RenderTraverser::IssueOcclusionQuery(const OcclusionQuery &query) 
    228228{ 
    229229        ++ mStats.mNumIssuedQueries; 
     
    238238        query.BeginQuery(); 
    239239 
    240         if (wasVisible) 
    241                 ++ mStats.mNumPreviouslyVisibleNodeQueries; 
    242  
    243         // if this node is a previous visible leaf: 
    244         // leaves will be rendered anyway => we can also test with the real geometry  
    245         if (wasVisible && mUseOptimization) 
    246         { 
    247                 for (size_t i = 0; i < query.GetSize(); ++ i) 
    248                         RenderNode(query.GetNodes()[i]); 
    249         } 
    250         else 
    251         { 
    252                 // change to query mode and render box 
    253                 if (mRenderState->SetState(RenderState::QUERY)) 
    254                         ++ mStats.mNumStateChanges; 
    255  
    256                 mBvh->RenderBounds(query.GetNodes(), mRenderState, mUseTightBounds); 
    257         } 
    258  
     240        // change to query mode and render box 
     241        if (mRenderState->SetState(RenderState::QUERY)) 
     242                ++ mStats.mNumStateChanges; 
     243 
     244        mBvh->RenderBounds(query.GetNodes(), mRenderState, mUseTightBounds); 
     245         
    259246        query.EndQuery(); 
    260247} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h

    r2790 r2792  
    3737        int mNumIssuedQueries; 
    3838        int mNumStateChanges; 
    39         int mNumPreviouslyVisibleNodeQueries; 
    4039         
    4140        double mRenderTime; 
     
    130129        /** Issues occlusion query for a single node 
    131130        */ 
    132         OcclusionQuery *IssueOcclusionQuery(BvhNode *node, bool wasVisible); 
     131        OcclusionQuery *IssueOcclusionQuery(BvhNode *node); 
    133132        /** Issue multiquery. 
    134133        */ 
    135         void IssueOcclusionQuery(const OcclusionQuery &query, bool wasVisible); 
     134        void IssueOcclusionQuery(const OcclusionQuery &query); 
    136135        /** Retunrs true if the current bvh node intersects the near plane. 
    137136        */ 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp

    r2782 r2792  
    1515mGeometry(geometry), mMaterial(mat), mTransform(trafo) 
    1616{ 
     17} 
     18 
     19 
     20SceneEntity::~SceneEntity() 
     21{ 
     22        // delete only trafo here, the other members could be shared 
     23        // among several entities and are therefore handled separately 
     24        DEL_PTR(mTransform); 
    1725} 
    1826 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h

    r2782 r2792  
    2121{ 
    2222public: 
    23 int id; 
    2423        /** Creates a scene entity. 
    2524        */ 
    2625        SceneEntity(Geometry *geometry, Material *mat, Matrix4x4 *trafo); 
     26 
     27        ~SceneEntity(); 
    2728        /** Renders this node. 
    2829        */ 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StopAndWaitTraverser.cpp

    r2782 r2792  
    3535                        else 
    3636                        { 
    37                                 OcclusionQuery *query = IssueOcclusionQuery(node, false); 
     37                                OcclusionQuery *query = IssueOcclusionQuery(node); 
    3838 
    3939                                int visiblePixels = query->GetQueryResult(); 
     
    6060                }        
    6161        } 
     62 
     63        /// Empty render queue. 
     64        if (mUseRenderQueue) 
     65        { 
     66                mRenderQueue.Render(); 
     67                mRenderQueue.Clear(); 
     68        } 
    6269} 
    6370 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2790 r2792  
    5151 
    5252const float keyForwardMotion = 1.0f; 
    53 const float keyRotation = 0.2f; 
     53const float keyRotation = 0.05f; 
    5454 
    5555int winWidth = 1024; 
     
    7676bool visMode = false; 
    7777 
    78 //mouse navigation state 
    79 int xEyeBegin, yEyeBegin, yMotionBegin, verticalMotionBegin, horizontalMotionBegin = 0; 
     78// mouse navigation state 
     79int xEyeBegin, yEyeBegin, yMotionBegin = 0; 
     80int verticalMotionBegin, horizontalMotionBegin = 0; 
    8081 
    8182bool useOptimization = false; 
     
    8889Matrix4x4 visView = IdentityMatrix(); 
    8990 
     91bool leftKeyPressed = false; 
     92bool rightKeyPressed = false; 
     93bool upKeyPressed = false; 
     94bool downKeyPressed = false; 
    9095 
    9196void InitExtensions(); 
     
    100105void DrawHelpMessage(); 
    101106 
    102 void begin2D(); 
    103 void end2D(); 
    104 void keyboard(unsigned char c, int x, int y); 
    105 void drawStatistics(); 
    106 void display(void); 
    107 void special(int c, int x, int y); 
    108 void reshape(int w, int h); 
    109 void mouse(int button, int state, int x, int y); 
    110 void leftMotion(int x, int y); 
    111 void rightMotion(int x, int y); 
    112 void middleMotion(int x, int y); 
    113 void drawEyeView(); 
    114 void setupVisView(); 
    115 void CalcDecimalPoint(std::string &str, int d); 
     107void Begin2D(); 
     108void End2D(); 
     109void KeyBoard(unsigned char c, int x, int y); 
     110void DrawStatistics(); 
     111void Display(); 
     112void Special(int c, int x, int y); 
     113void KeyUp(unsigned char c, int x, int y); 
     114void SpecialKeyUp(int c, int x, int y); 
     115void Reshape(int w, int h); 
     116void Mouse(int button, int state, int x, int y); 
     117void LeftMotion(int x, int y); 
     118void RightMotion(int x, int y); 
     119void MiddleMotion(int x, int y); 
     120void SetupVisView(); 
     121void CalcDecimalPoint(string &str, int d); 
    116122void ResetTraverser(); 
    117123 
     124void KeyHorizontalMotion(float shift); 
     125void KeyRotate(float angle); 
     126 
    118127 
    119128 
     
    122131        int returnCode = 0; 
    123132 
    124 #ifdef _CRT_SET 
     133//#ifdef _CRT_SET 
    125134 
    126135        //Now just call this function at the start of your program and if you're 
     
    133142        _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); 
    134143        _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR);  
    135 #endif 
     144//#endif 
    136145 
    137146 
     
    145154        glutCreateWindow("Coherent Hierarchical Culling"); 
    146155 
    147         glutDisplayFunc(display); 
    148         glutKeyboardFunc(keyboard); 
    149         glutSpecialFunc(special); 
    150         glutReshapeFunc(reshape); 
    151         glutMouseFunc(mouse); 
    152         glutIdleFunc(display); 
    153          
     156        glutDisplayFunc(Display); 
     157        glutKeyboardFunc(KeyBoard); 
     158        glutSpecialFunc(Special); 
     159        glutReshapeFunc(Reshape); 
     160        glutMouseFunc(Mouse); 
     161        glutIdleFunc(Display); 
     162        glutKeyboardUpFunc(KeyUp); 
     163        glutSpecialUpFunc(SpecialKeyUp); 
     164        glutIgnoreKeyRepeat(true); 
     165 
    154166        InitExtensions(); 
    155167        InitGLstate(); 
    156168 
    157         leftMotion(0, 0); 
    158         middleMotion(0, 0); 
     169        LeftMotion(0, 0); 
     170        MiddleMotion(0, 0); 
    159171 
    160172        BinaryLoader loader; 
     
    168180        { 
    169181                cerr << "loading scene " << filename << " failed" << endl; 
     182                CleanUp(); 
    170183                exit(0); 
    171184        } 
     185        CleanUp(); 
     186                exit(0); 
    172187 
    173188        const string bvh_filename = string(model_path + "city.bvh"); 
     
    179194        { 
    180195                cerr << "loading bvh " << bvh_filename << " failed" << endl; 
     196                CleanUp(); 
    181197                exit(0); 
    182198        } 
     
    268284                "'B'            - use tight bounds", 
    269285                "'M'            - use multiqueries", 
     286                "'O'            - use CHC optimization (geometry queries for leaves)", 
    270287                0, 
    271288        }; 
     
    297314                } 
    298315        } 
    299  
    300316} 
    301317 
     
    345361        glEnable(GL_LIGHT1); 
    346362 
    347         //glDisable(GL_LIGHT1); 
    348         //glDisable(GL_LIGHTING); 
    349  
    350363        //GLfloat ambient[] = {0.5, 0.5, 0.5, 1.0}; 
    351364        GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0}; 
     
    405418 
    406419 
    407 void display(void)  
    408 { 
     420void KeyRotate(float angle) 
     421{ 
     422        Vector3 viewDir = camera->GetDirection(); 
     423        // rotate view vector 
     424        Matrix4x4 rot = RotationZMatrix(angle); 
     425        viewDir = rot * viewDir; 
     426        camera->SetDirection(viewDir); 
     427} 
     428 
     429 
     430void KeyHorizontalMotion(float shift) 
     431{ 
     432        Vector3 hvec = camera->GetDirection(); 
     433        hvec.z = 0; 
     434 
     435        Vector3 pos = camera->GetPosition(); 
     436        pos += hvec * shift; 
     437         
     438        camera->SetPosition(pos); 
     439} 
     440 
     441 
     442void Display()  
     443{ 
     444        if (leftKeyPressed) 
     445                KeyRotate(keyRotation); 
     446        if (rightKeyPressed) 
     447                KeyRotate(-keyRotation); 
     448        if (upKeyPressed) 
     449                KeyHorizontalMotion(keyForwardMotion); 
     450        if (downKeyPressed) 
     451                KeyHorizontalMotion(-keyForwardMotion); 
     452 
    409453        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    410454 
     
    424468 
    425469#pragma warning( disable : 4100 ) 
    426 void keyboard(const unsigned char c, const int x, const int y)  
     470void KeyBoard(unsigned char c, int x, int y)  
    427471{ 
    428472        // used to avoid vertical motion with the keys 
     
    433477        { 
    434478        case 27: 
     479                CleanUp(); 
    435480                exit(0); 
    436481                break; 
     
    480525                        break; 
    481526                }        
    482         case 'g': 
    483         case 'G': 
     527        case 'o': 
     528        case 'O': 
    484529                useOptimization = !useOptimization; 
    485530                traverser->SetUseOptimization(useOptimization); 
     
    488533        case 'A': 
    489534                { 
    490                         Vector3 viewDir = camera->GetDirection(); 
    491                         // rotate view vector 
    492                         Matrix4x4 rot = RotationZMatrix(keyRotation); 
    493                         viewDir = rot * viewDir; 
    494                         camera->SetDirection(viewDir); 
     535                        leftKeyPressed = true; 
     536                        KeyRotate(keyRotation); 
    495537                } 
    496538                break; 
     
    498540        case 'D': 
    499541        { 
    500                         Vector3 viewDir = camera->GetDirection(); 
    501                         // rotate view vector 
    502                         Matrix4x4 rot = RotationZMatrix(-keyRotation); 
    503                         viewDir = rot * viewDir; 
    504                         camera->SetDirection(viewDir); 
     542                        rightKeyPressed = true; 
     543                        KeyRotate(-keyRotation); 
    505544                } 
    506545                break; 
     
    508547        case 'W': 
    509548                { 
    510                         Vector3 pos = camera->GetPosition(); 
    511                         pos += hvec * keyForwardMotion; 
    512                         camera->SetPosition(pos); 
     549                        upKeyPressed = true; 
     550                        KeyHorizontalMotion(keyForwardMotion); 
    513551                } 
    514552                break; 
     
    516554        case 'X': 
    517555                { 
    518                         Vector3 pos = camera->GetPosition(); 
    519                         pos -= hvec * keyForwardMotion; 
    520                         camera->SetPosition(pos); 
     556                        downKeyPressed = true; 
     557                        KeyHorizontalMotion(-keyForwardMotion); 
    521558                } 
    522559                break; 
     
    535572                } 
    536573                break; 
     574 
     575 
     576 
    537577        default: 
    538578                return; 
     
    543583 
    544584 
    545 void special(int c, int x, int y)  
     585void SpecialKeyUp(int c, int x, int y)  
     586{ 
     587        switch (c)  
     588        { 
     589        case GLUT_KEY_LEFT: 
     590                leftKeyPressed = false; 
     591                break; 
     592        case GLUT_KEY_RIGHT: 
     593                rightKeyPressed = false; 
     594                break; 
     595        case GLUT_KEY_UP: 
     596                upKeyPressed = false; 
     597                break; 
     598        case GLUT_KEY_DOWN: 
     599                downKeyPressed = false; 
     600                break; 
     601        default: 
     602                return; 
     603        } 
     604        //glutPostRedisplay(); 
     605} 
     606 
     607 
     608void KeyUp(unsigned char c, int x, int y)  
     609{ 
     610        switch (c)  
     611        { 
     612        case 'A': 
     613        case 'a': 
     614                leftKeyPressed = false; 
     615                break; 
     616        case 'D': 
     617        case 'd': 
     618                rightKeyPressed = false; 
     619                break; 
     620        case 'W': 
     621        case 'w': 
     622                upKeyPressed = false; 
     623                break; 
     624        case 'X': 
     625        case 'x': 
     626                downKeyPressed = false; 
     627                break; 
     628        default: 
     629                return; 
     630        } 
     631        //glutPostRedisplay(); 
     632} 
     633 
     634 
     635void Special(int c, int x, int y)  
    546636{ 
    547637        // used to avoid vertical motion with the keys 
     
    568658        case GLUT_KEY_LEFT: 
    569659                { 
    570                         Vector3 viewDir = camera->GetDirection(); 
    571                         // rotate view vector 
    572                         Matrix4x4 rot = RotationZMatrix(keyRotation); 
    573                         viewDir = rot * viewDir; 
    574                         camera->SetDirection(viewDir); 
     660                        leftKeyPressed = true; 
     661                        KeyRotate(keyRotation); 
    575662                } 
    576663                break; 
    577664        case GLUT_KEY_RIGHT: 
    578665                { 
    579                         Vector3 viewDir = camera->GetDirection(); 
    580                         // rotate view vector 
    581                         Matrix4x4 rot = RotationZMatrix(-keyRotation); 
    582                         viewDir = rot * viewDir; 
    583                         camera->SetDirection(viewDir); 
     666                        rightKeyPressed = true; 
     667                        KeyRotate(-keyRotation); 
    584668                } 
    585669                break; 
    586670        case GLUT_KEY_UP: 
    587671                { 
    588                         Vector3 pos = camera->GetPosition(); 
    589                         pos += hvec * 0.6f; 
    590                         camera->SetPosition(pos); 
     672                        upKeyPressed = true; 
     673                        KeyHorizontalMotion(keyForwardMotion); 
    591674                } 
    592675                break; 
    593676        case GLUT_KEY_DOWN: 
    594677                { 
    595                         Vector3 pos = camera->GetPosition(); 
    596                         pos -= hvec * 0.6f; 
    597                         camera->SetPosition(pos); 
     678                        downKeyPressed = true; 
     679                        KeyHorizontalMotion(-keyForwardMotion); 
    598680                } 
    599681                break; 
     
    609691 
    610692 
    611 void reshape(const int w, const int h)  
     693void Reshape(int w, int h)  
    612694{ 
    613695        winAspectRatio = 1.0f; 
     
    631713 
    632714 
    633 void mouse(int button, int state, int x, int y)  
     715void Mouse(int button, int state, int x, int y)  
    634716{ 
    635717        if ((button == GLUT_LEFT_BUTTON) && (state == GLUT_DOWN)) 
     
    638720                yMotionBegin = y; 
    639721 
    640                 glutMotionFunc(leftMotion); 
     722                glutMotionFunc(LeftMotion); 
    641723        } 
    642724        else if ((button == GLUT_RIGHT_BUTTON) && (state == GLUT_DOWN)) 
     
    645727                yMotionBegin = y; 
    646728 
    647                 glutMotionFunc(rightMotion); 
     729                glutMotionFunc(RightMotion); 
    648730        } 
    649731        else if ((button == GLUT_MIDDLE_BUTTON) && (state == GLUT_DOWN)) 
     
    651733                horizontalMotionBegin = x; 
    652734                verticalMotionBegin = y; 
    653                 glutMotionFunc(middleMotion); 
     735                glutMotionFunc(MiddleMotion); 
    654736        } 
    655737 
     
    661743        motion for up/down mouse drag 
    662744*/ 
    663 void leftMotion(int x, int y)  
     745void LeftMotion(int x, int y)  
    664746{ 
    665747        static float eyeXAngle = 0.0f; 
     
    694776        motion for up / down mouse drag 
    695777*/ 
    696 void rightMotion(int x, int y)  
     778void RightMotion(int x, int y)  
    697779{ 
    698780        static float eyeYAngle = 0.0f; 
     
    716798 
    717799// strafe 
    718 void middleMotion(int x, int y)  
     800void MiddleMotion(int x, int y)  
    719801{ 
    720802        Vector3 viewDir = camera->GetDirection(); 
     
    758840 
    759841 
    760 void begin2D(void)  
     842void Begin2D(void)  
    761843{ 
    762844        glDisable(GL_LIGHTING); 
     
    773855 
    774856 
    775 void end2D(void)  
     857void End2D(void)  
    776858{ 
    777859        glPopMatrix(); 
     
    803885void DisplayVisualization() 
    804886{ 
    805         setupVisView(); 
     887        SetupVisView(); 
    806888 
    807889        visualization->SetFrameId(traverser->GetCurrentFrameId()); 
    808890         
    809         begin2D(); 
     891        Begin2D(); 
    810892        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
    811893        glEnable(GL_BLEND); 
     
    814896        glRecti(winWidth, 0, winWidth - winWidth / 4, winHeight / 3); 
    815897        glDisable(GL_BLEND); 
    816         end2D(); 
     898        End2D(); 
    817899         
    818900        glViewport(winWidth - winWidth / 4, winHeight - winHeight / 3, winWidth, winHeight); 
     
    859941/** Sets up view matrix for bird eye view 
    860942*/ 
    861 void setupVisView() 
     943void SetupVisView() 
    862944{ 
    863945        Vector3 pos(-bvh->GetBox().Center()); 
     
    9781060 
    9791061        sprintf_s(msg7, "fps: %6.1f", fps); 
    980         //cout << "previously visible node queries: " << traverser->GetStats().mNumPreviouslyVisibleNodeQueries << endl; 
    981  
    982         begin2D(); 
     1062 
     1063 
     1064        Begin2D(); 
    9831065         
    9841066        if(showHelp) 
     
    10071089        } 
    10081090 
    1009         end2D(); 
     1091        End2D(); 
    10101092}        
Note: See TracChangeset for help on using the changeset viewer.