Ignore:
Timestamp:
01/12/06 14:27:18 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp

    r522 r525  
    6767 
    6868 
    69 void Beam::ComputeFrustum(float &near, float &far, 
    70                                                   float &left, float &right, 
     69void Beam::ComputeFrustum(float &left, float &right, 
    7170                                                  float &bottom, float &top, 
    72                                                   const AxisAlignedBox3 &sceneBBox) 
     71                                                  float &near, float &far, 
     72                                                  const AxisAlignedBox3 &sceneBBox) const 
    7373{ 
    7474        const float xDirRange = mDirBox.Max().x - mDirBox.Min().x; 
    7575        const float yDirRange = mDirBox.Max().y - mDirBox.Min().y; 
    7676 
    77         near = 1; // NOTE: what is the best value for near and far plane? 
    78         far = sceneBBox.Size(sceneBBox.Size().DrivingAxis()); 
     77        near = 0.1; // NOTE: what is the best value for near and far plane? 
     78        far = 2.0f * Magnitude(sceneBBox.Diagonal()); 
    7979 
    80         left = 1.0f / tan(xDirRange * 0.5); 
    81         right = 1.0f / tan(xDirRange * 0.5); 
     80        left = near / tan(xDirRange * 0.5); 
     81        right = near / tan(xDirRange * 0.5); 
    8282 
    83         bottom = 1.0f / tan(yDirRange * 0.5); 
    84         top = 1.0f / tan(yDirRange * 0.5); 
     83        bottom = near / tan(yDirRange * 0.5); 
     84        top = near / tan(yDirRange * 0.5); 
    8585} 
     86 
     87Vector3 Beam::GetMainDirection() const 
     88{ 
     89         Vector3 directions[4]; 
     90          
     91         directions[0] = VssRay::GetDirection(dBox.Min().x, dBox.Min().y); 
     92         directions[1] = VssRay::GetDirection(dBox.Max().x, dBox.Min().y); 
     93         directions[2] = VssRay::GetDirection(dBox.Max().x, dBox.Max().y); 
     94         directions[3] = VssRay::GetDirection(dBox.Min().x, dBox.Max().y); 
     95 
     96        return Normalize(direction[0], direction[1], direction[2], direction[3]); 
     97} 
Note: See TracChangeset for help on using the changeset viewer.