Changeset 3286 for GTP/trunk/App/Demos/Vis/FriendlyCulling
- Timestamp:
- 01/19/09 10:28:16 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r3285 r3286 21 21 shadowSize=4096 22 22 # the filenames given to recorded frames (+ number.bmp) 23 recordedFramesSuffix=frames/vienna_frame 23 #recordedFramesSuffix=frames/vienna_frame 24 recordedFramesSuffix=frames_100_pgv/vienna_frame 25 #recordedFramesSuffix=frames_50_spgvu/vienna_frame 24 26 # the filename for the statistics 25 27 statsFilename=mystats 26 walkThroughSuffix=walkthrough_pp_1 28 #walkThroughSuffix=walkthrough_pp_1 29 walkThroughSuffix=walkthrough_vienna 27 30 #walkThroughSuffix=path_pp 28 31 … … 30 33 usePvs=0 31 34 32 # if using pvs, this specifies the name of the visibility soluti n35 # if using pvs, this specifies the name of the visibility solution 33 36 #visibilitySolution=vienna_full-8x3-pgv 34 37 #visibilitySolution=vienna_full-8x3-spgvu … … 37 40 #visibilitySolution=mypompeii-2x1-obvh-pgv 38 41 visibilitySolution=myvienna-3x1-obvh-pgv 42 #visibilitySolution=myvienna-3x1-obvh-refu 43 #visibilitySolution=myvienna-3x1-obvh-spgvu 39 44 40 45 viewCellsScaleFactor=1.0f … … 42 47 43 48 skyDomeScaleFactor=80.0f 49 50 #visibilitySolutionInitialState=50000000 51 visibilitySolutionInitialState=100000000 44 52 45 53 … … 61 69 # move speed 62 70 #keyForwardMotion=5.0f 63 #keyRotation=0.5f71 keyRotation=0.5f 64 72 keyForwardMotion=20.0f 65 keyRotation=1.5f 73 #keyRotation=1.5f 74 keyForwardMotion=30.0f 66 75 67 76 # initial camera position … … 81 90 #lightDirection=-0.8f 1.0f -0.7f 82 91 #lightDirection=-0.3f 0.2f -0.7f 83 lightDirection=-0.14002 0.812842 -0.565404 92 #lightDirection=-0.14002 0.812842 -0.565404 93 #lightDirection=-0.77596 -0.614785 -0.141158 94 #lightDirection=-0.785914 -0.583277 -0.20525 95 lightDirection=0.509293 0.784034 -0.35484 96 84 97 85 98 ##################### … … 153 166 #useSkylightForIllum=1 154 167 #skyDomeScaleFactor=1000.0f 168 169 170 camPosition=1145.31 413.602 186.678 171 camDirection=-0.917729 -0.397207 -0 172 lightDirection=0.509293 0.784034 -0.35484 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp
r3285 r3286 157 157 CreateIdSortedList2(bvh->GetStaticRoot(), nodes); 158 158 //CreateIdSortedList(bvh, nodes); 159 /* ofstream outstream("test.log"); 160 161 BvhNode *f = ((BvhInterior *)bvh->GetStaticRoot())->GetFront(); 162 BvhNode *b = ((BvhInterior *)bvh->GetStaticRoot())->GetBack(); 163 164 outstream << "front: " << f->GetFirstEntity() << " " << f->GetLastEntity() << endl; 165 outstream << "back: " << b->GetFirstEntity() << " " << b->GetLastEntity() << endl; 166 167 for (size_t i = 0; i < nodes.size(); ++ i) 168 { 169 BvhNode *n = nodes[i]; 170 //if (nodes[i]->GetId() >= nodes.size()) cout << "id " << nodes[i]->GetId() << endl; 171 if (n->IsVirtualLeaf()) 172 { 173 int geometrySize; 174 AxisAlignedBox3 box; 175 SceneEntity **ent = bvh->GetGeometry(n, geometrySize); 176 box = SceneEntity::ComputeBoundingBox(ent, geometrySize); 177 178 outstream << n->GetFirstEntity() << " " << n->GetLastEntity() << " " << n->GetBox() << " " << box << endl; 179 } 180 } 181 */ 159 160 const int tenpercent = number / 10; 161 int j = 0; 162 182 163 for (int i = 0; i < number; ++ i) 183 164 { 184 if ((i % number / 10) == (number / 10 - 1)) 185 cout << 100 * (i + 1) / 100 << "percent loaded" << endl; 165 if ((i % tenpercent) == (tenpercent - 1)) 166 { 167 j += 10; 168 cout << j << " percent of the view cells loaded" << endl; 169 } 186 170 187 171 fread(&entries, sizeof(int), 1, fw); … … 196 180 197 181 BvhNode *node = nodes[objectId]; 198 //if (i == 100) outstream << "t " << time << " ";199 182 mViewCells[i]->mPvs.AddEntry(bvh, node, time); 200 183 } 201 184 } 202 203 //outstream.close();204 185 205 186 return true; -
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.