source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StopAndWaitTraverser.cpp @ 3065

Revision 3065, 871 bytes checked in by mattausch, 16 years ago (diff)

found bug with near plane intersection: q? why did it work with vbo rendering? (probably because of tighter bounds ...)

RevLine 
[2757]1#include "StopAndWaitTraverser.h"
[2763]2#include "SceneEntity.h"
[2757]3
[2763]4
[2776]5namespace CHCDemoEngine
[2757]6{
[2763]7
8using namespace std;
9
10
11
[2767]12StopAndWaitTraverser::StopAndWaitTraverser()
[2757]13{
14}
15
16
[2767]17void StopAndWaitTraverser::Traverse()
[2757]18{
[2763]19        while (!mDistanceQueue.empty())
[2757]20        {
[2763]21                BvhNode *node = mDistanceQueue.top();
[2757]22                mDistanceQueue.pop();
[2763]23       
24                if (mBvh->IsWithinViewFrustum(node))
[2757]25                {
[2763]26                        // if intersects near plane assume visible and don't issue test
[3065]27                        if (mBvh->IntersectsNearPlane(node))
[2757]28                        {
29                                TraverseNode(node);
30                        }
31                        else
32                        {
[2792]33                                OcclusionQuery *query = IssueOcclusionQuery(node);
[2763]34
[3065]35                                const bool visible = (query->GetQueryResult() > mVisibilityThreshold);
[2802]36                       
[2795]37                                if (visible)
[2757]38                                {
39                                        TraverseNode(node);
40                                }
[2764]41                                else
42                                {
43                                        ++ mStats.mNumQueryCulledNodes;
44                                }
[2763]45                        }
[2757]46                }
47                else
48                {
[2764]49                        ++ mStats.mNumFrustumCulledNodes;
[2765]50                }       
[2757]51        }
52}
53
54}
Note: See TracBrowser for help on using the repository browser.