Ignore:
Timestamp:
01/19/09 10:28:16 (15 years ago)
Author:
mattausch
Message:

worked on visualizations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3285 r3286  
    157157 
    158158float shotRays = .0f; 
     159/// the visibility solution is initialized at this number of rays shot that  
     160int visibilitySolutionInitialState = 0; 
    159161 
    160162 
     
    480482                env.GetFloatParam(string("viewCellsScaleFactor"), viewCellsScaleFactor); 
    481483                env.GetFloatParam(string("skyDomeScaleFactor"), skyDomeScaleFactor); 
     484                env.GetIntParam(string("visibilitySolutionInitialState"), visibilitySolutionInitialState); 
    482485                 
    483486                //env.GetStringParam(string("modelPath"), model_path); 
     
    11921195                if (!walkThroughPlayer->ReadNextFrame(camera))  
    11931196                { 
     1197                        cout << "reached end of walkthrough" << endl; 
    11941198                        currentReplayFrame = -1; 
    11951199                        replayPath = false; 
     
    12161220        { 
    12171221                if (!walkThroughRecorder) 
     1222                { 
    12181223                        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) || 
    12211230                        (DotProd(oldDir, camera->GetDirection()) < 1.0f - 1e-6f)) 
    12221231                { 
     
    12391248                        LoadVisibilitySolution(); 
    12401249                        applicationTimer.Start(); 
     1250                        shotRays = visibilitySolutionInitialState; 
    12411251                } 
    12421252 
     
    18241834                        cout << "recording frames on replaying" << endl; 
    18251835                else 
    1826                         cout << "finished recording frames on replaying" << endl; 
     1836                        cout << "not recording frames on replaying" << endl; 
    18271837                break; 
    18281838        case GLUT_KEY_LEFT: 
     
    23752385                } 
    23762386 
    2377                 glColor3f(1.0f, 1.0f, 1.0f); 
     2387                glColor3f(0.0f, 1.0f, 0.0f); 
     2388 
    23782389                static char *alg_str[] = { 
    23792390                        "Frustum Cull" 
     
    23842395                }; 
    23852396         
    2386 #if 0 
    23872397                if (!showAlgorithmTime) 
    23882398                { 
     
    23902400                        {                        
    23912401                                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); 
    23932403                        } 
     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); 
    23942408                } 
    23952409                else 
    23962410                { 
    23972411                        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); 
    24082419        glDisable(GL_BLEND); 
    24092420        glDisable(GL_TEXTURE_2D); 
     
    26642675        viewCell = viewCellsTree->GetViewCell(camera->GetPosition()); 
    26652676 
    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; 
    26742686 
    26752687        SceneEntity::SetCurrentVisibleId(globalVisibleId); 
     
    26792691                PvsEntry entry = viewCell->mPvs.GetEntry(i); 
    26802692#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; 
    26842695#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 
    26922700        ++ globalVisibleId; 
    26932701} 
Note: See TracChangeset for help on using the changeset viewer.