// image plane
int u1 = vertexCache [seg -> fromj.u; int u2 = vertexCache [seg -> to].u; Fixed t1 = int2Fixed ( seg -> lineOffset); Fixed t2 = t1 + fixedDist ( u1, v1, u2, v2,
ANGLE_90 - seg -> angle + angle );
if ( v1 < VJvllN ) //clip 1st point
(
int oldll = u1; int oldV = v1;
u1 += (int)(((long)(V_MIN - v1)*(long)(u2 - u1)) / (v2 - v1)); v1 =V_MIN;
t1 = int2Fixed ( seg -> lineOffset) + fixedDist ( oldll, oldV, u1, v1, ANGLE_90 - seg->angle + angle);
}
if ( v2 < V_MIN ) - // clip 2nd point
{

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

u2 += (int)(((long)(V_MIN - v2)*(long)(u2 - u1)) / (v2 - v1 )); v2 = VJvllN;
t2 = t1 + fixedDist ( u1, v1, u2, v2,
ANGLE_90 - seg -> angle + angle );
}
// project vertices to screen int d = (int) ( 1601 - ( u1 * HSCALE ) / v1 ); int c2 = (int) ( 1601 - ( u2 * HSCALE ) / v2 );
// reject invisible segs if ( d >= SCREEN_WIDTH || c2 < 0 || c2 <= d ) return;
int canExit = 1; // check whether any column in range [c1, c2]
// remains unfilled for (register int i = c1; i < c2; \++ ) if (IcolFilled [i])
{
canExit = 0; break;
}
if (canExit) return;
SideDef * side = &sides [ lines [seg -> lineDefj.sideDefs [
seg -> lineSide]];
int floorHeight = sectors [side->sector].floorHeight; int ceilingHeight = sectors [side->sector].ceilingHeight;
if ( side -> main_tx [0] != '-') // simple wall from floor to ceiling
// no lower or upper drawSimpleWall (texDict.getTexture ( side -> main_tx ), side, c1, c2, locZ - floorHeight, locZ - ceilingHeight, t1, t2, v1, v2 );
else
{ // otherwise we'll need adjacent sector heights
SideDef * otherSide = &sides [lines [seg -> lineDef].sideDefS'
[seg -> lineSide A 1]];
// draw lower part if ( side -> lowerjx [0] != '-')
drawLowerWall (texDict.getTexture (side->lowerJx), side, c1, c2, locZ - floorHeight, locZ - sectors [otherSide ->sector].floorHeight, t1, t2, v1, v2 );
else
drawLowerWall ( NULL, side, c1, c2, locZ - floorHeight, locZ - floorHeight, t1, t2, v1, v2 );

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