Changeset 3251


Ignore:
Timestamp:
01/06/09 15:18:41 (15 years ago)
Author:
mattausch
Message:

played around with pvs. now using pvs without vfc or anything. using function that allows to skip tree at some point

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3250 r3251  
    6161## powerplant options 
    6262 
    63 filename=PowerPlantM 
     63#filename=PowerPlantM 
    6464 
    65 keyForwardMotion=500.0f 
    66 mouseMotion=3.0f; 
    67 visibilitySolution=power-plant-2c-xx-1000b-pgv2 
    68 camPosition=-1320.57 -6306.34 3603 
    69 camDirection=0.292156 0.9556 0.0383878 
     65#keyForwardMotion=500.0f 
     66#mouseMotion=3.0f; 
     67#visibilitySolution=power-plant-2c-xx-1000b-pgv2 
     68#camPosition=-1320.57 -6306.34 3603 
     69#camDirection=0.292156 0.9556 0.0383878 
    7070 
    7171 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp

    r3065 r3251  
    119119                        mDistanceQueue.pop(); 
    120120         
     121                        if (1 && !IsNodeVisible(node, 10)) 
     122                        { 
     123                                node->SetVisible(false); 
     124                                continue; 
     125                        } 
     126                         
    121127                        if (mBvh->IsWithinViewFrustum(node)) 
    122128                        { 
     
    143149                                        // node was not recently tested => reset flag  
    144150                                        if (node->GetLastVisitedFrame() != mFrameId - 1) 
     151                                        { 
    145152                                                node->SetTimesTestedInvisible(0); 
     153                                        } 
    146154 
    147155                                        // update node's visited flag 
     
    162170                                        else 
    163171                                        { 
     172                                                // node is leaf => set to visible 
    164173                                                if (node->IsVirtualLeaf()) 
    165174                                                { 
     
    175184                                        // always traverse a node if it was previously visible 
    176185                                        if (wasVisible) 
     186                                        { 
    177187                                                TraverseNode(node); 
     188                                        } 
    178189                                } 
    179190                        } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCTraverser.cpp

    r3065 r3251  
    121121                                        // always traverse a node if it was visible 
    122122                                        if (wasVisible) 
     123                                        { 
    123124                                                TraverseNode(node); 
     125                                        } 
    124126                                } 
    125127                        } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp

    r3071 r3251  
    1818                mDistanceQueue.pop(); 
    1919         
     20                if (1 && !IsNodeVisible(node, 10)) 
     21                { 
     22                        node->SetVisible(false); 
     23                        continue; 
     24                } 
     25 
    2026                if (mBvh->IsWithinViewFrustum(node)) 
    2127                { 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp

    r3245 r3251  
    291291} 
    292292 
    293 } 
     293 
     294bool RenderTraverser::IsNodeVisible(BvhNode *node, int maxSize) 
     295{ 
     296        // no invisible objects 
     297        if (SceneEntity::GetGlobalVisibleId() == -1) return true; 
     298 
     299        int geometrySize; 
     300        SceneEntity **entities = mBvh->GetGeometry(node, geometrySize); 
     301 
     302        if (geometrySize > maxSize) return true; 
     303 
     304        for (int i = 0; i < geometrySize; ++ i) 
     305        { 
     306                if (entities[i]->IsVisible()) return true; 
     307        } 
     308         
     309        return false; 
     310} 
     311 
     312 
     313} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h

    r3147 r3251  
    168168        */ 
    169169        void ApplyRenderQueue(); 
     170 
     171        bool IsNodeVisible(BvhNode *node, int maxSize); 
    170172 
    171173 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h

    r3245 r3251  
    120120        static void SetGlobalVisibleId(int id); 
    121121 
     122        static int GetGlobalVisibleId(); 
     123 
    122124protected: 
     125 
    123126 
    124127        /** Internally updates current lod level. 
     
    219222 
    220223 
     224inline int SceneEntity::GetGlobalVisibleId() 
     225{ 
     226        return sVisibleId; 
     227} 
     228 
     229 
    221230inline int SceneEntity::GetVisibleId(int id) const 
    222231{ 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderManager.cpp

    r3147 r3251  
    6868        sCgFragmentProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT); 
    6969        //sCgFragmentProfile = CG_PROFILE_GPU_FP; 
    70                 //CG_PROFILE_FP40;; 
     70        if (sCgFragmentProfile == CG_PROFILE_FP40) 
     71                cout << "cg profile: fp40" << endl; 
     72        else 
     73                cout << "cg profile " << sCgFragmentProfile << endl; 
     74 
    7175        cgGLSetOptimalOptions(sCgFragmentProfile); 
    7276        // get the optimal vertex profile 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ViewCellsTree.cpp

    r3250 r3251  
    1515 
    1616// hack: this has to be set to 0.05f for powerplant, to 1 otherwise 
    17 static const float sScale = 0.05f; 
    18 //static const float sScale = 1.0f; 
     17//static const float sScale = 0.05f; 
     18static const float sScale = 1.0f; 
    1919 
    2020 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3250 r3251  
    466466                texHeight = winHeight; 
    467467 
    468                 cout << "assumedVisibleFrames: " << assumedVisibleFrames << endl;  
    469                 cout << "maxBatchSize: " << maxBatchSize << endl; 
    470                 cout << "trianglesPerVirtualLeaf: " << trianglesPerVirtualLeaf << endl; 
    471  
    472                 cout << "keyForwardMotion: " << keyForwardMotion << endl; 
    473                 cout << "keyRotation: " << keyRotation << endl; 
    474                 cout << "winWidth: " << winWidth << endl; 
    475                 cout << "winHeight: " << winHeight << endl; 
    476                 cout << "useFullScreen: " << useFullScreen << endl; 
    477                 cout << "useLODs: " << useLODs << endl; 
    478                 cout << "camPosition: " << camPos << endl; 
     468                cout << "assumed visible frames: " << assumedVisibleFrames << endl;  
     469                cout << "max batch size: " << maxBatchSize << endl; 
     470                cout << "triangles per virtual leaf: " << trianglesPerVirtualLeaf << endl; 
     471 
     472                cout << "key forward motion: " << keyForwardMotion << endl; 
     473                cout << "key rotation: " << keyRotation << endl; 
     474                cout << "win width: " << winWidth << endl; 
     475                cout << "win height: " << winHeight << endl; 
     476                cout << "use full screen: " << useFullScreen << endl; 
     477                cout << "use LODs: " << useLODs << endl; 
     478                cout << "camera position: " << camPos << endl; 
    479479                cout << "shadow size: " << shadowSize << endl; 
    480480                cout << "render method: " << renderMethod << endl; 
     
    483483                cout << "use advanced shading: " << useAdvancedShading << endl; 
    484484                cout << "turbitity: " << turbitity << endl; 
    485                 cout << "temporal coherence: " << ssaoTempCohFactor << endl; 
     485                cout << "temporal coherence factor: " << ssaoTempCohFactor << endl; 
    486486                cout << "sample intensity: " << ssaoSampleIntensity << endl; 
    487487                cout << "kernel radius: " << ssaoKernelRadius << endl; 
    488                 cout << "ssao full resolution: " << ssaoUseFullResolution << endl; 
     488                cout << "use ssao full resolution: " << ssaoUseFullResolution << endl; 
    489489                cout << "recorded frames suffix: " << recordedFramesSuffix << endl; 
    490490                cout << "stats filename: " << statsFilename << endl; 
    491                 cout << "filename: " << filename << endl; 
    492                 cout << "use PVS: " << usePvs << endl; 
    493                 cout << "visibilitySolution: " << visibilitySolution << endl; 
    494                 cout << "useSkylightForIllum" << useSkylightForIllum << endl; 
     491                cout << "static scene filename prefix: " << filename << endl; 
     492                cout << "use PVSs: " << usePvs << endl; 
     493                cout << "visibility solution: " << visibilitySolution << endl; 
     494                cout << "use skylight for illumination: " << useSkylightForIllum << endl; 
    495495 
    496496                //cout << "model path: " << model_path << endl; 
     
    11901190        glEnableClientState(GL_VERTEX_ARRAY); 
    11911191 
    1192         if (usePvs) 
     1192        if (0 && usePvs) 
    11931193        { 
    11941194                if (!viewCellsTree) LoadVisibilitySolution(); 
    1195  
    11961195                LoadPvs(); 
    11971196        } 
     
    12761275        else 
    12771276        { 
     1277                if (usePvs) 
     1278                { 
     1279                        if (!viewCellsTree) LoadVisibilitySolution(); 
     1280                        LoadPvs(); 
     1281                } 
     1282                else 
    12781283                // actually render the scene geometry using the specified algorithm 
    12791284                traverser->RenderScene(); 
     
    23022307                        sprintf(msg[i ++], "traversed: %5d, frustum culled: %5d, query culled: %5d", 
    23032308                                traversedNodes, frustumCulledNodes, queryCulledNodes); 
    2304                         sprintf(msg[i ++], "issued queries: %5d, renderstate changes: %5d, render batches: %5d",  
     2309                        sprintf(msg[i ++], "issued queries: %5d, state changes: %5d, render batches: %5d",  
    23052310                                issuedQueries, stateChanges, numBatches); 
    23062311 
     
    25802585        int numTriangles = 0; 
    25812586 
     2587        SceneEntity::SetGlobalVisibleId(globalVisibleId); 
     2588 
    25822589        for (int i = 0; i < viewCell->mPvs.Size(); ++ i) 
    25832590        { 
    25842591                SceneEntity *ent = viewCell->mPvs.GetEntry(i); 
     2592 
    25852593                ent->SetVisibleId(globalVisibleId); 
     2594                ent->Render(&renderState); 
    25862595 
    25872596                numTriangles += ent->CountNumTriangles(); 
    25882597        } 
    25892598 
    2590         SceneEntity::SetGlobalVisibleId(globalVisibleId ++); 
     2599        ++ globalVisibleId; 
    25912600} 
    25922601 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3247 r3251  
    6363 
    6464 
    65 //#define USE_GTX 
     65#define USE_GTX 
    6666 
    6767#endif // __SHADERENV_H 
Note: See TracChangeset for help on using the changeset viewer.