ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/3ds2mgf.c
(Generate patch)

Comparing ray/src/cv/mgflib/3ds2mgf.c (file contents):
Revision 1.2 by greg, Thu Feb 8 13:29:33 1996 UTC vs.
Revision 1.5 by gregl, Fri Jan 16 10:47:27 1998 UTC

# Line 47 | Line 47 | extern unsigned _stklen = 16384;
47   #define MGF      4
48   #define RAW      99
49  
50 < #define DEG(x) ((180.0/M_PI)*(x))
51 < #define RAD(x) ((M_PI/180.0)*(x))
50 > #define DEG(x) ((double)(180.0/M_PI)*(x))
51 > #define RAD(x) ((double)(M_PI/180.0)*(x))
52  
53   #ifndef M_PI
54   #define M_PI (3.14159265358979323846)
# Line 351 | Line 351 | char *read_string (void);
351   float findfov (float lens);
352   int read_mgfmatname (char *s, int n, FILE *f);
353  
354 + char *progname;
355  
356 +
357   int main (int argc, char *argv[])
358   {
359      char meshfname[128];
# Line 453 | Line 455 | int main (int argc, char *argv[])
455   void process_args (int argc, char *argv[])
456   {
457      int i;
456    char *progname;
458      char *env_opt, *option;
459  
460      printf("\n\nAutodesk 3D Studio to Raytracer file Translator. Feb/96\n");
# Line 473 | Line 474 | void process_args (int argc, char *argv[])
474          printf ("         -b<object>   - Convert this object as a box\n");
475          printf ("         +i, -i       - Turn internal bounding on or off\n");
476          printf ("         +v, -v       - Turn verbose status messages on or off\n");
477 <        printf ("         -op          - Output to POV-Ray 2.0 format (default)\n");
477 >        printf ("         -op          - Output to POV-Ray 2.0 format\n");
478          printf ("         -op1         - Output to POV-Ray 1.0 format\n");
479          printf ("         -ov          - Output to Vivid format\n");
480          printf ("         -ol          - Output to poLyray format\n");
# Line 497 | Line 498 | void process_args (int argc, char *argv[])
498      else if (!strcmp(progname, "3ds2raw"))
499          format = RAW;
500      else
501 <        format = MGF;           /* default if program name strange */
501 >        format = POV20;         /* default if program name strange */
502  
503      strcpy (inname, "");
504      strcpy (outname, "");
# Line 1011 | Line 1012 | void write_light (FILE *f, char *name, Vector pos, Col
1012              if (name[0]) fprintf (f, "o %s\n", name);
1013              fprintf (f, "m\n\tsides 1\n\tc\n\t\t\tcmix %.3f R %.3f G %.3f B\n\ted %e\n",
1014                      CIE_Y_r*col.red, CIE_Y_g*col.green, CIE_Y_b*col.blue,
1015 <            10000.0*(CIE_Y_r*col.red + CIE_Y_g*col.green + CIE_Y_b*col.blue));
1015 >            100000.0*(CIE_Y_r*col.red + CIE_Y_g*col.green + CIE_Y_b*col.blue));
1016              fprintf (f, "v c =\n\tp %.4f %.4f %.4f\nsph c .01\n",
1017                      pos[X], pos[Y], pos[Z]);
1018              if (name[0]) fprintf (f, "o\n");
# Line 1086 | Line 1087 | void write_spot (FILE *f, char *name, Vector pos, Vect
1087              fprintf (f, "# hotspot: %.2f\n# falloff: %.2f\n", hotspot, falloff);
1088              fprintf (f, "m\n\tsides 1\n\tc\n\t\t\tcmix %.3f R %.3f G %.3f B\n\ted %e\n",
1089                      CIE_Y_r*col.red, CIE_Y_g*col.green, CIE_Y_b*col.blue,
1090 <            10000.0*(CIE_Y_r*col.red + CIE_Y_g*col.green + CIE_Y_b*col.blue));
1090 >            100000.0*(CIE_Y_r*col.red + CIE_Y_g*col.green + CIE_Y_b*col.blue));
1091              fprintf (f, "v c =\n\tp %.4f %.4f %.4f\n\tn %.4f %.4f %.4f\n",
1092                      pos[X], pos[Y], pos[Z],
1093                      target[X]-pos[X], target[Y]-pos[Y], target[Z]-pos[Z]);
# Line 2376 | Line 2377 | void parse_3ds (Chunk *mainchunk)
2377  
2378      do  {
2379          start_chunk (&chunk);
2380 <
2380 >        if (feof(in)) {
2381 >                fprintf(stderr, "%s: unexpected EOF\n", progname);
2382 >                break;
2383 >        }
2384          if (chunk.end <= mainchunk->end) {
2385              switch (chunk.tag) {
2386                  case 0x3D3D: parse_mdata (&chunk);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines