// draw upper part if ( side -> upperjx [0] != '-*)
drawUpperWall (texDict.getTexture(side->upper_tx), side, c1, c2,
sectors [otherSide->sector].

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

ceilingHeight - locZ, ceilingHeight - locZ, t1, t2, v1, v2 );
else
drawUpperWall ( NULL, side, d, c2, ceilingHeight - locZ, ceilingHeight - locZ, t1, t2, v1, v2 );
}
}
// Draw walls using horizon lines - only parts between horizon lines are drawn
void drawSimpleWall (Texture * tex, SideDef * side, int coh, int col2,
int bottomHeight, int topHeight, Fixed tOffsl, Fixed tOffs2, int v1, int v2 )
{
Fixed b1 = int2Fixed (100I + ( bottomHeight * VSCALE ) / v1 );
Fixed b2 =int2Fixed (1001 +(bottomHeight* VSCALE )/v2);
Fixed t1 = int2Fixed ( 1001 + (topHeight * VSCALE ) / v1 );
Fixed t2 = int2Fixed (1001 + (topHeight * VSCALE ) / v2 );
Fixed db = ( b2 - b1 ) / ( col2 - coM );
Fixed dt =(t2-t1 )/(col2-col1 );
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-coh);
Fixed dtlnvV = (tlnvV2 - tlnvVI ) / (col2 - coll);
Fixed invV = invV1;
Fixed tlnvV = tlnvVI;
Fixed texY;
Fixed dTexY;
int top, bottom;
int newTop;
int tOffset;
 if ( coll < 0 ) // clip invisible part {
b1 -= coll * db; t1 -= coll * dt; invV -= coh * dlnvV; tlnvV-=coh *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;
t1 += dt;
b1 +- db; invV += dlnvV;
tlnvV += dtlnvV;
if (tex != NULL )
tOffset &= tex -> width -1;
if (topLine [col] > bottomLine [col]) // nothing to draw here continue;
 if (top > bottomLine [col]) top = bottomLine [col];
if ( bottom < topLine [col]) bottom = topLine [cot];

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