Changeset 2763 for GTP/trunk


Ignore:
Timestamp:
06/16/08 08:56:35 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/CHC_revisited
Files:
21 added
13 edited

Legend:

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

    r2762 r2763  
    175175        geometry.resize(shapeCount); 
    176176 
     177        for (size_t i = 0; i < geometry.size(); ++ i) 
     178                geometry[i] = NULL; 
     179         
     180 
    177181        int progress = 0; 
    178182 
    179183        for (int i = 0; i < shapeCount; ++ i) 
    180184        { 
    181                 int id; 
    182                 istr.read(reinterpret_cast<char *>(&id), sizeof(int)); 
    183  
     185                //int id;istr.read(reinterpret_cast<char *>(&id), sizeof(int)); 
    184186                SceneEntity *ent = LoadSceneEntity(istr); 
    185                 ent->id = id; 
    186  
    187                 geometry[id] = ent; 
     187                ent->id = i; 
     188 
     189                geometry[i] = ent; 
    188190                 
    189191                int p = (i + 1) * 100 / shapeCount; 
     
    191193                if (p >= progress) 
    192194                { 
    193                         //cout << "% loaded: " << p << endl; 
     195                        cout << "% loaded: " << p << endl; 
    194196                        progress += 10; 
    195197                } 
    196198        } 
    197199 
     200        for (size_t i = 0; i < geometry.size(); ++ i) 
     201        { 
     202                if (!geometry[i]) 
     203                        Debug << "error: index " << i << " missing" << endl; 
     204        } 
     205 
    198206        cout << "bin loading finished" << endl; 
    199207 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp

    r2762 r2763  
    295295{ 
    296296        // do the test only if necessary 
    297         if (1)//node->mPlaneMask & (1 << i)) 
    298         {//cout<<"plane "<< i << endl; 
    299                 bool outs = true; 
    300                 //-- test the n-vertex 
    301                 for (int j = 0; j < 8; ++ j) 
    302                 { 
    303                         if (sFrustum.mClipPlanes[i].Distance(node->mBox.GetVertex(j)) <= 0) outs = false; 
    304                 } 
    305                 if (outs) return 0; 
    306                 //if ((node->mBox.GetDistance(sClipPlaneAABBVertexIndices[i * 2 + 0], sFrustum.mClipPlanes[i]) > 0.0f)) 
    307                         //&&    (node->mBox.GetDistance(sClipPlaneAABBVertexIndices[i * 2 + 1], sFrustum.mClipPlanes[i]) > 0.0f)) 
    308                 { 
    309                         // outside 
    310                 //      node->mPreferredPlane = i; 
    311                         //cout<<"f " << node->mBox.GetDistance(sClipPlaneAABBVertexIndices[i * 2 + 0], sFrustum.mClipPlanes[i]) << " " << sFrustum.mClipPlanes[i] << endl; 
    312                 //      return false; 
    313                 }//else cout<<"ok " << node->mBox.GetDistance(sClipPlaneAABBVertexIndices[i * 2 + 0], sFrustum.mClipPlanes[i]) << " " << sFrustum.mClipPlanes[i] << endl; 
    314  
    315                 //-- test the p-vertex 
    316                 if (node->mBox.GetDistance(sClipPlaneAABBVertexIndices[i * 2 + 1], sFrustum.mClipPlanes[i]) <= 0.0f) 
    317                 { 
    318                         // completely inside: children don't need to check against this plane no more 
    319                         node->mPlaneMask^= 1 << i; 
    320                 } 
    321                 else  
    322                 { 
    323                         bIntersect = true; 
    324                 } 
    325         } 
    326  
     297        if (!(node->mPlaneMask & (1 << i))) 
     298                return true; 
     299                         
     300        //////// 
     301        //-- test the n-vertex 
     302                 
     303        if ((node->mBox.GetDistance(sClipPlaneAABBVertexIndices[i * 2 + 0], sFrustum.mClipPlanes[i]) > 0.0f)) 
     304        { 
     305                // outside 
     306                node->mPreferredPlane = i; 
     307                return false; 
     308        } 
     309 
     310        //////////// 
     311        //-- test the p-vertex 
     312 
     313        if (node->mBox.GetDistance(sClipPlaneAABBVertexIndices[i * 2 + 1], sFrustum.mClipPlanes[i]) <= 0.0f) 
     314        { 
     315                // completely inside: children don't need to check against this plane no more 
     316                node->mPlaneMask^= 1 << i; 
     317        } 
     318        else  
     319        { 
     320                bIntersect = true; 
     321        } 
     322         
    327323        return true; 
    328324} 
     
    337333 
    338334 
    339         for (int i = 0; i < 6; ++ i) 
    340         { 
    341                 if (!TestPlane(node, i, bIntersect)) return 0; 
    342         } 
     335        //for (int i = 0; i < 6; ++ i) 
     336        //      if (!TestPlane(node, i, bIntersect)) return 0; 
     337         
    343338 
    344339        //////// 
    345340        //-- apply frustum culling for the planes [mPreferredPlane - 5] 
    346 /* 
     341 
    347342        for (int i = node->mPreferredPlane; i < 6; ++ i) 
    348         { 
    349343                if (!TestPlane(node, i, bIntersect)) return 0; 
    350         } 
    351  
     344         
    352345        ////////// 
    353346        //-- do the view frustum culling for the planes [0 - m_iPreferredPlane) 
    354347 
    355348        for (int i = 0; i < node->mPreferredPlane; ++ i) 
    356         { 
    357349                if (!TestPlane(node, i, bIntersect)) return 0; 
    358         } 
    359 */ 
     350         
    360351        return bIntersect ? -1 : 1; 
    361352} 
     
    373364        sFrustum.CalcNPVertexIndices(sClipPlaneAABBVertexIndices); 
    374365 
    375         for (int i = 0; i<12; ++ i) 
    376 //cout<<" x " << sClipPlaneAABBVertexIndices[i]; 
    377 //      cout<<"\n********\n"; 
    378         // near plane 
     366        // store near plane 
    379367        sNearPlane = Plane3(mCamera->GetDirection(), mCamera->GetPosition()); 
    380  
    381368//      Debug << "near: " << sNearPlane << " d " << mCamera->GetDirection() << " " << mCamera->GetPosition() << std::endl; 
    382369//      for (int i = 0; i < 6; ++ i) Debug << "plane: " << sFrustum.mClipPlanes[i] << std::endl; 
     
    392379void Bvh::RenderBoundingBox(BvhNode *node) 
    393380{ 
    394         static BvhNodeContainer dummy(1); 
     381        RenderBoundingBoxImmediate(node->GetBox()); 
     382        /**static BvhNodeContainer dummy(1); 
    395383        dummy[0] = node; 
    396         RenderBoundingBoxes(dummy); 
     384        RenderBoundingBoxes(dummy);*/ 
    397385} 
    398386 
     
    870858 
    871859 
    872 void Bvh::Dummy() 
    873 { 
    874         for (int i = 0; i < mGeometrySize; ++ i) 
    875                 Debug << mGeometry[i]->id << " " << mGeometry[i]->GetGeometry()->GetBoundingBox() << endl; 
    876  
    877         AxisAlignedBox3 boxl; boxl.Initialize(); 
    878         AxisAlignedBox3 boxr; boxr.Initialize(); 
    879  
    880  
    881         for (int i = 0; i <= 107; ++ i) 
    882                 boxl.Include(mGeometry[i]->GetBoundingBox()); 
    883  
    884         for (int i = 108; i <= 193; ++ i) 
    885                 boxr.Include(mGeometry[i]->GetBoundingBox()); 
    886  
    887         Debug << "dummy " << boxl << " " << boxr << endl; 
    888  
    889         queue<BvhNode *> tStack; 
    890         tStack.push(mRoot); 
    891  
    892         while (!tStack.empty()) 
    893         { 
    894                 BvhNode *node = tStack.front();//top(); 
    895                 tStack.pop(); 
    896  
    897                 AxisAlignedBox3 box; 
    898                 box.Initialize(); 
    899  
    900                 int i = 0; 
    901                 for (int i = node->mFirst; i <= node->mLast; ++ i) 
    902                 { 
    903                         if ((mGeometry[i]->id < node->mFirst) || (mGeometry[i]->id > node->mLast)) 
    904                                 cout << "big error!! " << mGeometry[i]->id << endl; 
    905                         else cout << "ok"<<mGeometry[i]->id; 
    906                         box.Include(mGeometry[i]->GetBoundingBox()); 
    907                 } 
    908  
    909                 Debug<< box << " " << node->GetBox() << " f " << node->mFirst << " l " << node->mLast << " id " << node->GetId() << " l " << node->IsLeaf() << endl; 
    910  
    911                 //node->mBox = box; 
    912                 if (!node->IsLeaf()) 
    913                 { 
    914                         BvhInterior *interior = static_cast<BvhInterior *>(node); 
    915  
    916                         tStack.push(interior->mFront); 
    917                         tStack.push(interior->mBack); 
    918                 } 
    919         } 
    920 } 
    921  
    922  
    923860void Bvh::SetVirtualLeaves(int numTriangles)  
    924861{ 
     
    1006943 
    1007944 
    1008 } 
     945void Bvh::RenderBoundingBoxImmediate(const AxisAlignedBox3 &box) 
     946{ 
     947        const Vector3 l = box.Min(); 
     948        const Vector3 u = box.Max(); 
     949 
     950        /////////// 
     951        //-- render AABB as triangle strips 
     952 
     953        glVertex3f(l.x, l.y, u.z); 
     954        glVertex3f(u.x, l.y, u.z); 
     955        glVertex3f(l.x, u.y, u.z); 
     956        glVertex3f(u.x, u.y, u.z); 
     957        glVertex3f(l.x, u.y, l.z);  
     958        glVertex3f(u.x, u.y, l.z); 
     959        glVertex3f(l.x, l.y, l.z);  
     960        glVertex3f(u.x, l.y, l.z); 
     961 
     962        glPrimitiveRestartNV(); 
     963 
     964        //-- render second half of AABB 
     965        glVertex3f(l.x, u.y, u.z);  
     966        glVertex3f(l.x, u.y, l.z); 
     967        glVertex3f(l.x, l.y, u.z); 
     968        glVertex3f(l.x, l.y, l.z); 
     969        glVertex3f(u.x, l.y, u.z);  
     970        glVertex3f(u.x, l.y, l.z); 
     971        glVertex3f(u.x, u.y, u.z);  
     972        glVertex3f(u.x, u.y, l.z); 
     973} 
     974 
     975 
     976 
     977} 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.h

    r2762 r2763  
    440440 
    441441public: 
    442 void Dummy(); 
     442 
    443443        /** Destructor. 
    444444        */ 
     
    601601        inline bool TestPlane(BvhNode *node, int i, bool &bIntersect); 
    602602 
     603        void RenderBoundingBoxImmediate(const AxisAlignedBox3 &box); 
    603604 
    604605        //////////////////////// 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/BvhLoader.cpp

    r2762 r2763  
    2727 
    2828        if (nodeType == TYPE_LEAF) 
    29         { 
    30                 // cout << "l"; 
    3129                node = new BvhLeaf(parent); 
    32         } 
    3330        else if (nodeType == TYPE_INTERIOR) 
    34         { 
    35                 //cout << "i"; 
    3631                node = new BvhInterior(parent); 
    37         } 
    3832        else 
    39         { 
    40                 cerr << "wrong node type: " << nodeType << endl; 
    41                 //exit(0); 
    42         } 
     33                cerr << "error: wrong node type: " << nodeType << endl; 
     34                 
    4335 
    4436        Vector3 bMin, bMax; 
     
    5042        stream.read(reinterpret_cast<char *>(&bMax), sizeof(Vector3)); 
    5143 
    52         //if ((bMin.x >= bMax.x)||(bMin.y >= bMax.y)||(bMin.z >= bMax.z)) 
    53         //      cout << "error: " << bMin << " " << bMax << endl; 
    54  
    5544        node->mBox = AxisAlignedBox3(bMin, bMax); 
    56  
    5745        node->mArea = node->mBox.SurfaceArea(); 
    5846 
    5947        //cout << "box: " << node->mBox << " area: " << node->mArea << endl; 
    60         cout << node->mBox << " f " << node->mFirst << " l " << node->mLast << endl; 
    61  
     48         
    6249        return node; 
    6350} 
     
    122109        bvh->ComputeBvhStats(); 
    123110        bvh->PrintBvhStats(); 
    124 bvh->Dummy(); 
     111 
    125112        return bvh; 
    126113} 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/FrustumCullingTraverser.cpp

    r2762 r2763  
    2929                //mNumTraversedNodes ++; 
    3030 
    31                 //bool intersects; 
    32                 int intersect; 
    33                 if (mBvh->IsWithinViewFrustum(node)!=0) 
     31                if (mBvh->IsWithinViewFrustum(node)) 
    3432                { 
    3533                        // update node's visited flag => needed for rendering 
     
    3937                        ++ traversed; 
    4038                        TraverseNode(node); 
    41                         RenderBox(node->GetBox()); 
    4239                } 
    4340                else 
    44                 {RenderBox(node->GetBox()); 
    45                         if (node->IsLeaf())  
    46                         { 
    47                          
    48                         //cout <<"b: " << node->GetBox() << endl; 
    49                         } 
     41                { 
    5042                        //mNumFrustumCulledNodes ++; 
    5143                } 
    5244                //cout << "intersect: " << intersect << " bx " << node->GetBox() << endl; 
    5345        } 
    54                  
    55         //RenderFrustum(); 
    56  
     46         
    5747        //std::cout << "traversed: " << traversed << std::endl; 
    5848} 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/OcclusionQuery.cpp

    r2753 r2763  
    6969} 
    7070 
     71 
     72 
     73QueryHandler::QueryHandler(): mCurrentQueryIdx(0)  
     74{} 
     75 
     76 
     77OcclusionQuery *QueryHandler::RequestQuery() 
     78{ 
     79        OcclusionQuery *query; 
     80 
     81        if (mCurrentQueryIdx == mOcclusionQueries.size()) 
     82        { 
     83                query = new OcclusionQuery(); 
     84                mOcclusionQueries.push_back(query); 
     85        } 
     86        else 
     87                query = mOcclusionQueries[mCurrentQueryIdx]; 
     88 
     89        return query; 
     90} 
     91 
     92 
     93void QueryHandler::ResetQueries() 
     94{ 
     95        mCurrentQueryIdx = 0; 
     96} 
     97 
     98 
     99void QueryHandler::DestroyQueries() 
     100{ 
     101        CLEAR_CONTAINER(mOcclusionQueries); 
     102        mCurrentQueryIdx = 0; 
     103        mOcclusionQueries.clear(); 
     104} 
     105 
     106 
     107 
    71108} // namespace 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/OcclusionQuery.h

    r2753 r2763  
    2222        virtual ~OcclusionQuery(); 
    2323 
    24         virtual bool ResultAvailable() const; 
     24        bool ResultAvailable() const; 
    2525         
    26         virtual unsigned int GetQueryResult() const; 
     26        unsigned int GetQueryResult() const; 
    2727         
    28         virtual void BeginQuery(); 
     28        void BeginQuery(); 
    2929         
    30         virtual void EndQuery(); 
     30        void EndQuery(); 
    3131         
    3232        unsigned int GetQueryId() const; 
     
    5959}; 
    6060 
     61 
     62class QueryHandler 
     63{ 
     64public: 
     65 
     66        QueryHandler(); 
     67 
     68        OcclusionQuery *RequestQuery(); 
     69 
     70        /** Must be called every frame. 
     71        */ 
     72        void ResetQueries(); 
     73        void DestroyQueries(); 
     74 
     75protected: 
     76 
     77        int mCurrentQueryIdx; 
     78 
     79        QueryContainer mOcclusionQueries; 
     80}; 
     81 
     82 
    6183} // namespace  
    6284#endif // OcclusionQuery_H 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp

    r2762 r2763  
    100100 
    101101 
     102 
     103void RenderTraverser::Switch2GLRenderState() 
     104{ 
     105        // boolean used to avoid unnecessary state changes 
     106        if (mIsQueryMode) 
     107        { 
     108                // switch back to rendermode             
     109                glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
     110                glDepthMask(GL_TRUE); 
     111                glEnable(GL_LIGHTING); 
     112                mIsQueryMode = false; 
     113        } 
     114} 
     115 
     116 
     117OcclusionQuery *RenderTraverser::IssueOcclusionQuery(BvhNode *node, bool wasVisible) 
     118{ 
     119        OcclusionQuery *query = mQueryHandler.RequestQuery(); 
     120 
     121        query->BeginQuery(); 
     122         
     123        // if leaf and was visible => will be rendered anyway, thus we 
     124        // can also test with the real geometry  
     125        /*if(node->IsLeaf() && wasVisible && mUseOptimization) 
     126        { 
     127                mNumRenderedGeometry += node->Render(); 
     128        } 
     129        else 
     130        {*/ 
     131 
     132        // change state so the bounding box gets not actually rendered on the screen 
     133        //Switch2GLQueryState(); 
     134        mBvh->RenderBoundingBox(node); 
     135        //Switch2GLRenderState(); 
     136 
     137        query->EndQuery(); 
     138 
     139        return query; 
     140} 
     141 
     142 
     143void RenderTraverser::Switch2GLQueryState() 
     144{        
     145        // boolean used to avoid unnecessary state changes 
     146        if (!mIsQueryMode) 
     147        { 
     148                glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 
     149                glDepthMask(GL_FALSE); 
     150                glDisable(GL_LIGHTING); 
     151                mIsQueryMode = true; 
     152        } 
     153} 
     154 
     155 
     156 
    102157#if 0 
    103158 
     
    160215} 
    161216 
    162  
    163 unsigned int RenderTraverser::GetOcclusionQueryResult(HierarchyNode *node) const 
    164 { 
    165         unsigned int result; 
    166  
    167         if (mUseArbQueries) 
    168         { 
    169                 glGetQueryObjectuivARB(node->GetOcclusionQuery(), GL_QUERY_RESULT_ARB, &result); 
    170         } 
    171         else 
    172         { 
    173                 glGetOcclusionQueryuivNV(node->GetOcclusionQuery(), GL_PIXEL_COUNT_NV, &result); 
    174         } 
    175  
    176         return result; 
    177 } 
    178  
    179  
    180 void RenderTraverser::Switch2GLQueryState() 
    181 {        
    182         // boolean used to avoid unnecessary state changes 
    183         if(!mIsQueryMode) 
    184         { 
    185                 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 
    186                 glDepthMask(GL_FALSE); 
    187                 glDisable(GL_LIGHTING); 
    188                 mIsQueryMode = true; 
    189         } 
    190 } 
    191  
    192  
    193 void RenderTraverser::Switch2GLRenderState() 
    194 { 
    195         // boolean used to avoid unnecessary state changes 
    196         if(mIsQueryMode) 
    197         { 
    198                 // switch back to rendermode             
    199                 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    200                 glDepthMask(GL_TRUE); 
    201                 glEnable(GL_LIGHTING); 
    202                 mIsQueryMode = false; 
    203         } 
    204 } 
    205  
    206 void RenderTraverser::IssueOcclusionQuery(HierarchyNode *node, const bool wasVisible) 
    207 { 
    208         // get next available test id 
    209         unsigned int occlusionQuery = mOcclusionQueries[mCurrentQueryIdx ++]; 
    210          
    211         node->SetOcclusionQuery(occlusionQuery); 
    212  
    213         // do the actual occlusion query for this node 
    214         if (mUseArbQueries) 
    215         { 
    216                 glBeginQueryARB(GL_SAMPLES_PASSED_ARB, occlusionQuery); 
    217         } 
    218         else 
    219         { 
    220                 glBeginOcclusionQueryNV(occlusionQuery); 
    221         } 
    222          
    223         // if leaf and was visible => will be rendered anyway, thus we 
    224         // can also test with the real geometry  
    225         if(node->IsLeaf() && wasVisible && mUseOptimization) 
    226         { 
    227                 mNumRenderedGeometry += node->Render(); 
    228         } 
    229         else 
    230         { 
    231                 // change state so the bounding box gets not actually rendered on the screen 
    232                 Switch2GLQueryState(); 
    233                 node->RenderBoundingVolume(); 
    234                 Switch2GLRenderState(); 
    235         } 
    236  
    237         if (mUseArbQueries) 
    238         { 
    239                 glEndQueryARB(GL_SAMPLES_PASSED_ARB); 
    240         } 
    241         else 
    242         { 
    243                 glEndOcclusionQueryNV(); 
    244         } 
    245 } 
    246217 
    247218void RenderTraverser::Preprocess() 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.h

    r2762 r2763  
    66#include "glInterface.h" 
    77#include "Bvh.h" 
     8#include "OcclusionQuery.h" 
     9 
    810 
    911namespace CHCDemo 
     
    104106        /** Issues occlusion query for specified node 
    105107        */ 
    106         void IssueOcclusionQuery(BvhNode *node, bool wasVisible); 
     108        OcclusionQuery *IssueOcclusionQuery(BvhNode *node, bool wasVisible); 
    107109        /** Resets occlusion queries after a traversal 
    108110        */ 
     
    151153 
    152154        RenderState *mRenderState; 
     155 
     156        QueryHandler mQueryHandler; 
    153157}; 
    154158 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/StopAndWaitTraverser.cpp

    r2757 r2763  
    11#include "StopAndWaitTraverser.h" 
     2#include "SceneEntity.h" 
     3 
    24 
    35namespace CHCDemo 
    46{ 
     7 
     8using namespace std; 
     9 
     10 
     11 
    512StopAndWaitTraverser::StopAndWaitTraverser(): RenderTraverser()  
    613{ 
     
    1623void StopAndWaitTraverser::Render() 
    1724{ 
    18 #if 0 
    19         while(! mDistanceQueue.empty()) 
     25        mRenderState->mTexturesEnabled = false; 
     26        mDistanceQueue.push(mBvh->GetRoot()); 
     27 
     28 
     29        int traversed = 0; 
     30        while (!mDistanceQueue.empty()) 
    2031        { 
    21                 HierarchyNode *node = mDistanceQueue.top(); 
     32                BvhNode *node = mDistanceQueue.top(); 
    2233                mDistanceQueue.pop(); 
    23                 mNumTraversedNodes ++; 
     34         
    2435                // interesting for the visualization, so rest and set 
    2536                node->SetVisible(false); 
     37                //mNumTraversedNodes ++; 
    2638 
    27                 bool intersects; 
    28                  
    29                 if(InsideViewFrustum(node, intersects)) 
     39                if (mBvh->IsWithinViewFrustum(node)) 
    3040                { 
    31                         // update node's visited flag 
    32                         node->SetLastVisited(mFrameID); 
    33  
    34                         // for near plane intersecting abbs possible  
    35                         // wrong results => skip occlusion query 
    36                         if(intersects) 
     41                        // if intersects near plane assume visible and don't issue test 
     42                        if (mBvh->CalcDistance(node) < 0.1f) 
    3743                        { 
    38                                 node->SetVisible(true); 
    3944                                TraverseNode(node); 
    4045                        } 
    4146                        else 
    4247                        { 
    43                                 IssueOcclusionQuery(node, false); 
    44                                  
    45                                 // wait if result not available 
    46                                 int visiblePixels = GetOcclusionQueryResult(node); 
    47                                  
    48                                 // node visible 
    49                                 if(visiblePixels > mVisibilityThreshold) 
     48                                OcclusionQuery *query = IssueOcclusionQuery(node, false); 
     49 
     50                                int visiblePixels = query->GetQueryResult(); 
     51 
     52                                if (visiblePixels > 0) 
    5053                                { 
    51                                         node->SetVisible(true); 
     54                                        cout<< "visible: " << visiblePixels << endl; 
     55                                        // update node's visited flag => needed for rendering 
     56                                        // so set it also here 
     57                                        //node->SetLastVisited(mFrameID); 
     58                                        //node->SetVisible(true); 
     59                                        ++ traversed; 
    5260                                        TraverseNode(node); 
    5361                                } 
    54                                 else 
    55                                 { 
    56                                         mNumQueryCulledNodes ++; 
    57                                 } 
    58                         }                                        
     62                        } 
    5963                } 
    6064                else 
    6165                { 
    62                         mNumFrustumCulledNodes ++; 
     66                        //mNumFrustumCulledNodes ++; 
    6367                } 
     68                //cout << "intersect: " << intersect << " bx " << node->GetBox() << endl; 
    6469        } 
    65 #endif 
     70 
     71        mQueryHandler.ResetQueries(); 
     72        //std::cout << "traversed: " << traversed << std::endl; 
    6673} 
    6774 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/StopAndWaitTraverser.h

    r2757 r2763  
    1818        /** Renders the scene with the specified method 
    1919        */ 
    20         virtual void Render() = 0; 
     20        virtual void Render(); 
    2121}; 
    2222 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp

    r2762 r2763  
    1515#include "BvhLoader.h" 
    1616#include "FrustumCullingTraverser.h" 
     17#include "StopAndWaitTraverser.h" 
    1718 
    1819 
     
    128129        //const string filename("house_test.dem"); 
    129130        //const string filename("city_demo.dem"); 
    130         //const string filename("city.dem"); 
    131         const string filename("roofs.dem"); 
     131        const string filename("city.dem"); 
     132        //const string filename("roofs.dem"); 
    132133 
    133134        if (loader.Load(filename, sceneEntities)) 
     
    137138 
    138139        BvhLoader bvhLoader; 
    139         bvh = bvhLoader.Load("roofs.bvh", sceneEntities); 
    140          
    141  
    142         //bvh = bvhLoader.Load("city.bvh", sceneEntities); 
     140        //bvh = bvhLoader.Load("roofs.bvh", sceneEntities); 
     141        bvh = bvhLoader.Load("city.bvh", sceneEntities); 
     142        //bvh = bvhLoader.Load("city_demo.bvh", sceneEntities); 
    143143        //bvh = bvhLoader.Load("house_test.bvh", sceneEntities); 
    144144 
    145145        sceneBox = bvh->GetBox(); 
    146146 
    147         traverser = new FrustumCullingTraverser(); 
     147        //traverser = new FrustumCullingTraverser(); 
     148        traverser = new StopAndWaitTraverser(); 
    148149        traverser->SetHierarchy(bvh); 
    149150        traverser->SetRenderState(&state); 
  • GTP/trunk/App/Demos/Vis/CHC_revisited/common.h

    r2756 r2763  
    469469typedef std::vector<BvhLeaf *> BvhLeafContainer; 
    470470typedef std::vector<Triangle3> TriangleContainer; 
     471typedef std::vector<OcclusionQuery *> QueryContainer; 
    471472 
    472473typedef std::queue<OcclusionQuery *> QueryQueue; 
Note: See TracChangeset for help on using the changeset viewer.