Changeset 2776 for GTP/trunk/App/Demos/Vis/CHC_revisited
- Timestamp:
- 06/19/08 04:34:20 (17 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/CHC_revisited
- Files:
-
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/AxisAlignedBox3.cpp
r2762 r2776 8 8 9 9 10 namespace CHCDemo 10 namespace CHCDemoEngine 11 11 { 12 12 -
GTP/trunk/App/Demos/Vis/CHC_revisited/AxisAlignedBox3.h
r2755 r2776 7 7 8 8 9 namespace CHCDemo 9 namespace CHCDemoEngine 10 10 { 11 11 -
GTP/trunk/App/Demos/Vis/CHC_revisited/BinaryLoader.cpp
r2769 r2776 11 11 12 12 13 namespace CHCDemo 13 namespace CHCDemoEngine 14 14 { 15 15 -
GTP/trunk/App/Demos/Vis/CHC_revisited/BinaryLoader.h
r2764 r2776 11 11 12 12 13 namespace CHCDemo 13 namespace CHCDemoEngine 14 14 { 15 15 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp
r2775 r2776 15 15 16 16 17 namespace CHCDemo 17 namespace CHCDemoEngine 18 18 { 19 19 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.h
r2775 r2776 10 10 11 11 12 namespace CHCDemo 12 namespace CHCDemoEngine 13 13 { 14 14 … … 240 240 241 241 242 void BvhNode::SetVisible( constbool visible)242 void BvhNode::SetVisible(bool visible) 243 243 { 244 244 mVisibility.mIsVisible = visible; … … 258 258 259 259 260 void BvhNode::SetTimesTestedInvisible( constint t)260 void BvhNode::SetTimesTestedInvisible(int t) 261 261 { 262 262 mVisibility.mTimesInvisible = t; -
GTP/trunk/App/Demos/Vis/CHC_revisited/BvhLoader.cpp
r2773 r2776 8 8 9 9 10 namespace CHCDemo 10 namespace CHCDemoEngine 11 11 { 12 12 -
GTP/trunk/App/Demos/Vis/CHC_revisited/BvhLoader.h
r2760 r2776 7 7 8 8 9 namespace CHCDemo 9 namespace CHCDemoEngine 10 10 { 11 11 -
GTP/trunk/App/Demos/Vis/CHC_revisited/CHCPlusPlusTraverser.cpp
r2774 r2776 4 4 using namespace std; 5 5 6 namespace CHCDemo 6 namespace CHCDemoEngine 7 7 { 8 8 … … 18 18 const int visible = query->GetQueryResult() > mVisibilityThreshold; 19 19 20 BvhNode *node = query->GetFrontNode(); 21 22 if (visible) 23 { 24 // node was previously invisible 25 if (!node->IsVisible()) 26 { 27 // reset flag 28 node->SetTimesTestedInvisible(0); 29 node->SetAssumedVisibleFrameId(mFrameId + mAssumedVisibleFrames); 20 // multiquery 21 if (query->GetSize() > 1) 22 { 23 // failed query: query individual nodes 24 if (visible) 25 { 26 for (size_t i = 0; i < query->GetSize(); ++ i) 27 { 28 BvhNode *node = query->GetNodes()[i]; 29 OcclusionQuery *q = IssueOcclusionQuery(node, false); 30 mQueryQueue.push(q); 31 } 32 } 33 else // query successful: update classifications 34 { 35 for (size_t i = 0; i < query->GetSize(); ++ i) 36 { 37 BvhNode *node = query->GetNodes()[i]; 38 node->IncTimesTestedInvisible(); 39 node->SetVisible(false); 40 } 41 42 mStats.mNumQueryCulledNodes += query->GetSize(); 43 } 44 } 45 else // single query 46 { 47 BvhNode *node = query->GetFrontNode(); 48 49 // failed query: query individual nodes 50 if (visible) 51 { 52 // node was previously invisible 53 if (!node->IsVisible()) 54 { 55 // reset flag 56 node->SetTimesTestedInvisible(0); 57 node->SetAssumedVisibleFrameId(mFrameId + mAssumedVisibleFrames); 58 } 59 else 60 { // randomize first invokation 61 node->SetAssumedVisibleFrameId(mFrameId + Random(mAssumedVisibleFrames + 1)); 62 } 63 64 mBvh->MakeParentsVisible(node); 65 TraverseNode(node); 30 66 } 31 67 else 32 // randomize first invokation 33 node->SetAssumedVisibleFrameId(mFrameId + Random(mAssumedVisibleFrames + 1)); 34 35 mBvh->MakeParentsVisible(node); 36 TraverseNode(node); 37 } 38 else 39 { 40 node->IncTimesTestedInvisible(); 41 ++ mStats.mNumQueryCulledNodes; 42 } 43 44 node->SetVisible(visible); 68 { 69 node->IncTimesTestedInvisible(); 70 ++ mStats.mNumQueryCulledNodes; 71 } 72 73 node->SetVisible(visible); 74 } 45 75 } 46 76 … … 51 81 while (!mDistanceQueue.empty() || !mQueryQueue.empty()) 52 82 { 53 bool resultAvailable ;83 bool resultAvailable = false; 54 84 while (!mQueryQueue.empty() && 55 85 (mDistanceQueue.empty() || (resultAvailable = mQueryQueue.front()->ResultAvailable()))) … … 119 149 } 120 150 } 151 else 152 { 153 if (node->IsVirtualLeaf()) 154 { 155 node->SetVisible(true); 156 mBvh->MakeParentsVisible(node); 157 } 158 else // reset visibility classification 159 { 160 node->SetVisible(false); 161 } 162 } 121 163 122 164 // always traverse a node if it was previously visible … … 202 244 if (query->GetNodes().empty()) 203 245 { 246 // single node will anever cause a wasted query 204 247 newBatchVal = 1.0f; 205 248 } … … 219 262 } 220 263 264 //cout <<"size: " << query->GetSize() << endl; 221 265 IssueOcclusionQuery(*query, false); 222 266 … … 227 271 void CHCPlusPlusTraverser::IssueMultiQueries() 228 272 { 229 if (0 && mUseRenderQueue)230 {231 if (mRenderState->SetState(RenderState::RENDER))232 ++ mStats.mNumStateChanges;233 234 mRenderQueue.Render();235 mRenderQueue.Clear();236 }237 238 273 while (!mIQueue.empty()) 239 274 { 240 BvhNode *node = mIQueue.front(); 241 mIQueue.pop(); 242 243 OcclusionQuery *query = GetNextMultiQuery(mIQueue); 244 //OcclusionQuery *query = IssueOcclusionQuery(node); 275 OcclusionQuery *query; 276 277 if (mUseMultiQueries) 278 { 279 query = GetNextMultiQuery(mIQueue); 280 } 281 else 282 { 283 BvhNode *node = mIQueue.front(); 284 mIQueue.pop(); 285 query = IssueOcclusionQuery(node, false); 286 } 245 287 246 288 mQueryQueue.push(query); -
GTP/trunk/App/Demos/Vis/CHC_revisited/CHCPlusPlusTraverser.h
r2773 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/CHCTraverser.cpp
r2770 r2776 3 3 4 4 5 namespace CHCDemo 5 namespace CHCDemoEngine 6 6 { 7 7 … … 27 27 { 28 28 BvhNode *node = query->GetFrontNode(); 29 node->SetAssumedVisibleFrameId(mFrameId + mAssumedVisibleFrames); 29 30 30 31 node->SetVisible(true); … … 34 35 else 35 36 { 37 36 38 ++ mStats.mNumQueryCulledNodes; 37 39 } … … 63 65 64 66 // identify nodes that we cannot skip queries for 65 const bool leafOrWasInvisible = (!wasVisible || node->IsVirtualLeaf()); 66 67 // reset node's visibility classification 68 node->SetVisible(false); 67 const bool testFeasible = (!wasVisible || 68 (node->IsVirtualLeaf() && (node->GetAssumedVisibleFrameId() <= mFrameId))); 69 69 70 70 // update node's visited flag … … 72 72 73 73 // skip testing previously visible interior nodes 74 if ( leafOrWasInvisible)74 if (testFeasible) 75 75 { 76 76 OcclusionQuery *query = IssueOcclusionQuery(node, wasVisible); 77 77 mQueryQueue.push(query); 78 78 } 79 else 80 { 81 if (node->IsVirtualLeaf()) 82 { 83 node->SetVisible(true); 84 mBvh->MakeParentsVisible(node); 85 } 86 else // reset visibility classification 87 { 88 node->SetVisible(false); 89 } 90 } 91 79 92 80 93 // always traverse a node if it was visible -
GTP/trunk/App/Demos/Vis/CHC_revisited/CHCTraverser.h
r2771 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Camera.cpp
r2764 r2776 4 4 5 5 6 namespace CHCDemo 6 namespace CHCDemoEngine 7 7 { 8 8 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Camera.h
r2764 r2776 7 7 8 8 9 namespace CHCDemo 9 namespace CHCDemoEngine 10 10 { 11 11 -
GTP/trunk/App/Demos/Vis/CHC_revisited/FrustumCullingTraverser.cpp
r2771 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/FrustumCullingTraverser.h
r2767 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Geometry.cpp
r2773 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Geometry.h
r2773 r2776 7 7 8 8 9 namespace CHCDemo 9 namespace CHCDemoEngine 10 10 { 11 11 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Material.cpp
r2769 r2776 6 6 7 7 8 namespace CHCDemo 8 namespace CHCDemoEngine 9 9 { 10 10 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Material.h
r2769 r2776 3 3 4 4 5 namespace CHCDemo 5 namespace CHCDemoEngine 6 6 { 7 7 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Matrix4x4.cpp
r2752 r2776 6 6 using namespace std; 7 7 8 namespace CHCDemo 8 namespace CHCDemoEngine 9 9 { 10 10 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Matrix4x4.h
r2756 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/OcclusionQuery.cpp
r2773 r2776 6 6 7 7 8 namespace CHCDemo 8 namespace CHCDemoEngine 9 9 { 10 10 -
GTP/trunk/App/Demos/Vis/CHC_revisited/OcclusionQuery.h
r2773 r2776 6 6 7 7 8 namespace CHCDemo 8 namespace CHCDemoEngine 9 9 { 10 10 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Plane3.cpp
r2762 r2776 3 3 4 4 5 namespace CHCDemo 5 namespace CHCDemoEngine 6 6 { 7 7 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Plane3.h
r2762 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderQueue.cpp
r2773 r2776 9 9 10 10 11 namespace CHCDemo 11 namespace CHCDemoEngine 12 12 { 13 13 … … 15 15 inline static bool IsLower(SceneEntity *ent1, SceneEntity *ent2) 16 16 { 17 // group by texture size 17 18 Texture *t1 = ent1->GetMaterial()->GetTexture(); 18 19 Texture *t2 = ent2->GetMaterial()->GetTexture(); … … 21 22 int tsize2 = t2 ? t2->GetByteSize() : 0; 22 23 24 // if texture size equal, group by material 23 25 if (tsize1 == tsize2) 24 26 return ent1->GetMaterial() < ent2->GetMaterial(); … … 28 30 29 31 30 RenderQueue::RenderQueue(): mState(NULL), mMinSizeForSorting( 5)32 RenderQueue::RenderQueue(): mState(NULL), mMinSizeForSorting(3) 31 33 { 32 34 } … … 63 65 Sort(); 64 66 65 //if (!mEntities.empty()) Debug << "rendering render queue" << endl;66 67 SceneEntityContainer::const_iterator sit, sit_end = mEntities.end(); 67 68 … … 70 71 SceneEntity *ent = *sit; 71 72 ent->Render(mState); 72 73 /*if (ent->GetMaterial()->GetTexture())74 Debug << " " << ent->GetMaterial()->GetTexture()->GetWidth();75 else76 Debug << " 0";*/77 73 } 78 74 } … … 81 77 void RenderQueue::Sort() 82 78 { 83 //InitTiming();84 //long t1, t2;85 //t1 = GetTime();86 87 79 sort(mEntities.begin(), mEntities.end(), IsLower); 88 89 //t2 = GetTime();90 //cout << "sort: " << TimeDiff(t1, t2) << endl;91 80 } 92 81 -
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderQueue.h
r2773 r2776 4 4 #include "common.h" 5 5 6 namespace CHCDemo 6 namespace CHCDemoEngine 7 7 { 8 8 … … 36 36 void Clear(); 37 37 38 int GetSize() const { return (int)mEntities.size(); } 38 39 39 40 protected: -
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderState.cpp
r2773 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderState.h
r2773 r2776 6 6 7 7 8 namespace CHCDemo 8 namespace CHCDemoEngine 9 9 { 10 10 -
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp
r2775 r2776 6 6 #include "RenderState.h" 7 7 #include "Geometry.h" 8 #include "Timer/PerfTimer.h" 8 9 9 10 … … 11 12 12 13 13 namespace CHCDemo 14 namespace CHCDemoEngine 14 15 { 15 16 … … 87 88 if (node->GetLastRenderedFrame() != mFrameId) 88 89 { 89 if (!mUseRenderQueue) 90 if (mRenderState->SetState(RenderState::RENDER)) 91 ++ mStats.mNumStateChanges; 92 90 if (mRenderState->SetState(RenderState::RENDER)) 91 ++ mStats.mNumStateChanges; 92 93 93 node->SetLastRenderedFrame(mFrameId); 94 94 … … 128 128 void RenderTraverser::RenderScene() 129 129 { 130 InitTiming(); 131 long t1, t2; 132 133 t1 = GetTime(); 130 PerfTimer timer; 131 132 timer.Start(); 133 134 //InitTiming(); 135 //long t1, t2; 136 //t1 = GetTime(); 134 137 135 138 glEnableClientState(GL_VERTEX_ARRAY); … … 156 159 glDisableClientState(GL_NORMAL_ARRAY); 157 160 158 t2 = GetTime(); 159 mStats.mRenderTime = TimeDiff(t1, t2); 161 //t2 = GetTime(); 162 //mStats.mRenderTime = TimeDiff(t1, t2); 163 mStats.mRenderTime = timer.Elapsedms(); 160 164 } 161 165 … … 180 184 181 185 182 #if 0 186 void RenderTraverser::SetAssumedVisibleFrames(int assumedVisibleFrames) 187 { 188 mAssumedVisibleFrames = assumedVisibleFrames; 189 } 190 191 192 void RenderTraverser::SetMaxBatchSize(int batchSize) 193 { 194 mMaxBatchSize = batchSize; 195 } 196 197 198 void RenderTraverser::SetUseMultiQueries(bool useMultiQueries) 199 { 200 mUseMultiQueries = useMultiQueries; 201 std::cout << "using multiqueries: " << mUseMultiQueries << std::endl; 202 } 203 204 205 183 206 OcclusionQuery *RenderTraverser::IssueOcclusionQuery(BvhNode *node, bool wasVisible) 184 207 { … … 191 214 } 192 215 193 #else 194 195 196 OcclusionQuery *RenderTraverser::IssueOcclusionQuery(BvhNode *node, bool wasVisible) 216 217 void RenderTraverser::IssueOcclusionQuery(const OcclusionQuery &query, bool wasVisible) 197 218 { 198 219 ++ mStats.mNumIssuedQueries; … … 200 221 if (mUseRenderQueue && (mRenderState->GetMode() == RenderState::RENDER)) 201 222 { 223 //cout << "render queue: " << mRenderQueue.GetSize() << endl; 202 224 mRenderQueue.Render(); 203 225 mRenderQueue.Clear(); 204 226 } 205 227 206 OcclusionQuery *query = mQueryHandler.RequestQuery(); 207 208 query->Reset(); 209 query->AddNode(node); 210 211 query->BeginQuery(); 228 query.BeginQuery(); 212 229 213 230 if (wasVisible) … … 218 235 if (wasVisible && mUseOptimization) 219 236 { 220 RenderNode(node); 237 for (size_t i = 0; i < query.GetSize(); ++ i) 238 RenderNode(query.GetNodes()[i]); 221 239 } 222 240 else … … 226 244 ++ mStats.mNumStateChanges; 227 245 228 mBvh->RenderBoundingBox(node, mRenderState);229 }230 231 query->EndQuery();232 233 return query;234 }235 236 #endif237 void RenderTraverser::IssueOcclusionQuery(const OcclusionQuery &query, bool wasVisible)238 {239 ++ mStats.mNumIssuedQueries;240 241 if (mUseRenderQueue && (mRenderState->GetMode() == RenderState::RENDER))242 {243 mRenderQueue.Render();244 mRenderQueue.Clear();245 }246 247 query.BeginQuery();248 249 if (wasVisible)250 ++ mStats.mNumPreviouslyVisibleNodeQueries;251 252 // if this node is a previous visible leaf:253 // leaves will be rendered anyway => we can also test with the real geometry254 if (wasVisible && mUseOptimization)255 {256 for (size_t i = 0; i < query.GetSize(); ++ i)257 RenderNode(query.GetNodes()[i]);258 }259 else260 {261 // change to query mode and render box262 if (mRenderState->SetState(RenderState::QUERY))263 ++ mStats.mNumStateChanges;264 265 246 mBvh->RenderBoundingBoxes(query.GetNodes(), mRenderState); 266 247 } -
GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.h
r2773 r2776 10 10 11 11 12 namespace CHCDemo 12 namespace CHCDemoEngine 13 13 { 14 14 … … 39 39 int mNumPreviouslyVisibleNodeQueries; 40 40 41 longmRenderTime;41 double mRenderTime; 42 42 }; 43 43 … … 106 106 */ 107 107 void SetMaxBatchSize(int batchSize); 108 108 /** If multiqueries should be used. 109 */ 110 void SetUseMultiQueries(bool useMultiQueries); 109 111 110 112 protected: … … 167 169 168 170 int mMaxBatchSize; 171 172 bool mUseMultiQueries; 169 173 }; 170 174 -
GTP/trunk/App/Demos/Vis/CHC_revisited/SceneEntity.cpp
r2773 r2776 6 6 7 7 8 namespace CHCDemo 8 namespace CHCDemoEngine 9 9 { 10 10 -
GTP/trunk/App/Demos/Vis/CHC_revisited/SceneEntity.h
r2769 r2776 7 7 8 8 9 namespace CHCDemo 9 namespace CHCDemoEngine 10 10 { 11 11 -
GTP/trunk/App/Demos/Vis/CHC_revisited/SceneQuery.cpp
r2764 r2776 9 9 10 10 11 namespace CHCDemo 11 namespace CHCDemoEngine 12 12 { 13 13 -
GTP/trunk/App/Demos/Vis/CHC_revisited/SceneQuery.h
r2764 r2776 5 5 #include "AxisAlignedBox3.h" 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/StopAndWaitTraverser.cpp
r2767 r2776 3 3 4 4 5 namespace CHCDemo 5 namespace CHCDemoEngine 6 6 { 7 7 -
GTP/trunk/App/Demos/Vis/CHC_revisited/StopAndWaitTraverser.h
r2767 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Texture.cpp
r2769 r2776 9 9 10 10 11 namespace CHCDemo 11 namespace CHCDemoEngine 12 12 { 13 13 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Texture.h
r2768 r2776 8 8 #include <string> 9 9 10 namespace CHCDemo 10 namespace CHCDemoEngine 11 11 { 12 12 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Triangle3.cpp
r2751 r2776 8 8 9 9 10 namespace CHCDemo {10 namespace CHCDemoEngine { 11 11 12 12 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Triangle3.h
r2751 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Vector3.cpp
r2751 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Vector3.h
r2762 r2776 7 7 8 8 9 namespace CHCDemo 9 namespace CHCDemoEngine 10 10 { 11 11 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Visualization.cpp
r2771 r2776 10 10 11 11 12 namespace CHCDemo 12 namespace CHCDemoEngine 13 13 { 14 14 -
GTP/trunk/App/Demos/Vis/CHC_revisited/Visualization.h
r2767 r2776 5 5 6 6 7 namespace CHCDemo 7 namespace CHCDemoEngine 8 8 { 9 9 -
GTP/trunk/App/Demos/Vis/CHC_revisited/chc_revisited.vcproj
r2769 r2776 268 268 > 269 269 </File> 270 <Filter 271 Name="timer" 272 > 273 <File 274 RelativePath=".\Timer\BenchTimer.cpp" 275 > 276 </File> 277 <File 278 RelativePath=".\Timer\BenchTimer.h" 279 > 280 </File> 281 <File 282 RelativePath=".\Timer\merror.cpp" 283 > 284 </File> 285 <File 286 RelativePath=".\Timer\merror.h" 287 > 288 </File> 289 <File 290 RelativePath=".\Timer\mstring.h" 291 > 292 </File> 293 <File 294 RelativePath=".\Timer\PerfTimer.h" 295 > 296 </File> 297 <File 298 RelativePath=".\Timer\PerfTimerSkeleton.h" 299 > 300 </File> 301 <File 302 RelativePath=".\Timer\RDTSCTimer.cpp" 303 > 304 </File> 305 <File 306 RelativePath=".\Timer\RDTSCTimer.h" 307 > 308 </File> 309 </Filter> 270 310 </Filter> 271 311 <Filter -
GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp
r2774 r2776 22 22 23 23 24 24 25 using namespace std; 25 using namespace CHCDemo ;26 using namespace CHCDemoEngine; 26 27 27 28 … … 46 47 int threshold; 47 48 49 int assumedVisibleFrames = 10; 50 int maxBatchSize = 50; 51 bool useMultiQueries = true; 48 52 49 53 const float keyForwardMotion = 1.0f; … … 58 62 float visZoomFactor = 1.5f; 59 63 60 longaccumulatedTime = 1000;64 double accumulatedTime = 1000; 61 65 float fps = 1e3f; 62 66 … … 106 110 void drawEyeView(void); 107 111 void setupVisView(void); 108 long calcRenderTime(void);109 112 void CalcDecimalPoint(std::string &str, int d); 110 113 void ResetTraverser(); … … 218 221 "", 219 222 "'F1' - shows/dismisses this message", 220 "'F2' - decreases number of objects (valid after scene recreation)",221 "'F3' - increases number of objects (valid after scene recreation)",222 "'F4' - decreases box length in z direction (valid after scene recreation)",223 "'F5' - increases box length in z direction (valid after scene recreation)",224 "'F6' - decreases object size (valid after scene recreation)",225 "'F7' - increases object size (valid after scene recreation)",226 "'F8' - cycles through object types (teapot, ...) (valid after scene recreation)",227 223 "", 228 224 "'MOUSE-LEFT' - turn left/right, move forward/backward", … … 235 231 "", 236 232 "'SPACE' - cycles through occlusion culling algorithms", 237 "'-' - decreases visibility threshold", 238 "'+' - increases visibility threshold", 239 "'C' - recreates the scene hierarchy", 233 "'-' - decreases max batch size", 234 "'+' - increases max batch size", 235 "'6' - decrease assumed visible frames", 236 "'7' - increase assumed visible frames", 237 "'8' - upward motion", 238 "'9' - downward motion", 239 "", 240 240 "'G' - enables/disables optimization to take geometry as occluder", 241 "'N' - triggers NV / ARB queries",242 241 "", 243 "'R' - shows/hides recreation parameters",244 242 "'S' - shows/hides statistics", 245 243 "'V' - shows/hides bounding volumes", … … 312 310 traverser->SetUseRenderQueue(useRenderQueue); 313 311 traverser->SetVisibilityThreshold(threshold); 312 traverser->SetAssumedVisibleFrames(assumedVisibleFrames); 313 traverser->SetMaxBatchSize(maxBatchSize); 314 traverser->SetUseMultiQueries(useMultiQueries); 314 315 } 315 316 … … 430 431 break; 431 432 case '+': 432 threshold+= 10;433 traverser->Set VisibilityThreshold(threshold);433 maxBatchSize += 10; 434 traverser->SetMaxBatchSize(maxBatchSize); 434 435 break; 435 436 case '-': 436 threshold -= 10; 437 if(threshold < 0) threshold = 0; 438 traverser->SetVisibilityThreshold(threshold); 437 maxBatchSize -= 10; 438 if (maxBatchSize < 0) maxBatchSize = 1; 439 traverser->SetMaxBatchSize(maxBatchSize); 440 break; 441 case '6': 442 assumedVisibleFrames -= 1; 443 if (assumedVisibleFrames < 1) assumedVisibleFrames = 1; 444 traverser->SetAssumedVisibleFrames(assumedVisibleFrames); 445 break; 446 case '7': 447 assumedVisibleFrames += 1; 448 traverser->SetAssumedVisibleFrames(assumedVisibleFrames); 449 break; 450 case 'M': 451 case 'm': 452 useMultiQueries = !useMultiQueries; 453 traverser->SetUseMultiQueries(useMultiQueries); 439 454 break; 440 455 case '1': … … 852 867 "CHC", "CHC ++"}; 853 868 854 char msg2[ 200];869 char msg2[400]; 855 870 char msg3[200]; 856 871 char msg4[200]; … … 858 873 859 874 860 char *optstr[2] = {"", ", using optimization"}; 861 862 static long renderTime = traverser->GetStats().mRenderTime; 863 const float expFactor = 0.95f; 875 static double renderTime = traverser->GetStats().mRenderTime; 876 const float expFactor = 0.3f; 864 877 renderTime = traverser->GetStats().mRenderTime * expFactor + (1.0f - expFactor) * renderTime; 865 878 866 879 accumulatedTime += renderTime; 867 880 868 if (accumulatedTime > 100) // update every fraction of a second881 if (accumulatedTime > 500) // update every fraction of a second 869 882 { 870 883 accumulatedTime = 0; … … 882 895 } 883 896 884 sprintf_s(msg2, " threshold: %4d%s", threshold, optstr[useOptimization]);897 sprintf_s(msg2, "assumed visible frames: %4d, max batch size: %4d, using multiqueries: %d, using render queue: %d", assumedVisibleFrames, maxBatchSize, useMultiQueries, useRenderQueue); 885 898 886 899 string str; -
GTP/trunk/App/Demos/Vis/CHC_revisited/common.cpp
r2772 r2776 26 26 27 27 28 namespace CHCDemo 28 namespace CHCDemoEngine 29 29 { 30 30 -
GTP/trunk/App/Demos/Vis/CHC_revisited/common.h
r2770 r2776 18 18 19 19 20 namespace CHCDemo 20 namespace CHCDemoEngine 21 21 { 22 22
Note: See TracChangeset
for help on using the changeset viewer.