Changeset 2853


Ignore:
Timestamp:
08/19/08 16:36:13 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
2 added
7 edited

Legend:

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

    r2847 r2853  
    284284                        </File> 
    285285                        <File 
     286                                RelativePath=".\src\SampleGenerator.cpp" 
     287                                > 
     288                        </File> 
     289                        <File 
     290                                RelativePath=".\src\SampleGenerator.h" 
     291                                > 
     292                        </File> 
     293                        <File 
    286294                                RelativePath=".\src\SceneQuery.cpp" 
    287295                                > 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/LODInfo.h

    r2848 r2853  
    1010 
    1111/** Class representing information about an LOD level. 
     12        The distance parameter indicates the distance where this 
     13        lod level is invoked - if the parameter value is smaller or equal  
     14        than the distance to the view point. 
    1215*/ 
    1316struct LODLevel 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Plane3.h

    r2782 r2853  
    1616        Plane3() {} 
    1717 
    18         //Plane3(const Vector3 &normal, float dist); 
    19  
    2018        Plane3(const Vector3 &a, const Vector3 &b, const Vector3 &c); 
    2119 
     
    2725                mD *= -1; 
    2826        } 
    29         /** Get disance to point. 
     27        /** Get distance to a point. 
    3028        */ 
    3129        inline float Distance(const Vector3 &v) const  
     
    7371        Vector3 mNormal; 
    7472        float mD; 
    75  
    76         ////////////////// 
    77  
    7873}; 
    7974 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp

    r2852 r2853  
    6060        //-- load lod levels 
    6161 
     62        // note: lods must be ordered from smallest distance to largest 
    6263        int numLODs; 
    6364        str.read(reinterpret_cast<char *>(&numLODs), sizeof(int)); 
     
    6566        for (int i = 0; i < numLODs; ++ i) 
    6667        { 
    67                 float distance; 
    68                 str.read(reinterpret_cast<char *>(&distance), sizeof(float)); 
     68                float dist; 
     69                str.read(reinterpret_cast<char *>(&dist), sizeof(float)); 
    6970 
    7071                int numShapes; 
    7172                str.read(reinterpret_cast<char *>(&numShapes), sizeof(int)); 
    7273 
    73                 LODLevel *lodLevel = new LODLevel(distance); 
     74                LODLevel *lodLevel = new LODLevel(dist); 
    7475 
    7576                for (int j = 0; j < numShapes; ++ j) 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp

    r2848 r2853  
    3535        const Vector3 pos = GetCenter(); 
    3636 
    37         const float distance = SqrDistance(pos, viewPoint); 
     37        const float dist = SqrDistance(pos, viewPoint); 
    3838 
    3939        mCurrentLODLevel = 0; 
    4040 
     41        // note: we assume that lods are ordered from smallest distance to largest 
    4142        const int l = (int)mLODLevels.size(); 
    4243 
     
    4546                LODLevel *lod = mLODLevels[i]; 
    4647 
    47                 if (lod->GetSquaredDistance() > distance) 
     48                if (lod->GetSquaredDistance() > dist) 
    4849                        break; 
    4950 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2851 r2853  
    3131#include "Halton.h" 
    3232#include "Transform3.h" 
     33#include "SampleGenerator.h" 
    3334 
    3435 
     
    188189bool useFullScreen = false; 
    189190 
    190 float expFactor = 0.1f; 
     191// exp factor for ssao 
     192float expFactor = 0.05f; 
    191193 
    192194// ssao number of samples 
     
    376378        glutInitWindowSize(winWidth, winHeight); 
    377379        glutInit(&argc, argv); 
    378         //glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_MULTISAMPLE); 
    379         glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); 
     380        glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_MULTISAMPLE); 
     381        //glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); 
    380382 
    381383        //glutInitDisplayString("samples=2"); 
     
    20412043        bool validIntersect = sceneQuery->CalcIntersection(playerPos); 
    20422044 
    2043         if (validIntersect )  
     2045        if (validIntersect)  
    20442046                // && ((playerPos.z - oldPos.z) < bvh->GetBox().Size(2) * 1e-1f)) 
    20452047        { 
     
    22712273void GenerateSamples() 
    22722274{ 
    2273         static HaltonSequence halton; 
     2275        /*static HaltonSequence halton; 
    22742276 
    22752277        float r[2]; 
     
    23282330                        } 
    23292331                } 
    2330                 //cout << "sample: " << samples[i] << " " << i / 2 << " " << samples[i + 1] << " r: " << sqrt(samples[i] * samples[i]  + samples[i + 1] * samples[i + 1]) << " tries: " << totalTries << endl; 
    2331         } 
    2332  
    2333         //cout << "minDist after= " << minDist << endl; 
     2332        } 
     2333*/ 
     2334 
     2335        static PoissonDiscSampleGenerator poisson(NUM_SAMPLES, 1.0f); 
     2336        poisson.Generate((Sample2 *)samples); 
    23342337} 
    23352338 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r2838 r2853  
    1010//#define SAMPLE_INTENSITY 0.125f 
    1111 
    12 #define AREA_SIZE 5e-1f 
     12#define AREA_SIZE 9e-1f 
    1313#define VIEW_CORRECTION_SCALE 0.3f 
    1414#define DISTANCE_SCALE 1e-6f 
     
    254254                (tex.y >= 0.0f) && (tex.y < 1.0f) &&  
    255255                (abs(depthDif)  < 8e-5f)) 
     256        { 
    256257                OUT.color = attenuated_color * expFactor + col1 * float4(1.0f - expFactor); 
     258        } 
    257259        else 
     260        { 
    258261                OUT.color = attenuated_color; 
     262        } 
    259263 
    260264        OUT.color.w = tex2D(colors, IN.texCoord.xy).w; 
Note: See TracChangeset for help on using the changeset viewer.