Game Development Reference
In-Depth Information
How it works...
The carousel rendering is based on Canvas and implemented in the RenderDirect()
function:
void RenderDirect( clPtr<clFlowFlinger> Control )
{
int Num = Control->FNumImg;
if ( Num < 1 ) { return; }
int CurImg = Control->GetCurrentImage();
float Dist = ( float )( Num * c_OneImageSize );
We manually specify the quad rendering order. First we render the left-hand side images, then
the images on the right-hand side, and inally the central image:
int ImgOrder[] = {
CurImg - 3, CurImg - 2, CurImg - 1,
CurImg + 3, CurImg + 2, CurImg + 1,
CurImg };
Actual rendering of checks for array boundaries, and application of the Projection and
View matrices to each corner of the quad:
for ( int in_i = 0 ; in_i < 7 ; in_i++ )
{
int i = ImgOrder[in_i];
if ( i < 0 )
{ i += ( 1 - ( ( int )( i / Num ) ) ) * Num; }
if ( i >= Num )
{ i -= ( ( int )( i / Num ) ) * Num; }
if ( i < Num && i > -1 )
{
vec3 Pt[4];
Control->QuadCoords(Pt,
Control->FFlinger->FValue - ( float )(i) *
c_OneImageSize);
vec3 Q[4];
for(int j = 0 ; j < 4 ; j++)
Q[j] = Control->FProjection *
Control->FView * Pt[j];
BoxR(Q, 0xFFFFFF);
}
}
}
 
Search WWH ::




Custom Search