if (top >= topLine [col]) // draw ceiling
{
drawVertLine (col, topLine [col], top, CEILING_COLOR); topLine [col] = ++top;
}
else // otherwise correct to
top = topLine [col]; // draw only visible part
if ( bottom <= bottomLine [col]) // draw floor {
drawVertLine ( col, bottom, bottomLine [col],
FLOOR_COLOR); bottomLine [col] = --bottom;
}
else
bottom = bottomLine [col];
topLine [col] = bottom + 1; bottomLine [col] = top -1;
// 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, WALL_COLOR );
colFilled [col] = OxFF; colsLeft--;
}
}
void drawLowerWall ( Texture * tex, SideDef * side, int coh, int col2,
int bottomHeight, int topHeight, Fixed tOffsl, Fixed tOffs2, int v1, int v2 )
{
Fixed b1 = int2Fixed ( 1001 + ( bottomHeight * VSCALE ) / v1 ); Fixed b2 = int2Fixed ( 1001 + ( bottomHeight * VSCALE ) / v2 ); Fixed t1 = int2Fixed ( 1001 + (topHeight * VSCALE ) / v1 ); Fixed t2 = int2Fixed ( 1001 + (topHeight * VSCALE ) / v2 );

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

Fixed db =(b2-b1 )/(col2-col1 );
Fixed dt = (t2 -11 ) / ( col2 - coM );
Fixed invV1 =(0NE«6)/v1;
Fixed invV2 = (ONE«6)/v2;
Fixed tlnvVI = (tOffsl «6) / v1;
Fixed tlnvV2 = (tOffs2«6) / v2;
Fixed dlnvV =(invV2-invV1)/(col2-col1);
Fixed dtlnvV = (tlnvV2 - tlnvVI ) / (col2 - coh);
Fixed invV =invV1;
Fixed tlnvV = tlnvVI;
Fixed texY;
Fixed dTexY;
int top, bottom;
int newTop;
int tOffset;
if ( co!1 < 0 ) // clip invisible part {
b1 -= coh * db; t1 -= coM * dt; invV -= coll * dlnvV; tlnvV -= coll * dtlnvV; coll = 0;
}
if ( col2 > 320 ) col2 = 320;
for (int col = coh; col < col2; col++ ) {
top = fixed2lnt (t1 );
bottom = fixed2lnt ( b1 ); newTop = top;
dTexY = int2Fixed (bottomHeight - topHeight + 1) / (bottom - top + 1);
texY = int2Fixed ( side -> yOffset) - (bottom - top + 1) * dTexY;
tOffset = tlnvV / invV;

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