- Timestamp:
- 06/17/08 04:21:47 (17 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/CHC_revisited
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/CHCTraverser.cpp
r2764 r2765 19 19 void CHCTraverser::Render() 20 20 { 21 mStats.Reset();22 mRenderState->mTexturesEnabled = false;23 EnqueueNode(mBvh->GetRoot());24 25 21 QueryQueue queryQueue; 26 22 … … 63 59 { 64 60 // update node's visited flag 65 node->SetLastVisitedFrame(mFrameI D);61 node->SetLastVisitedFrame(mFrameId); 66 62 node->SetVisible(true); 67 63 mBvh->MakeParentsVisible(node); … … 72 68 { 73 69 // identify previously visible nodes 74 const bool wasVisible = node->IsVisible() && (node->GetLastVisitedFrame() == mFrameI D- 1);70 const bool wasVisible = node->IsVisible() && (node->GetLastVisitedFrame() == mFrameId - 1); 75 71 76 72 // identify nodes that we cannot skip queries for 77 73 const bool leafOrWasInvisible = 78 (node->GetLastVisitedFrame() != mFrameI D) && (!wasVisible || node->IsVirtualLeaf());74 (node->GetLastVisitedFrame() != mFrameId) && (!wasVisible || node->IsVirtualLeaf()); 79 75 80 76 // reset node's visibility classification … … 82 78 83 79 // update node's visited flag 84 node->SetLastVisitedFrame(mFrameI D);80 node->SetLastVisitedFrame(mFrameId); 85 81 86 82 // skip testing previously visible interior nodes -
GTP/trunk/App/Demos/Vis/CHC_revisited/FrustumCullingTraverser.cpp
r2764 r2765 15 15 void FrustumCullingTraverser::Render() 16 16 { 17 mStats.Reset();18 mRenderState->mTexturesEnabled = false;19 EnqueueNode(mBvh->GetRoot());20 21 17 while (!mDistanceQueue.empty()) 22 18 { -
GTP/trunk/App/Demos/Vis/CHC_revisited/OcclusionQuery.h
r2763 r2765 65 65 66 66 QueryHandler(); 67 ~QueryHandler() { DestroyQueries(); } 67 68 68 69 OcclusionQuery *RequestQuery(); … … 71 72 */ 72 73 void ResetQueries(); 74 /** Destroys all the queries. 75 */ 73 76 void DestroyQueries(); 74 77 -
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp
r2764 r2765 3 3 #include "Timers.h" 4 4 #include "Camera.h" 5 #include "SceneEntity.h" 5 6 6 7 … … 29 30 30 31 31 RenderTraverser::RenderTraverser(): 32 mFrameID(1), 32 RenderTraverser::RenderTraverser(): 33 33 mVisibilityThreshold(0), 34 34 mBvh(NULL), 35 35 mIsQueryMode(false), 36 mUseOptimization(true) 36 mUseOptimization(true), 37 mFrameId(-1) 37 38 { 38 39 } … … 42 43 { 43 44 mQueryHandler.DestroyQueries(); 45 } 46 47 48 void RenderTraverser::InitFrame(Camera *camera, int currentFrameId) 49 { 50 mFrameId = currentFrameId; 51 mBvh->InitFrame(camera, currentFrameId); 52 53 mStats.Reset(); 54 mQueryHandler.ResetQueries(); 55 mRenderState->mTexturesEnabled = false; 56 EnqueueNode(mBvh->GetRoot()); 44 57 } 45 58 -
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.h
r2764 r2765 84 84 const TraversalStatistics &GetStats() const { return mStats; } 85 85 86 void InitFrame(Camera *camera, int currentFrameId); 87 86 88 protected: 87 89 … … 129 131 TraversalQueue mDistanceQueue; 130 132 131 int mFrameI D;133 int mFrameId; 132 134 int mVisibilityThreshold; 133 135 -
GTP/trunk/App/Demos/Vis/CHC_revisited/StopAndWaitTraverser.cpp
r2764 r2765 23 23 void StopAndWaitTraverser::Render() 24 24 { 25 mStats.Reset();26 mRenderState->mTexturesEnabled = false;27 EnqueueNode(mBvh->GetRoot());28 29 //cout<<"\n***** starting frame **********\n";30 int traversed = 0;31 25 while (!mDistanceQueue.empty()) 32 26 { … … 34 28 mDistanceQueue.pop(); 35 29 36 //float d = mBvh->GetDistance(node);cout << d << " "; 37 38 // interesting for the visualization, so rest and set 30 // interesting for the visualization 39 31 node->SetVisible(false); 40 32 … … 72 64 { 73 65 ++ mStats.mNumFrustumCulledNodes; 74 } 75 //cout << "intersect: " << intersect << " bx " << node->GetBox() << endl; 66 } 76 67 } 77 78 mQueryHandler.ResetQueries();79 //std::cout << "traversed: " << traversed << std::endl;80 68 } 81 69 -
GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp
r2764 r2765 308 308 GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0}; 309 309 GLfloat diffuse[] = {1.0, 1.0, 1.0, 1.0}; 310 //GLfloat specular[] = {1.0, 1.0, 1.0, 1.0};311 310 GLfloat specular[] = {1.0, 1.0, 1.0, 1.0}; 312 311 313 //GLfloat lmodel_ambient[] = {0.5f, 0.5f, 0.5f, 1.0};314 GLfloat lmodel_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};312 GLfloat lmodel_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f}; 313 //GLfloat lmodel_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f}; 315 314 316 315 glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); … … 373 372 SetupEyeView(); 374 373 375 bvh->InitFrame(camera, currentFrame); 374 375 traverser->InitFrame(camera, currentFrame); 376 376 377 377 … … 380 380 381 381 t1 = GetTime(); 382 383 traverser->SetCamera(camera);384 385 //traverser->RenderFrustum();386 382 387 383 glEnableClientState(GL_VERTEX_ARRAY); … … 860 856 CalcDecimalPoint(str2, traverser->GetStats().mNumRenderedTriangles); 861 857 862 sprintf_s(msg4, "rendered objects % d (of %d), rendered triangles: %s (of %s)",858 sprintf_s(msg4, "rendered objects %5d (of %5d), rendered triangles: %s (of %s)", 863 859 traverser->GetStats().mNumRenderedGeometry, sceneEntities.size(), str.c_str(), str2.c_str()); 864 860
Note: See TracChangeset
for help on using the changeset viewer.