Changeset 20248

Show
Ignore:
Timestamp:
05/22/07 10:49:35 (2 years ago)
Author:
patrick
Message:

Make better use of const. Fixed a couple of minor coding standard violations.
Replaced the use of vjProjection with vrj::Projection (in debug output).
No functional changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/vrjuggler/vrj/Display/Projection.cpp

    r20080 r20248  
    7272   gmtl::invert(view_mat_inv, mViewMat); 
    7373 
    74    // vprDEBUG(vprDBG_ALL, vprDBG_HVERB_LVL) << "GetApex:\nview mat:\n" << mViewMat << "\nviewMatInv:\n" << view_mat_inv << std::endl << vprDEBUG_FLUSH; 
     74   //vprDEBUG(vprDBG_ALL, vprDBG_HVERB_LVL) 
     75   //   << "[vrj::Projection::getFrustumApexAndCorners()]" << std::endl; 
     76   //vprDEBUG_NEXTnl(vprDBG_ALL, vprDBG_HVERB_LVL) 
     77   //   << "View matrix:\n" << mViewMat << std::endl; 
     78   //vprDEBUG_NEXTnl(vprDBG_ALL, vprDBG_HVERB_LVL) 
     79   //   << "Inverse view matrix:\n" << view_mat_inv << std::endl 
     80   //   << vprDEBUG_FLUSH; 
    7581 
    76  
    77    //float near_dist = mFocusPlaneDist; 
     82   //const float near_dist = mFocusPlaneDist; 
    7883   // Use like triangles to get the params for the focus surface 
    79    float mult_factor = mFocusPlaneDist/mFrustum[Frustum::VJ_NEAR]; 
    80    float bot = mFrustum[Frustum::VJ_BOTTOM]*mult_factor; 
    81    float left = mFrustum[Frustum::VJ_LEFT]*mult_factor; 
    82    float top = mFrustum[Frustum::VJ_TOP]*mult_factor; 
    83    float right = mFrustum[Frustum::VJ_RIGHT]*mult_factor; 
     84   const float mult_factor = mFocusPlaneDist / mFrustum[Frustum::VJ_NEAR]; 
     85   const float bot         = mFrustum[Frustum::VJ_BOTTOM] * mult_factor; 
     86   const float left        = mFrustum[Frustum::VJ_LEFT] * mult_factor; 
     87   const float top         = mFrustum[Frustum::VJ_TOP] * mult_factor; 
     88   const float right       = mFrustum[Frustum::VJ_RIGHT] * mult_factor; 
    8489 
    8590   // Create points in clip space 
    86    gmtl::Point3f apexClip(0.0f, 0.0f, 0.0f); 
    87    gmtl::Point3f urClip(right, top, -mFocusPlaneDist); 
    88    gmtl::Point3f lrClip(right, bot, -mFocusPlaneDist); 
    89    gmtl::Point3f ulClip(left, top, -mFocusPlaneDist); 
    90    gmtl::Point3f llClip(left, bot, -mFocusPlaneDist); 
     91   const gmtl::Point3f apex_clip(0.0f, 0.0f, 0.0f); 
     92   const gmtl::Point3f ur_clip(right, top, -mFocusPlaneDist); 
     93   const gmtl::Point3f lr_clip(right, bot, -mFocusPlaneDist); 
     94   const gmtl::Point3f ul_clip(left, top, -mFocusPlaneDist); 
     95   const gmtl::Point3f ll_clip(left, bot, -mFocusPlaneDist); 
    9196 
    92    apex = view_mat_inv * apexClip; 
    93    ur = view_mat_inv * urClip; 
    94    lr = view_mat_inv * lrClip; 
    95    ul = view_mat_inv * ulClip; 
    96    ll = view_mat_inv * llClip; 
     97   apex = view_mat_inv * apex_clip; 
     98   ur   = view_mat_inv * ur_clip; 
     99   lr   = view_mat_inv * lr_clip; 
     100   ul   = view_mat_inv * ul_clip; 
     101   ll   = view_mat_inv * ll_clip; 
    97102} 
    98103 
     
    123128} 
    124129 
    125 void Projection::setNearFar(float near_val, float far_val) 
     130void Projection::setNearFar(const float nearVal, const float farVal) 
    126131{ 
    127132   vprDEBUG(vprDBG_ALL,vprDBG_STATE_LVL) 
    128       << clrOutNORM(clrCYAN,"vjProjection::setNearFar:") 
    129       << "near: " << near_val << " far:" << far_val << std::endl 
     133      << clrOutNORM(clrCYAN, "[vrj::Projection::setNearFar()] ") 
     134      << "near: " << nearVal << ", far:" << farVal << std::endl 
    130135      << vprDEBUG_FLUSH; 
    131    mNearDist = near_val; 
    132    mFarDist = far_val; 
     136   mNearDist = nearVal; 
     137   mFarDist = farVal; 
    133138} 
    134139 
  • juggler/trunk/modules/vrjuggler/vrj/Display/Projection.h

    r20210 r20248  
    167167public: 
    168168   /** Sets the system-wide near and far values. */ 
    169    static void setNearFar(float near_val, float far_val); 
     169   static void setNearFar(const float nearVal, const float farVal); 
    170170 
    171171   /**