Game Development Reference
In-Depth Information
c_PeakOffset, - c_PeakOffset };
float Coeff[] =
{ c_Slope, - c_Slope, - c_Slope, c_Slope };
for ( int i = 0 ; i < 4 ; i++ )
{
const int c_NumPoints = 100;
for ( int j = - c_NumPoints / 2 ;
j < c_NumPoints / 2 + 1 ; j++ )
{
float t = ( float )j * c_PointStep;
float P = Coef[i] * ( Ofs[i] - t );
8.
Arctangent is multiplied by exp(-x^2) :
float Mult = c_FlowMult *
exp( - c_FlowExp * P * P );
vec3 Pt( -t, Mult * c_Elevation *
atan( P ) / M_PI, Y[i] );
FBaseCurve[i].AddControlPoint(t *
exp( c_ControlExp * t * t ), Pt);
}
}
9.
Update the UI scrolling limits using the current number of elements:
FFlinger->FMinValue = 0.0f;
FFlinger->FMaxValue = c_OneImageSize *
( ( float )FNumImg - 1.0f );
}
10. Calculate the index of the currently selected index image:
int GetCurrentImage() const
{
return
(int)ceilf( FFlinger->GetValue() / OneImageSize );
}
11. Coordinates for individual quad are calculated in the QuadCoords() method, which
invokes Curve::GetPosition() for each of the four guiding curves:
virtual void QuadCoords( vec3* Pts, float t_center )
const
{
float Offs[] =
{ c_QuadSize, - c_QuadSize, - c_QuadSize, c_QuadSize };
for ( int i = 0 ; i < 4 ; i++ )
Pts[i] = FBaseCurve[i].GetPosition(
t_center - Offs[i] / 2 );
}
 
Search WWH ::




Custom Search