home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / 3d / irit / docs / cexample / polygons.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-03  |  1004 b   |  46 lines

  1. #include "irit_sm.h"
  2. #include "cagd_lib.h"
  3. #include "iritprsr.h"
  4. #include "ip_cnvrt.h"
  5. #include "allocate.h"
  6.  
  7. void main(int argc, char **argv)
  8. {
  9.     int Handler,
  10.     FourPerFlat = TRUE, /* Settable parameters of IritSurface2Polygons. */
  11.     FineNess = 20,
  12.     ComputeUV = FALSE,
  13.     Optimal = FALSE;
  14.  
  15.     if ((Handler = IritPrsrOpenDataFile("-", TRUE, TRUE)) >= 0) {
  16.     IPObjectStruct
  17.         *PObj = IritPrsrGetObjects(Handler);
  18.  
  19.     /* Done with file - close it. */
  20.     IritPrsrCloseStream(Handler, TRUE);
  21.  
  22.     /* Process the surface into polygons. */
  23.     if (IP_IS_SRF_OBJ(PObj)) {
  24.         IPPolygonStruct
  25.             *PPoly = IritSurface2Polygons(PObj -> U.Srfs, FourPerFlat,
  26.                           FineNess, ComputeUV, Optimal);
  27.         IPObjectStruct
  28.             *PObjPoly = GenPOLYObject(PPoly);
  29.  
  30.         IritPrsrStdoutObject(PObjPoly);
  31.  
  32.         IPFreeObject(PObjPoly);
  33.     }
  34.     else
  35.         fprintf(stderr, "Read object is not a surface.\n");
  36.  
  37.     IPFreeObject(PObj);
  38.     }
  39.     else {
  40.     fprintf(stderr, "Failed to read from stdin\n");
  41.     exit(1);
  42.     }
  43.  
  44.     exit(0);
  45. }
  46.