Changeset 3286 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
- Timestamp:
- 01/19/09 10:28:16 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3285 r3286 157 157 158 158 float shotRays = .0f; 159 /// the visibility solution is initialized at this number of rays shot that 160 int visibilitySolutionInitialState = 0; 159 161 160 162 … … 480 482 env.GetFloatParam(string("viewCellsScaleFactor"), viewCellsScaleFactor); 481 483 env.GetFloatParam(string("skyDomeScaleFactor"), skyDomeScaleFactor); 484 env.GetIntParam(string("visibilitySolutionInitialState"), visibilitySolutionInitialState); 482 485 483 486 //env.GetStringParam(string("modelPath"), model_path); … … 1192 1195 if (!walkThroughPlayer->ReadNextFrame(camera)) 1193 1196 { 1197 cout << "reached end of walkthrough" << endl; 1194 1198 currentReplayFrame = -1; 1195 1199 replayPath = false; … … 1216 1220 { 1217 1221 if (!walkThroughRecorder) 1222 { 1218 1223 walkThroughRecorder = new WalkThroughRecorder(walkThroughSuffix + ".log"); 1219 1220 if ((Distance(oldPos, camera->GetPosition()) > 1e-6f) || 1224 } 1225 1226 // question: check if player has moved more than a minimum distance? 1227 1228 if (0 || 1229 (Distance(oldPos, camera->GetPosition()) > 1e-6f) || 1221 1230 (DotProd(oldDir, camera->GetDirection()) < 1.0f - 1e-6f)) 1222 1231 { … … 1239 1248 LoadVisibilitySolution(); 1240 1249 applicationTimer.Start(); 1250 shotRays = visibilitySolutionInitialState; 1241 1251 } 1242 1252 … … 1824 1834 cout << "recording frames on replaying" << endl; 1825 1835 else 1826 cout << " finishedrecording frames on replaying" << endl;1836 cout << "not recording frames on replaying" << endl; 1827 1837 break; 1828 1838 case GLUT_KEY_LEFT: … … 2375 2385 } 2376 2386 2377 glColor3f(1.0f, 1.0f, 1.0f); 2387 glColor3f(0.0f, 1.0f, 0.0f); 2388 2378 2389 static char *alg_str[] = { 2379 2390 "Frustum Cull" … … 2384 2395 }; 2385 2396 2386 #if 02387 2397 if (!showAlgorithmTime) 2388 2398 { … … 2390 2400 { 2391 2401 sprintf(msg[7], "%s: %6.1f fps", alg_str[renderMode], fps); 2392 myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color);2402 myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 30.0f); 2393 2403 } 2404 2405 int mrays = (int)shotRays / 1000000; 2406 sprintf(msg[7], "%s: %04d M rays", alg_str[renderMode], mrays); 2407 myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 60.0f); 2394 2408 } 2395 2409 else 2396 2410 { 2397 2411 sprintf(msg[7], "%s: %6.1f ms", alg_str[renderMode], rTime); 2398 myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color); 2399 } 2400 #else 2401 int mrays = (int)shotRays / 1000000; 2402 sprintf(msg[7], "%s: %04d M rays", alg_str[renderMode], mrays); 2403 //myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color); 2404 myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 30.0f);//, top_color, bottom_color); 2405 #endif 2406 } 2407 2412 myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 30.0f); 2413 } 2414 2415 glColor3f(1.0f, 1.0f, 1.0f); 2416 } 2417 2418 glColor3f(1, 1, 1); 2408 2419 glDisable(GL_BLEND); 2409 2420 glDisable(GL_TEXTURE_2D); … … 2664 2675 viewCell = viewCellsTree->GetViewCell(camera->GetPosition()); 2665 2676 2666 // assume 60 FPS 2667 const float raysPerMs = pvsTotalSamples / pvsTotalTime; 2668 const float scale = renderTime * raysPerMs; 2669 2670 cout << "rays per sec: " << raysPerMs << endl; 2671 2672 //const float elapsedAlgorithmTime = applicationTimer.Elapsedms(false); 2673 //int numTriangles = 0; 2677 const float elapsedAlgorithmTime = applicationTimer.Elapsedms(false); 2678 2679 // assume 60 FPS, total time is in secs 2680 const float raysPerMs = 2.0f * pvsTotalSamples / (pvsTotalTime * 1000.0f); 2681 //shotRays = visibilitySolutionInitialState + elapsedAlgorithmTime * raysPerMs; 2682 //shotRays += 1000 * raysPerMs / 60.0f; 2683 2684 //cout << "totalt: " << pvsTotalTime << endl; 2685 //cout << "rays per ms: " << raysPerMs << endl; 2674 2686 2675 2687 SceneEntity::SetCurrentVisibleId(globalVisibleId); … … 2679 2691 PvsEntry entry = viewCell->mPvs.GetEntry(i); 2680 2692 #ifdef USE_TIMESTAMPS 2681 if ((entry.mTimeStamp < 0.0f) || (entry.mTimeStamp <= shotRays)) 2682 #else 2683 if (1) 2693 if (!((entry.mTimeStamp < 0.0f) || (entry.mTimeStamp <= shotRays))) 2694 continue; 2684 2695 #endif 2685 { 2686 entry.mEntity->SetVisibleId(globalVisibleId); 2687 //numTriangles += entry.mEntity->CountNumTriangles(); 2688 } 2689 } 2690 2691 shotRays += scale; 2696 entry.mEntity->SetVisibleId(globalVisibleId); 2697 //numTriangles += entry.mEntity->CountNumTriangles(); 2698 } 2699 2692 2700 ++ globalVisibleId; 2693 2701 }
Note: See TracChangeset
for help on using the changeset viewer.