Changeset 2889


Ignore:
Timestamp:
08/31/08 17:09:46 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
9 edited

Legend:

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

    r2888 r2889  
    175175        float z_far = mFar; 
    176176 
    177         const float w_near = 2.0f * tan(mFovy / 2) * z_near; 
     177        float fov = 120 * M_PI / 180.0f;//mFovy; 
     178 
     179        const float w_near = 2.0f * tan(fov * 0.5f) * z_near; 
    178180        const float h_near = w_near / GetAspect(); 
    179         const float w_far = 2.0f * tan(mFovy / 2) * z_far; 
     181 
     182        const float w_far = 2.0f * tan(fov * 0.5f) * z_far; 
    180183        const float h_far = w_far / GetAspect(); 
    181184 
     
    183186        const Vector3 fc = mPosition + view * z_far;  
    184187         
    185         const Vector3 up = GetUpVector(); 
    186         const Vector3 right = GetRightVector(); 
     188        const Vector3 up = -GetUpVector(); 
     189        const Vector3 right = -GetRightVector(); 
    187190 
    188191        Vector3 t1, t2; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp

    r2862 r2889  
    226226        } 
    227227         
     228#if 0 
     229        // construct normals 
     230        for (int i = 0; i < vertexCount; i += 3) 
     231        { 
     232                Triangle3 tri(vertices[i], vertices[i + 1], vertices[i + 2]); 
     233 
     234                normals[i] = tri.GetNormal(); 
     235                normals[i+1] = tri.GetNormal(); 
     236                normals[i+2] = tri.GetNormal(); 
     237        } 
     238#endif 
    228239 
    229240        return new Geometry(vertices, normals, texcoords, vertexCount, true); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp

    r2888 r2889  
    139139        orthoCam->SetDirection(Vector3(0, 0, -1)); 
    140140 
    141         cout << orthoCam->GetDirection() << endl; 
    142141        Vector3 pos = Vector3(mSceneBox.Center().x, mSceneBox.Center().y, mSceneBox.Max().z); 
    143142        orthoCam->SetPosition(pos); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp

    r2888 r2889  
    540540        ComputeViewVectors(tl, tr, bl, br); 
    541541 
    542         glColor3f(1.0f, 1.0f, 1.0f); 
    543  
    544542        glBegin(GL_QUADS); 
    545543 
     
    547545        //const float new_offs = 0.55f; 
    548546        const float new_offs = 0.5f; 
    549          
    550         glColor3f(bl.x, bl.y, bl.z); glTexCoord2f(0, 0); glVertex3f(-new_offs, -new_offs, -0.5f); 
    551         glColor3f(br.x, br.y, br.z); glTexCoord2f(1, 0); glVertex3f( new_offs, -new_offs, -0.5f); 
    552         glColor3f(tr.x, tr.y, tr.z); glTexCoord2f(1, 1); glVertex3f( new_offs,  new_offs, -0.5f); 
    553         glColor3f(tl.x, tl.y, tl.z); glTexCoord2f(0, 1); glVertex3f(-new_offs,  new_offs, -0.5f); 
     547        /* 
     548        glTexCoord2f(0, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tl.x, tl.y, tl.z); glVertex3f(-new_offs, -new_offs, -0.5f); 
     549        glTexCoord2f(1, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tr.x, tr.y, tr.z); glVertex3f( new_offs, -new_offs, -0.5f); 
     550        glTexCoord2f(1, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, br.x, br.y, br.z); glVertex3f( new_offs,  new_offs, -0.5f); 
     551        glTexCoord2f(0, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, bl.x, bl.y, bl.z); glVertex3f(-new_offs,  new_offs, -0.5f); 
     552*/ 
     553        glTexCoord2f(0, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tr.x, tr.y, tr.z); glVertex3f(-new_offs, -new_offs, -0.5f); 
     554        glTexCoord2f(1, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tl.x, tl.y, tl.z); glVertex3f( new_offs, -new_offs, -0.5f); 
     555        glTexCoord2f(1, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, bl.x, bl.y, bl.z); glVertex3f( new_offs,  new_offs, -0.5f); 
     556        glTexCoord2f(0, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, br.x, br.y, br.z); glVertex3f(-new_offs,  new_offs, -0.5f); 
    554557 
    555558        glEnd(); 
     
    574577        mCamera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr); 
    575578 
    576 #if 1 // matT: debug this!! 
     579#if 1 
    577580         
    578581        bl = Normalize(nbl - fbl); 
     
    590593#endif 
    591594 
    592         // normalize to 0 .. 1 
    593         bl = bl * 0.5f + 0.5f; 
     595        // pack into 0 .. 1 
     596        /*bl = bl * 0.5f + 0.5f; 
    594597        br = br * 0.5f + 0.5f; 
    595598        tl = tl * 0.5f + 0.5f; 
    596         tr = tr * 0.5f + 0.5f; 
     599        tr = tr * 0.5f + 0.5f;*/ 
    597600} 
    598601 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h

    r2887 r2889  
    6565        void AntiAliasing(FrameBufferObject *fbo); 
    6666 
     67        /** Helper method that computes the view vectors in the corners of the current view frustum. 
     68        */ 
    6769        void ComputeViewVectors(Vector3 &tl, Vector3 &tr, Vector3 &bl, Vector3 &br); 
    6870 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp

    r2864 r2889  
    164164        mCamera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr); 
    165165 
     166        //mCamera->SetF 
    166167        glLineWidth(2); 
    167168 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.h

    r2840 r2889  
    4646        void SetFrameId(int frameId); 
    4747 
    48 protected: 
    49  
    50         /** Renders a camera frustum. 
     48                /** Renders a camera frustum. 
    5149        */ 
    5250        void RenderFrustum(); 
    5351 
     52protected: 
    5453 
    5554        //////////// 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2888 r2889  
    332332        camera->SetFar(1000); 
    333333 
    334         cout << "here2 " << Normalize(camDir) << endl; 
    335  
    336334        camera->SetDirection(camDir); 
    337  
    338         cout << "here3 " << camera->GetDirection() << endl; 
    339         cout << "here3 " << camera->GetRightVector() << endl; 
    340         cout << "here3 " << camera->GetUpVector() << endl; 
    341335 
    342336        camera->SetPosition(camPos); 
     
    15701564        glMatrixMode(GL_MODELVIEW); 
    15711565        glPopMatrix(); 
     1566 
     1567        Vector3 ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr; 
     1568 
     1569        camera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr); 
     1570 
     1571        Vector3 bl, br, tl, tr; 
     1572 
     1573        bl = Normalize(nbl - fbl) * 100; 
     1574        br = Normalize(nbr - fbr) * 100; 
     1575        tl = Normalize(ntl - ftl) * 100; 
     1576        tr = Normalize(ntr - ftr) * 100; 
     1577 
     1578        Vector3 dum = pos + camera->GetDirection() * 20; 
     1579 
     1580        // coordinates 
     1581        glColor3f(0.0f, 1.0f, 0.0f); 
     1582 
     1583        glBegin(GL_LINES); 
     1584        glVertex3d(dum.x, dum.y, dum.z); 
     1585        glVertex3d(dum.x + bl.x, dum.y + bl.y, dum.z + bl.z); 
     1586        glEnd(); 
     1587 
     1588/*      glColor3f(1.0f, 0.0f, 0.0f); 
     1589 
     1590        glBegin(GL_LINES); 
     1591        glVertex3d(dum.x, dum.y, dum.z); 
     1592        glVertex3d(dum.x + br.x, dum.y + br.y, dum.z + br.z); 
     1593        glEnd(); 
     1594 
     1595*/      glColor3f(0.0f, 0.0f, 1.0f); 
     1596 
     1597        glBegin(GL_LINES); 
     1598        glVertex3d(dum.x, dum.y, dum.z); 
     1599        glVertex3d(dum.x + tl.x, dum.y + tl.y, dum.z + tl.z); 
     1600        glEnd(); 
     1601/* 
     1602        glColor3f(1.0f, 0.0f, 1.0f); 
     1603 
     1604        glBegin(GL_LINES); 
     1605        glVertex3d(dum.x, dum.y, dum.z); 
     1606        glVertex3d(dum.x + tr.x, dum.y + tr.y, dum.z + tr.z); 
     1607        glEnd();*/ 
    15721608} 
    15731609 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r2888 r2889  
    1111         // normalized screen position 
    1212        float4 pos: WPOS; 
    13         float4 texCoord: TEXCOORD0;  
    14         float3 view: COLOR0; 
     13        float2 texCoord: TEXCOORD0;  
     14        float3 view: TEXCOORD1; 
    1515}; 
    1616 
     
    9595 
    9696        //return max(0.0f, 1.0f - total_ao); 
    97         //return saturate(dot(currentViewDir, currentNormal)); 
    98         return saturate(dot(currentViewDir, float3(0, -1, 0))); 
     97        return saturate(dot(currentViewDir, currentNormal)); 
    9998} 
    10099 
     
    125124        float3 normal = normalize(norm.xyz); 
    126125        /// the current view direction 
    127         float3 viewDir = normalize(IN.view * 2.0f - float3(1.0f)); 
     126        //float3 viewDir = normalize(IN.view * 2.0f - float3(1.0f)); 
     127        float3 viewDir = IN.view; 
    128128 
    129129        // the current world position 
     
    166166        } 
    167167 
     168        //OUT.illum_col.xyz = viewDir; 
    168169        OUT.illum_col.w = currentDepth; 
    169170 
Note: See TracChangeset for help on using the changeset viewer.