Ignore:
Timestamp:
01/12/09 19:03:24 (15 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
12 edited

Legend:

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

    r3270 r3271  
    652652        CollectNodes(mStaticRoot, nodes); 
    653653        //CollectNodes(mRoot, nodes); 
     654        // also add root 
     655        nodes.push_back(mRoot); 
    654656 
    655657        cout << "creating new indices" << endl; 
     
    799801 
    800802        CollectNodes(mDynamicRoot, nodes); 
     803        // also add root 
     804        nodes.push_back(mRoot); 
    801805 
    802806        const unsigned int bufferSize = 8 * (int)nodes.size(); 
     
    813817 
    814818                for (int j = 0; j < 8; ++ j) 
     819                { 
    815820                        (static_cast<Vector3 *>(mVertices))[node->GetId() * 8 + j] = node->GetBox().GetVertex(j); 
     821                } 
    816822        } 
    817823         
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/CHCPlusPlusTraverser.cpp

    r3259 r3271  
    119119                        mDistanceQueue.pop(); 
    120120         
    121                         if (!IsNodeGeometryVisible(node, 10)) 
    122                         { 
     121                        if (0 && !IsNodeGeometryVisible(node, 10)) 
     122                        { 
     123                                // todo: find out why it is jumping 
    123124                                node->SetLastVisitedFrame(mFrameId); 
    124125                                node->SetVisible(false); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrustumCullingTraverser.cpp

    r3258 r3271  
    1717                mDistanceQueue.pop(); 
    1818         
    19                 if (1 && !IsNodeGeometryVisible(node, 10)) 
     19                if (0 && !IsNodeGeometryVisible(node, 10)) 
    2020                { 
    2121                        node->SetVisible(false); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp

    r3261 r3271  
    315315 
    316316        deferred->GetFragmentProgramParameters()->SetViewMatrixParam(0); 
    317          
    318317        deferred->GetVertexProgramParameters()->SetModelMatrixParam(1); 
    319318        deferred->GetVertexProgramParameters()->SetOldModelMatrixParam(2); 
     
    425424 
    426425        cout << "loaded " << numTextures << " textures" << endl; 
    427  
    428426        cout << "loading shapes (geometry + materials)" << endl; 
    429427 
     
    432430 
    433431        cout << "loaded " << (int)mGeometryTable.size() << " shapes" << endl; 
    434  
    435432        cout << "loading scene entites" << endl; 
    436433         
     
    438435         
    439436        cout << "loaded " << numEntities << " scene entities" << endl; 
    440  
    441437        cout << "bin loading finished" << endl; 
    442438 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp

    r3270 r3271  
    9393 
    9494        tex[0].first = 0; tex[0].second = 0; 
    95         tex[1].first = 1; tex[1].second = 0; 
    96         tex[2].first = 1; tex[2].second = 1; 
     95        tex[1].first = 50; tex[1].second = 0; 
     96        tex[2].first = 50; tex[2].second = 50; 
    9797 
    9898        tex[3].first = 0; tex[3].second = 0; 
    99         tex[4].first = 1; tex[4].second = 1; 
    100         tex[5].first = 0; tex[5].second = 1; 
     99        tex[4].first = 50; tex[4].second = 50; 
     100        tex[5].first = 0; tex[5].second = 50; 
    101101 
    102102        for (size_t i = 0; i < triangles.size(); ++ i) 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp

    r3268 r3271  
    109109 
    110110        // scale the sky dome so no intersection with the scene is visible 
    111         const float scaleFactor = 80.0f; 
    112         //const float scaleFactor = 500.0f; 
     111        //const float scaleFactor = 80.0f; 
     112        const float scaleFactor = 1000.0f; 
    113113 
    114114        position.z -= 3.0f * scaleFactor; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StopAndWaitTraverser.cpp

    r3259 r3271  
    2222                mDistanceQueue.pop(); 
    2323         
    24                 if (1 && !IsNodeGeometryVisible(node, 10)) 
     24                if (0 && !IsNodeGeometryVisible(node, 10)) 
    2525                { 
    2626                        node->SetVisible(false); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp

    r3259 r3271  
    136136        BvhNodeContainer nodes; 
    137137        CreateIdSortedList(bvh, nodes); 
    138  
     138         
    139139        for (int i = 0; i < number; ++ i)  
    140140        { 
     
    148148                        fread(&objectId, sizeof(int), 1, fw); 
    149149                        fread(&time, sizeof(float), 1, fw); 
    150  
     150         
    151151                        BvhNode *node = nodes[objectId]; 
    152  
    153152                        mViewCells[i]->mPvs.AddEntry(bvh, node); 
    154153                } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3270 r3271  
    132132 
    133133string filename("city"); 
     134string bvhname(""); 
    134135string visibilitySolution(""); 
    135136 
     
    303304 
    304305GLuint sunQuery = 0; 
     306 
     307string walkThroughSuffix("frames"); 
    305308 
    306309 
     
    455458 
    456459                env.GetStringParam(string("recordedFramesSuffix"), recordedFramesSuffix); 
     460                env.GetStringParam(string("walkThroughSuffix"), walkThroughSuffix); 
    457461                env.GetStringParam(string("statsFilename"), statsFilename); 
    458462                env.GetStringParam(string("filename"), filename); 
     463                env.GetStringParam(string("bvhname"), bvhname); 
    459464                env.GetStringParam(string("visibilitySolution"), visibilitySolution); 
    460465 
     
    472477                cout << "max batch size: " << maxBatchSize << endl; 
    473478                cout << "triangles per virtual leaf: " << trianglesPerVirtualLeaf << endl; 
     479 
     480                cout << "static scene filename prefix: " << filename << endl; 
     481                cout << "bvh filename prefix: " << bvhname << endl; 
    474482 
    475483                cout << "key forward motion: " << keyForwardMotion << endl; 
     
    491499                cout << "use ssao full resolution: " << ssaoUseFullResolution << endl; 
    492500                cout << "recorded frames suffix: " << recordedFramesSuffix << endl; 
     501                cout << "walkthrough suffix: " << walkThroughSuffix << endl; 
    493502                cout << "stats filename: " << statsFilename << endl; 
    494                 cout << "static scene filename prefix: " << filename << endl; 
    495503                cout << "use PVSs: " << usePvs << endl; 
    496504                cout << "visibility solution: " << visibilitySolution << endl; 
     
    587595        //LoadModel("sibenik.dem", dynamicObjects); 
    588596 
     597#if 1 
     598 
     599        AxisAlignedBox3 pompeiiBox = SceneEntity::ComputeBoundingBox(staticObjects); 
     600 
    589601        // todo: dispose texture 
    590602        Texture *floorTex = new Texture(model_path + "stairs.c.01.tif"); 
     
    594606 
    595607        floorTex->Create(); 
    596  
    597  
    598608        Material *mymat = resourceManager->CreateMaterial(); 
    599609 
    600         mymat->GetTechnique(0)->SetDiffuse(RgbaColor(1, 1, 1, 1)); 
    601         mymat->GetTechnique(0)->SetTexture(floorTex); 
    602  
    603         const Vector3 offs(1300.0f, -2500.0f, .0f); 
     610        Technique *tech = mymat->GetDefaultTechnique(); 
     611        tech->SetDiffuse(RgbaColor(1, 1, 1, 1)); 
     612        tech->SetTexture(floorTex); 
     613 
     614        Technique *depthPass = new Technique(*tech); 
     615        Technique *deferred = new Technique(*tech); 
     616 
     617        depthPass->SetColorWriteEnabled(false); 
     618        depthPass->SetLightingEnabled(false); 
     619 
     620        ShaderProgram *defaultFragmentTexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("defaultFragmentTexMrt"); 
     621        ShaderProgram *defaultVertexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("defaultVertexMrt"); 
     622 
     623        deferred->SetFragmentProgram(defaultFragmentTexProgramMrt); 
     624        deferred->SetVertexProgram(defaultVertexProgramMrt); 
     625 
     626        deferred->GetFragmentProgramParameters()->SetViewMatrixParam(0); 
     627        deferred->GetVertexProgramParameters()->SetModelMatrixParam(1); 
     628        deferred->GetVertexProgramParameters()->SetOldModelMatrixParam(2); 
     629 
     630        deferred->SetTexture(floorTex); 
     631         
     632        mymat->AddTechnique(deferred); 
     633        mymat->AddTechnique(depthPass); 
     634 
     635 
     636        //const Vector3 offs(1300.0f, -2500.0f, .0f); 
     637        const Vector3 offs(pompeiiBox.Center(0), pompeiiBox.Center(1), 0); 
    604638        Matrix4x4 moffs = TranslationMatrix(offs); 
    605639 
     
    609643        SceneEntity *myplane =  
    610644                SceneEntityConverter().ConvertPlane(plane,  
    611                                                     500,  
    612                                                                                         500, 
     645                                                    pompeiiBox.Size(0), 
     646                                                                                        pompeiiBox.Size(1), 
    613647                                                                                        5,  
    614648                                                                                        5, 
     
    618652        resourceManager->AddSceneEntity(myplane); 
    619653        staticObjects.push_back(myplane); 
    620         /*const float side = 400.0f; 
    621         AxisAlignedBox3 mybox(Vector3(-side, -side, -side), Vector3(side, side, side)); 
    622  
    623         Transform3 *mytrafo2 = resourceManager->CreateTransform(moffs); 
    624  
    625         SceneEntity *myboxEnt =  
    626                 SceneEntityConverter().ConvertBox(mybox, mymat, mytrafo2); 
    627  
    628         staticObjects.push_back(myboxEnt); 
    629         resourceManager->AddSceneEntity(myboxEnt);*/ 
     654 
     655#endif 
    630656 
    631657#if 0 
     
    667693        //-- load the associated static bvh 
    668694 
    669         const string bvh_filename = string(model_path + filename + ".bvh"); 
    670  
    671695        BvhFactory bvhFactory; 
    672 #if 1 
    673         bvh = bvhFactory.Create(staticObjects, dynamicObjects, maxDepthForTestingChildren); 
    674 #else 
    675         bvh = bvhFactory.Create(bvh_filename, staticObjects, dynamicObjects, maxDepthForTestingChildren); 
    676 #endif 
    677  
    678         if (!bvh) 
    679         { 
    680                 cerr << "loading bvh " << bvh_filename << " failed" << endl; 
    681                 CleanUp(); 
    682                 exit(0); 
     696 
     697        if (bvhname != "") 
     698        { 
     699                cout << "loading bvh from disc" << endl; 
     700                const string bvh_fullpath = string(model_path + bvhname + ".bvh"); 
     701                bvh = bvhFactory.Create(bvh_fullpath, staticObjects, dynamicObjects, maxDepthForTestingChildren); 
     702 
     703                if (!bvh) 
     704                { 
     705                        cerr << "loading bvh " << bvh_fullpath << " failed" << endl; 
     706                        CleanUp(); 
     707                        exit(0); 
     708                } 
     709        } 
     710        else 
     711        { 
     712                cout << "creating new bvh" << endl; 
     713                bvh = bvhFactory.Create(staticObjects, dynamicObjects, maxDepthForTestingChildren); 
    683714        } 
    684715 
     
    11981229        { 
    11991230                if (!walkThroughPlayer) 
    1200                         walkThroughPlayer = new WalkThroughPlayer("frames.log"); 
     1231                        walkThroughPlayer = new WalkThroughPlayer(walkThroughSuffix + ".log"); 
    12011232                 
    12021233                ++ currentReplayFrame; 
     
    12291260        { 
    12301261                if (!walkThroughRecorder) 
    1231                         walkThroughRecorder = new WalkThroughRecorder("frames.log"); 
     1262                        walkThroughRecorder = new WalkThroughRecorder(walkThroughSuffix + ".log"); 
    12321263                 
    12331264                if ((Distance(oldPos, camera->GetPosition()) > 1e-6f) || 
     
    25602591{ 
    25612592        const string filename = string(model_path + model); 
    2562  
    25632593        int numEntities = 0; 
    25642594 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3251 r3271  
    66//-- ssao + gi parameters 
    77 
    8 #define NUM_SAMPLES 8 
     8//#define NUM_SAMPLES 8 
    99//#define NUM_SAMPLES 16 
    1010//#define NUM_SAMPLES 24 
    11 //#define NUM_SAMPLES 48 
     11#define NUM_SAMPLES 48 
    1212 
    1313#define MIN_SAMPLES 8 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg

    r3247 r3271  
    162162 
    163163                // the filtered ssao value 
    164                 //ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, scale, bl, br, tl, tr); 
     164                ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, scale, bl, br, tl, tr); 
    165165        } 
    166166 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3247 r3271  
    322322#endif 
    323323 
    324         return float3(total_ao, validSamples, numSamples); 
     324        //return float3(total_ao, validSamples, numSamples); 
     325        return float3(min(1.0f, total_ao), validSamples, numSamples); 
    325326} 
    326327 
Note: See TracChangeset for help on using the changeset viewer.