Ignore:
Timestamp:
09/08/08 00:52:31 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2911 r2913  
    151151        float fov = mFovy; 
    152152 
     153        const float aspectRatio = GetAspect(); 
     154 
    153155        const float w_near = 2.0f * tan(fov * 0.5f) * z_near; 
    154         const float h_near = w_near / GetAspect(); 
     156        const float h_near = w_near / aspectRatio; 
    155157 
    156158        const float w_far = 2.0f * tan(fov * 0.5f) * z_far; 
    157         const float h_far = w_far / GetAspect(); 
     159        const float h_far = w_far / aspectRatio; 
    158160 
    159161        const Vector3 fc = pos + view * z_far;  
     
    196198} 
    197199 
    198  
    199 Polyhedron *Camera::CalcClippedFrustum(const AxisAlignedBox3 &box) const 
    200 { 
    201         Vector3 ftl, ftr, fbl, fbr; 
    202         Vector3 ntl, ntr, nbl, nbr; 
    203  
    204         VertexArray sides[6]; 
    205  
    206         ComputeBasePoints(ftl, ftr, fbl, fbr,ntl, ntr, nbl, nbr); 
    207         //ComputePoints(ftl, ftr, fbl, fbr,ntl, ntr, nbl, nbr); 
    208  
    209         for (int i = 0; i < 6; i ++) 
    210                 sides[i].resize(4); 
    211          
    212         // left, right 
    213         sides[0][0] = ntl; sides[0][1] = ftl; sides[0][2] = fbl; sides[0][3] = nbl; 
    214         sides[1][0] = ntr; sides[1][1] = ftr; sides[1][2] = fbr; sides[1][3] = nbr; 
    215         // bottom, top 
    216         sides[2][0] = ntl; sides[2][1] = ftl; sides[2][2] = ftr; sides[2][3] = ntr; 
    217         sides[3][0] = nbl; sides[3][1] = fbl; sides[3][2] = fbr; sides[3][3] = nbr; 
    218         // near, far 
    219         sides[4][0] = ntl; sides[4][1] = ntr; sides[4][2] = nbr; sides[4][3] = nbl;  
    220         sides[5][0] = ntl; sides[5][1] = ntr; sides[5][2] = nbr; sides[5][3] = nbl; 
    221  
    222  
    223         ////////// 
    224         //-- compute polyhedron 
    225  
    226         PolygonContainer polygons; 
    227  
    228         for (int i = 0; i < 6; ++ i) 
    229         { 
    230                 Polygon3 *poly = new Polygon3(sides[i]); 
    231                 polygons.push_back(poly); 
    232         } 
    233  
    234         Polyhedron *p = new Polyhedron(polygons); 
    235  
    236         //Polyhedron *clippedPolyhedron = box.CalcIntersection(po); 
    237         //DEL_PTR(p); 
    238  
    239         //return clippedPolyhedron; 
    240         return p; 
    241 } 
    242200 
    243201 
Note: See TracChangeset for help on using the changeset viewer.