t1 +=dt;
b1 += db;
invV += dlnvV;
tlnvV += dtlnvV;
if (tex != NULL )
tOffset &= tex -> width -1;
if (topLine [col] > bottomLine [col]) continue;
if (top < topLine [col])
top = topLine [col]; // adjust top
if ( bottom < topLine [col]) bottom = topLine [col];
if ( bottom <= bottomLine [col]) // draw floor drawVertLine ( col, bottom, bottomLine [col]++, FLOOR_COLOR );

Компьютерная графика. Полигональные модели

else
bottom = bottomLine [col];
if (top < bottom ) // now draw visible
{ // part of wall
texY -= (newTop-top)*dTexY;
if(tex!=NULL)
drawTexturedLine ( col, top, bottom, tex, tOffset, texY, dTexY);
else
drawVertLine ( col, top, bottom,
LOWER_WALL_COLOR );
if (top < bottomLine [col] ) bottomLine [col] = top -1;
}
else
if ( bottom < bottomLine [col]) bottomLine [col] = bottom - 1;
if (topLine [col] > bottomLine [col]) {
cols Left__*
colFilled [col] = OxFF;
}
}
}
void drawUpperWall ( Texture * tex, SideDef * side, int coll, int col2,
int bottomHeight, int topHeight, Fixed tOffsl, Fixed tOffs2, int v1, int v2 )
{
Fixed b1 = int2Fixed ( 1001 - ( bottomHeight * VSCALE ) / v1 );
Fixed b2 = int2Fixed ( 100I - ( bottomHeight * VSCALE ) / v2 );
Fixed t1 = int2Fixed ( 100I - (topHeight * VSCALE ) / v1 );
Fixed t2 = int2Fixed ( 100I - (topHeight * VSCALE ) / v2 );
Fixed db = ( b2 - b1 ) / ( col2 - coll );
Fixed dt = (t2 -11 ) / ( col2 - coh );
Fixed invV1 =(ONE«6)/v1;
Fixed invV2 =(ONE«6)/v2;
Fixed tlnvVI =(tOffs1«6)/v1;
Fixed tlnvV2 = (tOffs2«6) / v2;
Fixed dlnvV =(invV2-invV1)/(col2-col1);
Fixed dtlnvV = (tlnvV2 - tlnvVI ) / (col2 - coll);
Fixed invV = invV1;
Fixed tlnvV = tlnvVI;
Fixed texY;
Fixed dTexY;
int top, bottom;
int newTop;
int tOffset;
if ( coh < 0 ) // clip invisible part {

13. Элементы виртуальной реальности

b1 -= coM * db; t1 -= coh * dt; invV -= coh * dlnvV; tlnvV -= coh *dtlnvV; coh = 0;
}
if ( col2 > 320 ) col2 = 320;
for (int col = coh; col < col2; col++ ) {
top = fixed2lnt (t1 ); bottom = fixed2lnt (b1 ); newTop = top;

⇐ Предыдущая| |Следующая ⇒