Ejemplo n.º 1
0
//
// Utility function which returns true if the divline dl crosses line
// Returns -1 if there's no crossing, or the starting point's 0 or 1 side.
//
int P_LineIsCrossed(const line_t &line, const divline_t &dl)
{
   int a;
   return (a = P_PointOnLineSide(dl.x, dl.y, &line)) !=
   P_PointOnLineSide(dl.x + dl.dx, dl.y + dl.dy, &line) &&
   P_PointOnDivlineSide(line.v1->x, line.v1->y, &dl) !=
   P_PointOnDivlineSide(line.v1->x + line.dx, line.v1->y + line.dy, &dl) ? a : -1;
}
Ejemplo n.º 2
0
void gl_RenderMissingLines()
{
	for(int i=firstmissingseg;i<numsegs;i++)
	{
		seg_t * seg = &segs[i];

		// This line has already been processed
		if (seg->linedef->validcount==validcount) continue;

		// Don't draw lines facing away from the viewer
		divline_t dl = { seg->v1->x, seg->v1->y, seg->v2->x-seg->v1->x, seg->v2->y-seg->v1->y };
		if (P_PointOnDivlineSide(viewx, viewy, &dl)) continue;

		// Unfortunately there is no simple means to exclude lines here so we have
		// to draw them all. 
		sector_t ffakesec, bfakesec;

		sector_t * sector = gl_FakeFlat(seg->frontsector, &ffakesec, false);
		sector_t * backsector;

		if (seg->frontsector == seg->backsector) backsector=sector;
		else if (!seg->backsector) backsector=NULL;
		else backsector = gl_FakeFlat(seg->backsector, &bfakesec, true);

		GLWall wall;

		SetupWall.Start(true);

		wall.Process(seg, sector, backsector, NULL);
		rendered_lines++;

		SetupWall.Stop(true);
	}
}
Ejemplo n.º 3
0
//
// Also divline version
//
int P_BoxOnDivlineSide(const fixed_t *tmbox, const divline_t &dl)
{
   int p;

   if(!dl.dy)
   {
      return (tmbox[BOXBOTTOM] > dl.y) == (p = tmbox[BOXTOP] > dl.y) ?
         p ^ (dl.dx < 0) : -1;
   }
   if(!dl.dx)
   {
      return (tmbox[BOXLEFT] < dl.x) == (p = tmbox[BOXRIGHT] < dl.x) ?
         p ^ (dl.dy < 0) : -1;
   }
   if((dl.dx ^ dl.dy) >= 0)
   {
      return P_PointOnDivlineSide(tmbox[BOXRIGHT], tmbox[BOXBOTTOM], &dl) ==
         (p = P_PointOnDivlineSide(tmbox[BOXLEFT], tmbox[BOXTOP], &dl)) ? p : -1;
   }
   return P_PointOnDivlineSide(tmbox[BOXLEFT], tmbox[BOXBOTTOM], &dl) ==
      (p = P_PointOnDivlineSide(tmbox[BOXRIGHT], tmbox[BOXTOP], &dl)) ? p : -1;
}