示例#1
0
文件: group_3d.C 项目: zear/sabre
void VVSHOW(R_3DPoint &p0, R_3DPoint &p1, R_3DPoint &p2, 
		  R_3DPoint &p3, Port_3D &port, REAL_TYPE minz)
{
  R_3DPoint ppoints[4];
  R_3DPoint rclipped_points[16];
  R_2DPoint screen_points[16];
  R_2DPoint clipped_points[32];
  int       npoints;
  int       nxpoints;

  int zclp = 0;
  if (p0.z < minz)
    zclp++;
  if (p1.z < minz)
    zclp++;
  if (p2.z < minz)
    zclp++;
  if (p3.z < minz)
    zclp++;
  /* if at least one vertice in front */
  if (zclp < 4)
    {
      /* need to zclip */
      if (zclp > 0)
	{
	  ppoints[0] = p0;
	  ppoints[1] = p1;
	  ppoints[2] = p2;
	  ppoints[3] = p3;
	  if (zpoly_clip(ppoints,4,rclipped_points,&npoints,minz))
	    {
	      MYCHECK(npoints < 16);
	      for (int i=0;i<npoints;i++)
		port.port2screen(rclipped_points[i],&screen_points[i]);
	      if (r_poly_clip(screen_points,clipped_points,npoints,
			      &nxpoints,&port.screen))
		{
		  nxpoints++;
		  clipped_points[nxpoints - 1] = clipped_points[0];
		  r_frame_convpoly(clipped_points,nxpoints);
		}
	    }
	}
      else
	{
	  port.port2screen(p0,&screen_points[0]);
	  port.port2screen(p1,&screen_points[1]);
	  port.port2screen(p2,&screen_points[2]);
	  port.port2screen(p3,&screen_points[3]);
	  if (r_poly_clip(screen_points,clipped_points,4,&npoints,
			  &port.screen))
	    {
	      npoints++;
	      clipped_points[npoints - 1] = clipped_points[0];
	      r_frame_convpoly(clipped_points,npoints);
	    }
	}
    }

}
示例#2
0
文件: pilot.C 项目: zear/sabre
int __cdecl Pilot::brdcst(int priority, int freq, char *mss, ...)
{
static char mssbuff[200];
	va_list ap;
	va_start(ap,mss);
	vsprintf(mssbuff,mss,ap);
	va_end(ap);
	MYCHECK(strlen(mssbuff) <= 127);
	return (broadcast(mssbuff,priority,freq));
}
int main(int argc, char **argv) {

  // Warning here
  while (0 && 4) {
  }

  // But no warning here, since 4 comes from a macro
  while (MYCHECK(argc)) {
  }

  return 0;
}
示例#4
0
文件: group_3d.C 项目: zear/sabre
/* Return true if face NOT visible */
inline int VVTEST(R_3DPoint &p0, R_3DPoint &p1, R_3DPoint &p2, 
		  R_3DPoint &p3, Port_3D &port, REAL_TYPE minz)
{
  R_3DPoint ppoints[4];
  R_3DPoint rclipped_points[16];
  R_2DPoint screen_points[16];
  R_2DPoint clipped_points[32];
  int       npoints;
  int       nxpoints;
  int result = 1;
  int zclp = 0;
  if (p0.z < minz)
    zclp++;
  if (p1.z < minz)
    zclp++;
  if (p2.z < minz)
    zclp++;
  if (p3.z < minz)
    zclp++;
  /* if at least one vertice in front */
  if (zclp < 4)
    {
      /* need to zclip */
      if (zclp > 0)
	{
	  ppoints[0] = p0;
	  ppoints[1] = p1;
	  ppoints[2] = p2;
	  ppoints[3] = p3;
	  if (zpoly_clip(ppoints,4,rclipped_points,&npoints,minz))
	    {
	      MYCHECK(npoints < 16);
	      for (int i=0;i<npoints;i++)
		port.port2screen(rclipped_points[i],&screen_points[i]);
	      if (r_poly_clip(screen_points,clipped_points,npoints,
			      &nxpoints,&port.screen))
		result = 0;
	    }
	}
      else
	{
	  port.port2screen(p0,&screen_points[0]);
	  port.port2screen(p1,&screen_points[1]);
	  port.port2screen(p2,&screen_points[2]);
	  port.port2screen(p3,&screen_points[3]);
	  if (r_poly_clip(screen_points,clipped_points,4,&npoints,
			  &port.screen))
	    result = 0;
	}
    }
  return (result);
}