Tachyon (current)  Current Main Branch
getargs.c
Go to the documentation of this file.
1 /*
2  * getargs.c - Tachyon command line argument parsing
3  *
4  * (C) Copyright 1994-2022 John E. Stone
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * $Id: getargs.c,v 1.60 2022/02/18 18:18:36 johns Exp $
8  *
9  */
10 
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include "tachyon.h"
15 #include "getargs.h"
16 #include "ctype.h"
17 
18 static int strupncmp(const char *a, const char *b, int n) {
19  while (n-- > 0) {
20  if (toupper(*a) != toupper(*b)) {
21  return toupper(*b) - toupper(*a);
22  }
23  if (*a == 0) return 0;
24  a++; b++;
25  }
26  return 0;
27 }
28 
29 static int compare(const char *a, const char *b) {
30  if (strlen(a) != strlen(b))
31  return -1;
32 
33  return strupncmp(a, b, strlen(a));
34 }
35 
36 static void printusage(char **argv) {
37  printf("Usage: \n");
38  printf(" %s modelfile [options] \n", argv[0]);
39  printf("\n");
40  printf("Model file formats supported:\n");
41  printf(" filename.dat -- The model files originated with this package.\n");
42  printf(" filaname.ac -- AC3D model files.\n");
43 #ifdef USELIBMGF
44  printf(" filaname.mgf -- MGF model files.\n");
45 #endif
46  printf(" filename.nff -- The NFF scene format used by Eric Haines' SPD.\n");
47  printf("\n");
48  printf("Valid options: (** denotes default behaviour)\n");
49  printf("----------------------------------------------\n");
50  printf("Message Options:\n");
51  printf(" +V verbose messages on \n");
52  printf(" -V verbose messages off **\n");
53  printf("\n");
54  printf("Speed Tuning Options:\n");
55  printf(" -raydepth xxx (maximum ray recursion depth\n");
56  printf(" -numthreads xxx (** default is auto-determined)\n");
57  printf(" -nobounding\n");
58  printf(" -boundthresh xxx (** default threshold is 16)\n");
59  printf("\n");
60  printf("Shading Options:\n");
61  printf(" -fullshade best quality rendering (and slowest) **\n");
62  printf(" -mediumshade good quality rendering, but no shadows\n");
63  printf(" -lowshade low quality rendering, preview (and fast)\n");
64  printf(" -lowestshade worst quality rendering, preview (and fastest)\n");
65  printf("\n");
66  printf("Lighting Options:\n");
67  printf(" -rescale_lights xxx rescale light intensity values by\n");
68  printf(" specified factor (performed before other\n");
69  printf(" lighting overrides take effect)\n");
70  printf(" -auto_skylight xxx force use of ambient occlusion lighting,\n");
71  printf(" auto-rescaling direct light sources to \n");
72  printf(" compensate for ambient occlusion factor.\n");
73  printf(" (use value 0.7 as a good starting point)\n");
74  printf(" -add_skylight xxx force use of ambient occlusion lighting,\n");
75  printf(" manually-rescaling direct light sources to\n");
76  printf(" compensate for ambient occlusion factor.\n");
77  printf(" -skylight_maxdist xxx AO maximum occlusion distance cutoff.\n");
78  printf(" -skylight_samples xxx number of sample rays to shoot.\n");
79  printf("\n");
80  printf("Specular Highlight Shading Options:\n");
81  printf(" -shade_phong Phong specular highlights\n");
82  printf(" -shade_blinn Blinn's specular highlights**\n");
83  printf(" -shade_blinn_fast fast approximation to Blinn's highlights\n");
84  printf(" -shade_nullphong disable specular highlights\n");
85  printf("\n");
86  printf("Transparency Shading Options:\n");
87  printf(" -trans_max_surfaces xxx Limit the number of transparent\n");
88  printf(" surfaces shown to the number specified\n");
89  printf(" -trans_orig Original implementation**\n");
90  printf(" -trans_raster3d Raster3D angle-based opacity modulation\n");
91  printf(" -trans_vmd Opacity post-multiply used by VMD\n");
92  printf("\n");
93  printf("Transparent Surface Shadowing Options:\n");
94  printf(" -shadow_filter_on Transparent objects cast shadows**\n");
95  printf(" -shadow_filter_off Transparent objects do not cast shadows\n");
96  printf("\n");
97  printf("Fog Shading Options:\n");
98  printf(" -fog_radial Radial fog implementation**\n");
99  printf(" -fog_vmd Planar OpenGL-like fog used by VMD\n");
100  printf("\n");
101  printf("Surface Normal/Winding Order Fixup Mode:\n");
102  printf(" -normalfixup [off | flip | guess] (**off is default)\n");
103  printf("\n");
104  printf("Antialiasing Options:\n");
105  printf(" -aasamples xxx (maximum supersamples taken per pixel)\n");
106  printf(" (** default is 0, or scene file determined)\n");
107  printf("\n");
108  printf("Output Options:\n");
109  printf(" -res Xres Yres override scene-defined output image size\n");
110  printf(" -o outfile.tga set output file name\n");
111  printf(" -clamp clamp pixel values to [0 to 1) (** default)\n");
112  printf(" -normalize normalize pixel values to [0 to 1)\n");
113  printf(" -gamma val normalize apply gamma correction\n");
114  printf(" -format BMP 24-bit Windows BMP (uncompressed)\n");
115 #if defined(USEJPEG)
116  printf(" -format JPEG 24-bit JPEG (compressed, but lossy)\n");
117 #else
118  printf(" -format JPEG XXX Not compiled into this binary XXX\n");
119 #endif
120 #if defined(USEPNG)
121  printf(" -format PNG 24-bit PNG (compressed, lossless)\n");
122 #else
123  printf(" -format PNG XXX Not compiled into this binary XXX\n");
124 #endif
125  printf(" -format PPM 24-bit PPM (uncompressed)\n");
126  printf(" -format PPM48 48-bit PPM (uncompressed)\n");
127  printf(" -format PSD48 48-bit PSD (uncompressed)\n");
128  printf(" -format RGB 24-bit SGI RGB (uncompressed)\n");
129  printf(" -format TARGA 24-bit Targa (uncompressed) **\n");
130  printf("\n");
131  printf("Animation Related Options:\n");
132  printf(" -camfile filename.cam Animate using file of camera positions.\n");
133  printf(" -nosave Disable writing of output frames to disk\n");
134  printf(" (only used for doing real-time rendering)\n");
135  printf("\n");
136  printf("Interactive Spaceball/SpaceNavigator Control:\n");
137  printf(" -spaceball Enable Spaceball/SpaceNavigator camera flight\n");
138  printf(" -spaceballport serialportdevicename (only for serial devices)\n");
139  printf("\n");
140 }
141 
142 static void initoptions(argoptions * opt) {
143  memset(opt, 0, sizeof(argoptions));
144  opt->filenames = (char **) malloc(sizeof(char *) * 10);
145  opt->numfiles = 0;
146  opt->useoutfilename = -1;
147  opt->outimageformat = -1;
148  opt->xsize = 0;
149  opt->ysize = 0;
150  opt->verbosemode = -1;
151  opt->ray_maxdepth = -1;
152  opt->aa_maxsamples = -1;
153  opt->boundmode = -1;
154  opt->boundthresh = -1;
155  opt->usecamfile = -1;
156  opt->shadermode = -1;
157  opt->phongfunc = -1;
158  opt->transcount = -1;
159  opt->transmode = -1;
160  opt->shadow_filtering = -1;
161  opt->fogmode = -1;
162  opt->normalfixupmode = -1;
163  opt->imgprocess = -1;
164  opt->imggamma = 1.0;
165  opt->numthreads = -1;
166  opt->nosave = -1;
167  opt->rescale_lights = 1.0;
168  opt->auto_skylight = 0.0;
169  opt->add_skylight = 0.0;
171  opt->skylight_samples = 128;
172  opt->cropmode = 0; /* SPECMPI image cropping */
173  opt->cropxres = 0;
174  opt->cropyres = 0;
175  opt->cropxstart = 0;
176  opt->cropystart = 0;
177 }
178 
179 /* process options that affect scene generation */
181  if (opt->normalfixupmode != -1) {
183  }
184 
185  return 0;
186 }
187 
188 /* process options that affect scene rendering */
190  if (opt->outimageformat == -1) {
192  }
193  if (opt->xsize > 0 && opt->ysize > 0) {
194  rt_resolution(scene, opt->xsize, opt->ysize);
195  }
196 
197  if (opt->cropmode != 0) {
198  if (opt->cropmode == 1) {
199  rt_crop_output(scene, opt->cropxres, opt->cropyres,
200  opt->cropxstart, opt->cropystart);
201  } else {
202  int xs, ys;
203  rt_get_resolution(scene, &xs, &ys);
204  rt_crop_output(scene, 100, 100, xs/2 - 50, ys/2 - 50);
205  }
206  }
207 
208  if (opt->useoutfilename == -1) {
209  if (opt->usecamfile != -1) {
210  strcpy(opt->outfilename, "cam.%04d");
211  } else if (opt->numfiles > 1) {
212  strcpy(opt->outfilename, "outfile.%04d");
213  } else {
214  strcpy(opt->outfilename, "outfile");
215  }
216 
217  switch (opt->outimageformat) {
218  case RT_FORMAT_PPM:
219  strcat(opt->outfilename, ".ppm");
220  break;
221 
222  case RT_FORMAT_WINBMP:
223  strcat(opt->outfilename, ".bmp");
224  break;
225 
226  case RT_FORMAT_SGIRGB:
227  strcat(opt->outfilename, ".rgb");
228  break;
229 
230  case RT_FORMAT_JPEG:
231  strcat(opt->outfilename, ".jpg");
232  break;
233 
234  case RT_FORMAT_PNG:
235  strcat(opt->outfilename, ".png");
236  break;
237 
238  case RT_FORMAT_PSD48:
239  strcat(opt->outfilename, ".psd");
240  break;
241 
242  case RT_FORMAT_PPM48:
243  strcat(opt->outfilename, ".ppm");
244  break;
245 
246  case RT_FORMAT_TARGA:
247  default:
248  strcat(opt->outfilename, ".tga");
249  break;
250  }
251  }
252 
253  if (opt->nosave == 1) {
254  strcpy(opt->outfilename, "\0");
255  }
256 
257  if (opt->rescale_lights < 1.0) {
258  /* rescale all lights by supplied scaling factor */
259  rt_rescale_lights(scene, opt->rescale_lights);
260  }
261 
262  if (opt->auto_skylight > 0.0) {
263  /* enable ambient occlusion lighting, and rescale direct lights */
264  /* to compensate. */
265  apicolor col;
266  float lightscale = 1.0f - opt->auto_skylight;
267  if (lightscale < 0.0f)
268  lightscale = 0.0f;
269  rt_rescale_lights(scene, lightscale);
270 
271  col.r = opt->auto_skylight;
272  col.g = opt->auto_skylight;
273  col.b = opt->auto_skylight;
275  } else if (opt->add_skylight > 0.0) {
276  /* enable ambient occlusion lighting, with no automatic compensation */
277  apicolor col;
278  col.r = opt->add_skylight;
279  col.g = opt->add_skylight;
280  col.b = opt->add_skylight;
282  }
283 
284  rt_outputformat(scene, opt->outimageformat);
285  rt_outputfile(scene, opt->outfilename);
286 
287  if (opt->imgprocess != -1) {
288  switch(opt->imgprocess) {
289  case 0:
290  rt_image_clamp(scene);
291  break;
292 
293  case 1:
294  rt_image_normalize(scene);
295  break;
296 
297  case 2:
298  rt_image_gamma(scene, opt->imggamma);
299  break;
300  }
301  }
302 
303  if (opt->verbosemode == 1) {
304  rt_verbose(scene, 1);
305  }
306 
307  if (opt->verbosemode == 0) {
308  rt_verbose(scene, 0);
309  }
310 
311  if (opt->ray_maxdepth != -1) {
312  rt_camera_raydepth(scene, opt->ray_maxdepth);
313  }
314 
315  if (opt->aa_maxsamples != -1) {
316  rt_aa_maxsamples(scene, opt->aa_maxsamples);
317  }
318 
319  if (opt->boundmode != -1) {
320  rt_boundmode(scene, opt->boundmode);
321  }
322 
323  if (opt->boundthresh != -1) {
324  rt_boundthresh(scene, opt->boundthresh);
325  }
326 
327  if (opt->shadermode != -1) {
328  rt_shadermode(scene, opt->shadermode);
329  }
330 
331  if (opt->phongfunc != -1) {
332  rt_phong_shader(scene, opt->phongfunc);
333  }
334 
335  if (opt->transcount != -1) {
336  rt_trans_max_surfaces(scene, opt->transcount);
337  }
338 
339  if (opt->transmode != -1) {
340  rt_trans_mode(scene, opt->transmode);
341  }
342 
343  if (opt->shadow_filtering != -1) {
345  }
346 
347  if (opt->fogmode != -1) {
348  rt_fog_rendering_mode(scene, opt->fogmode);
349  }
350 
351  if (opt->numthreads != -1) {
352  rt_set_numthreads(scene, opt->numthreads);
353  }
354 
355  return 0;
356 }
357 
358 static int getparm(int argc, char **argv, int num, argoptions * opt, int node) {
359  if (!strcmp(argv[num], "-o")) {
360  opt->useoutfilename = 1;
361  sscanf(argv[num + 1], "%s", (char *) &opt->outfilename);
362  return 2;
363  }
364  if (!strcmp(argv[num], "-numthreads")) {
365  sscanf(argv[num + 1], "%d", &opt->numthreads);
366  return 2;
367  }
368  if (!strcmp(argv[num], "-camfile")) {
369  opt->usecamfile = 1;
370  sscanf(argv[num + 1], "%s", &opt->camfilename[0]);
371  return 2;
372  }
373  if (!strcmp(argv[num], "-nosave")) {
374  /* disable writing of images to disk files */
375  opt->nosave = 1;
376  return 1;
377  }
378  if (!strcmp(argv[num], "-normalfixup")) {
379  char tmp[1024];
380  sscanf(argv[num + 1], "%s", tmp);
381  if (!strcmp(tmp, "off")) {
383  } else if (!strcmp(tmp, "flip")) {
385  } else if (!strcmp(tmp, "guess")) {
387  }
388  return 2;
389  }
390  if (!strcmp(argv[num], "-raydepth")) {
391  sscanf(argv[num + 1], "%d", &opt->ray_maxdepth);
392  return 2;
393  }
394  if (!strcmp(argv[num], "-aasamples")) {
395  sscanf(argv[num + 1], "%d", &opt->aa_maxsamples);
396  return 2;
397  }
398  if (!strcmp(argv[num], "-V")) {
399  /* turn verbose messages off */
400  opt->verbosemode = 0;
401  return 1;
402  }
403  if (!strcmp(argv[num], "+V")) {
404  /* turn verbose messages on */
405  opt->verbosemode = 1;
406  return 1;
407  }
408  if (!strcmp(argv[num], "-nobounding")) {
409  /* disable automatic spatial subdivision optimizations */
411  return 1;
412  }
413  if (!strcmp(argv[num], "-boundthresh")) {
414  /* set automatic bounding threshold control value */
415  sscanf(argv[num + 1], "%d", &opt->boundthresh);
416  return 2;
417  }
418  if (!strcmp(argv[num], "-fullshade")) {
419  opt->shadermode = RT_SHADER_FULL;
420  return 1;
421  }
422  if (!strcmp(argv[num], "-mediumshade")) {
424  return 1;
425  }
426  if (!strcmp(argv[num], "-lowshade")) {
427  opt->shadermode = RT_SHADER_LOW;
428  return 1;
429  }
430  if (!strcmp(argv[num], "-lowestshade")) {
432  return 1;
433  }
434  if (!strcmp(argv[num], "-rescale_lights")) {
435  sscanf(argv[num + 1], "%f", &opt->rescale_lights);
436  return 2;
437  }
438  if (!strcmp(argv[num], "-auto_skylight")) {
439  sscanf(argv[num + 1], "%f", &opt->auto_skylight);
440  return 2;
441  }
442  if (!strcmp(argv[num], "-add_skylight")) {
443  sscanf(argv[num + 1], "%f", &opt->add_skylight);
444  return 2;
445  }
446  if (!strcmp(argv[num], "-skylight_maxdist")) {
447  sscanf(argv[num + 1], "%f", &opt->skylight_maxdist);
448  return 2;
449  }
450  if (!strcmp(argv[num], "-skylight_samples")) {
451  sscanf(argv[num + 1], "%d", &opt->skylight_samples);
452  return 2;
453  }
454  if (!strcmp(argv[num], "-shade_phong")) {
455  opt->phongfunc = RT_SHADER_PHONG;
456  return 1;
457  }
458  if (!strcmp(argv[num], "-shade_blinn")) {
459  opt->phongfunc = RT_SHADER_BLINN;
460  return 1;
461  }
462  if (!strcmp(argv[num], "-shade_blinn_fast")) {
464  return 1;
465  }
466  if (!strcmp(argv[num], "-shade_nullphong")) {
468  return 1;
469  }
470  if (!strcmp(argv[num], "-trans_max_surfaces")) {
471  sscanf(argv[num + 1], "%d", &opt->transcount);
472  return 2;
473  }
474  if (!strcmp(argv[num], "-trans_orig")) {
475  opt->transmode = RT_TRANS_ORIG; /* reset all flags to default */
476  return 1;
477  }
478  if (!strcmp(argv[num], "-trans_raster3d")) {
479  if (opt->transmode == -1)
480  opt->transmode = RT_TRANS_RASTER3D; /* combine with other flags */
481  else
482  opt->transmode |= RT_TRANS_RASTER3D; /* combine with other flags */
483  return 1;
484  }
485  if (!strcmp(argv[num], "-trans_vmd")) {
486  if (opt->transmode == -1)
487  opt->transmode = RT_TRANS_VMD; /* combine with other flags */
488  else
489  opt->transmode |= RT_TRANS_VMD; /* combine with other flags */
490  return 1;
491  }
492  if (!strcmp(argv[num], "-shadow_filter_on")) {
493  opt->shadow_filtering = 1;
494  return 1;
495  }
496  if (!strcmp(argv[num], "-shadow_filter_off")) {
497  opt->shadow_filtering = 0;
498  return 1;
499  }
500  if (!strcmp(argv[num], "-fog_normal")) {
501  opt->fogmode = RT_FOG_NORMAL;
502  return 1;
503  }
504  if (!strcmp(argv[num], "-fog_vmd")) {
505  opt->fogmode = RT_FOG_VMD;
506  return 1;
507  }
508  if (!strcmp(argv[num], "-res")) {
509  sscanf(argv[num + 1], "%d", &opt->xsize);
510  sscanf(argv[num + 2], "%d", &opt->ysize);
511  return 3;
512  }
513  if (!strcmp(argv[num], "-cropoutputauto")) {
514  opt->cropmode = 2; /* SPECMPI automatic mode */
515  return 1;
516  }
517  if (!strcmp(argv[num], "-cropoutput")) {
518  opt->cropmode = 1;
519  sscanf(argv[num + 1], "%d", &opt->cropxres);
520  sscanf(argv[num + 2], "%d", &opt->cropyres);
521  sscanf(argv[num + 3], "%d", &opt->cropxstart);
522  sscanf(argv[num + 4], "%d", &opt->cropystart);
523  return 5;
524  }
525  if (!strcmp(argv[num], "-clamp")) {
526  opt->imgprocess = 0; /* clamp pixel values */
527  return 1;
528  }
529  if (!strcmp(argv[num], "-normalize")) {
530  opt->imgprocess = 1; /* normalize pixel values */
531  return 1;
532  }
533  if (!strcmp(argv[num], "-gamma")) {
534  opt->imgprocess = 2; /* normalize pixel values */
535  sscanf(argv[num + 1], "%f", &opt->imggamma);
536  return 2;
537  }
538  if (!strcmp(argv[num], "-format")) {
539  char str[80];
540  sscanf(argv[num + 1], "%s", &str[0]);
541 
542  if (!compare(str, "TARGA")) {
544  } else if (!compare(str, "BMP")) {
546  } else if (!compare(str, "PPM48")) {
548  } else if (!compare(str, "PPM")) {
550  } else if (!compare(str, "PSD48")) {
552  } else if (!compare(str, "RGB")) {
554 #if defined(USEJPEG)
555  } else if (!compare(str, "JPEG")) {
557 #endif
558 #if defined(USEPNG)
559  } else if (!compare(str, "PNG")) {
561 #endif
562  } else {
563  if (node == 0)
564  printf("Unknown/Unsupported Image Format: %s, defaulting to Targa...\n", str);
565  }
566  return 2;
567  }
568 
569  if (!strcmp(argv[num], "-spaceball")) {
570  opt->spaceballon=1;
571  return 1;
572  }
573  if (!strcmp(argv[num], "-spaceballport")) {
574  sscanf(argv[num + 1], "%s", &opt->spaceballport[0]);
575  return 2;
576  }
577 
578  /* unknown parameter setting */
579  if (node == 0)
580  printf("Unrecognized parameter/option flag: %s\n", argv[num]);
581 
582  return -1;
583 }
584 
585 int getargs(int argc, char **argv, argoptions * opt, int node) {
586  int i, rc;
587 
588  if (opt == NULL)
589  return -1;
590 
591  if (argc < 2) {
592  if (node == 0)
593  printusage(argv);
594 
595  return -1;
596  }
597 
598  initoptions(opt);
599 
600  i = 1;
601  while (i < argc) {
602  if (argv[i][0] == '-' || argv[i][0] == '+') {
603  rc = getparm(argc, argv, i, opt, node);
604  if (rc != -1) {
605  i += rc;
606  } else {
607  if (node == 0)
608  printusage(argv);
609 
610  return -1;
611  }
612  }
613  else {
614  opt->filenames = (char **) realloc(opt->filenames, sizeof(char *) * (opt->numfiles + 10));
615  opt->filenames[opt->numfiles] =
616  (char *) malloc(sizeof(char) * strlen(argv[i]) + 1);
617  strcpy(opt->filenames[opt->numfiles], argv[i]);
618 
619 #if 0
620 { int i;
621  for (i=0; i<opt->numfiles; i++) {
622  printf("parsefile[%d]: %s\n", i, opt->filenames[i]);
623  }
624 }
625 #endif
626 
627  opt->numfiles++;
628  i++;
629  }
630  }
631 
632  if (opt->numfiles == 0) {
633  if (node == 0) {
634  printf("Missing model file name!\n");
635  printusage(argv);
636  }
637  return -1;
638  }
639 
640  return 0;
641 }
642 
643 void freeoptions(argoptions * opt) {
644  if (opt->filenames != NULL) {
645  int i;
646 
647  for (i=0; i<opt->numfiles; i++) {
648  if (opt->filenames[i] != NULL)
649  free(opt->filenames[i]);
650  }
651 
652  free(opt->filenames);
653  }
654 }
655 
int transcount
max transparent surfaces to render
Definition: getargs.h:27
#define RT_NORMAL_FIXUP_GUESS
random normal/winding, use best guess
Definition: tachyon.h:304
float g
Green color component.
Definition: tachyon.h:61
#define RT_FORMAT_PPM
24-bit NetPBM PPM file
Definition: tachyon.h:241
float r
Red color component.
Definition: tachyon.h:60
int shadermode
quality level
Definition: getargs.h:24
void rt_set_numthreads(SceneHandle voidscene, int numthreads)
Explicitly set the number of worker threads Tachyon will use.
Definition: api.c:471
int cropmode
post rendering image crop (SPECMPI)
Definition: getargs.h:44
int verbosemode
verbose flags
Definition: getargs.h:17
static int strupncmp(const char *a, const char *b, int n)
Definition: getargs.c:18
void rt_shadermode(SceneHandle voidscene, int mode)
Set the shading mode for the specified scene.
Definition: api.c:646
void rt_resolution(SceneHandle voidscene, int hres, int vres)
Set the horizontal and vertical resolution (in pixels) for the specified scene.
Definition: api.c:372
#define RT_TRANS_VMD
mult shaded color by opacity, for VMD
Definition: tachyon.h:459
void rt_trans_mode(SceneHandle voidscene, int mode)
Set transparency rendering mode.
Definition: api.c:619
static void printusage(char **argv)
Definition: getargs.c:36
int ray_maxdepth
maximum ray recursion depth
Definition: getargs.h:18
void rt_trans_max_surfaces(SceneHandle voidscene, int count)
Set the maximum number of transparent surfaces that will be rendered.
Definition: api.c:224
void rt_fog_rendering_mode(SceneHandle voidscene, int mode)
Set fog rendering mode, either radial fog (native Tachyon behavior), or an OpenGL- or VMD-like planar...
Definition: api.c:581
char camfilename[FILENAME_MAX]
camera filename
Definition: getargs.h:23
#define RT_SHADER_NULL_PHONG
Disable Phong contributions.
Definition: tachyon.h:673
char ** filenames
list of model files to render
Definition: getargs.h:12
int ysize
override default image y resolution
Definition: getargs.h:33
#define RT_SHADER_LOW
low quality shading
Definition: tachyon.h:657
#define RT_TRANS_ORIG
original transparency mode
Definition: tachyon.h:458
int imgprocess
image post processing flags
Definition: getargs.h:35
#define RT_SHADER_BLINN_FAST
Fast version of Blinn&#39;s equation.
Definition: tachyon.h:674
void rt_aa_maxsamples(SceneHandle voidscene, int maxsamples)
Sets the maximum number of supersamples to take for any pixel.
Definition: api.c:210
#define RT_SHADER_FULL
Highest quality shading available.
Definition: tachyon.h:660
int boundmode
bounding mode
Definition: getargs.h:20
int shadow_filtering
transparent surface shadowing mode
Definition: getargs.h:28
#define RT_FORMAT_JPEG
24-bit JPEG file
Definition: tachyon.h:243
int numthreads
explicit number of threads to use
Definition: getargs.h:30
void freeoptions(argoptions *opt)
Definition: getargs.c:643
int boundthresh
bounding threshold
Definition: getargs.h:21
float imggamma
image gamma correction factor
Definition: getargs.h:36
char spaceballport[FILENAME_MAX]
spaceball serial port device
Definition: getargs.h:43
int skylight_samples
number of ambient occlusion samples
Definition: getargs.h:41
int normalfixupmode
override normal fixup mode
Definition: getargs.h:34
static void initoptions(argoptions *opt)
Definition: getargs.c:142
void rt_ambient_occlusion(SceneHandle voidscene, int numsamples, apiflt maxdist, apicolor col)
Ambient occlusion lighting, with monte carlo sampling of omnidirectional "sky" light.
Definition: api.c:563
#define RT_TRANS_RASTER3D
angle-dependent opacity modulation
Definition: tachyon.h:460
void rt_rescale_lights(SceneHandle voidscene, flt lightscale)
Rescale all light sources in the scene by factor lightscale.
Definition: api.c:673
int cropxres
Definition: getargs.h:45
int nosave
don&#39;t write output image to disk
Definition: getargs.h:31
#define RT_FOG_VMD
planar OpenGL-like fog
Definition: tachyon.h:420
#define RT_BOUNDING_DISABLED
Disable spatial subdivision/bounding.
Definition: tachyon.h:474
#define RT_SHADER_LOWEST
lowest quality shading available
Definition: tachyon.h:656
int fogmode
fog rendering mode
Definition: getargs.h:29
int numfiles
number of files to render
Definition: getargs.h:13
float auto_skylight
automatic ambient occlusion lighting
Definition: getargs.h:38
#define RT_AO_MAXDIST_UNLIMITED
unlimited AO distaned macro
Definition: tachyon.h:737
void rt_image_gamma(SceneHandle voidscene, float gamma)
Apply gamma correction to the pixel values after normalization.
Definition: api.c:449
char outfilename[FILENAME_MAX]
name of output image file
Definition: getargs.h:15
void rt_outputfile(SceneHandle voidscene, const char *outname)
Set the filename for the output image for the specified scene.
Definition: api.c:350
#define RT_FORMAT_TARGA
24-bit Targa file
Definition: tachyon.h:240
#define RT_NORMAL_FIXUP_FLIP
flip normals to agree with winding order
Definition: tachyon.h:303
float rescale_lights
direct lighting rescaling factor
Definition: getargs.h:37
void rt_normal_fixup_mode(SceneHandle voidscene, int mode)
Set the surface normal and polygon winding order fixup mode to use when generating triangles with int...
Definition: api.c:185
#define RT_FORMAT_SGIRGB
24-bit SGI RGB file
Definition: tachyon.h:242
void rt_phong_shader(SceneHandle voidscene, int mode)
Set the equation used for rendering specular highlights.
Definition: api.c:678
#define RT_FORMAT_WINBMP
24-bit Windows BMP file
Definition: tachyon.h:244
int postsceneoptions(argoptions *opt, SceneHandle scene)
Definition: getargs.c:189
void * SceneHandle
Definition: tachyon.h:51
void rt_image_normalize(SceneHandle voidscene)
Enable renormalization of pixel values to the range [0 1) (rather than clamping) prior to output...
Definition: api.c:443
int presceneoptions(argoptions *opt, SceneHandle scene)
Definition: getargs.c:180
float skylight_maxdist
AO max occlusion distance cutoff.
Definition: getargs.h:40
#define RT_SHADER_BLINN
Blinn&#39;s specular highlights, as in OpenGL.
Definition: tachyon.h:675
int cropyres
Definition: getargs.h:46
static int compare(const char *a, const char *b)
Definition: getargs.c:29
#define RT_SHADER_MEDIUM
Medium quality shading.
Definition: tachyon.h:658
int usecamfile
use camera file
Definition: getargs.h:22
void rt_image_clamp(SceneHandle voidscene)
Enable clamping of pixel values to the range [0 1) (rather than renormalizing) prior to output...
Definition: api.c:437
int outimageformat
format of output image
Definition: getargs.h:16
float b
Blue color component.
Definition: tachyon.h:62
float add_skylight
ambient occlusion lighting factor
Definition: getargs.h:39
#define RT_FORMAT_PPM48
48-bit NetPBM PPM file
Definition: tachyon.h:250
int aa_maxsamples
antialiasing setting
Definition: getargs.h:19
void rt_outputformat(SceneHandle voidscene, int format)
Set the format of the output image(s).
Definition: api.c:367
void rt_boundthresh(SceneHandle voidscene, int threshold)
Set the threshold to be used when automatic generation of ray tracing acceleration structures is to b...
Definition: api.c:630
int xsize
override default image x resolution
Definition: getargs.h:32
void rt_camera_raydepth(SceneHandle voidscene, int maxdepth)
Camera maximum ray recursion depth (i.e.
Definition: api.c:292
int spaceballon
spaceball input enabled
Definition: getargs.h:42
void rt_boundmode(SceneHandle voidscene, int mode)
Enables or disable automatic generation and use of ray tracing acceleration data structures.
Definition: api.c:624
#define RT_SHADER_PHONG
Phong specular highlights.
Definition: tachyon.h:676
#define RT_FORMAT_PNG
24-bit PNG file
Definition: tachyon.h:245
static int getparm(int argc, char **argv, int num, argoptions *opt, int node)
Definition: getargs.c:358
void rt_get_resolution(SceneHandle voidscene, int *hres, int *vres)
Get the horizontal and vertical resolution (in pixels) for the specified scene.
Definition: api.c:379
#define RT_NORMAL_FIXUP_OFF
surface normals and winding order agree
Definition: tachyon.h:302
int transmode
transparency rendering mode
Definition: getargs.h:26
int cropxstart
Definition: getargs.h:47
Tachyon public API function prototypes and declarations used to drive the ray tracing engine...
#define RT_FORMAT_PSD48
48-bit Photoshop PSD file
Definition: tachyon.h:251
#define RT_FOG_NORMAL
radial fog
Definition: tachyon.h:418
void rt_crop_output(SceneHandle voidscene, int hres, int vres, int sx, int sy)
Crop the output image to the specified size, intended only for use in SPECMPI benchmarking.
Definition: api.c:405
int getargs(int argc, char **argv, argoptions *opt, int node)
Definition: getargs.c:585
int phongfunc
shader for specular highlights
Definition: getargs.h:25
int cropystart
Definition: getargs.h:48
int useoutfilename
override output filename
Definition: getargs.h:14
void rt_verbose(SceneHandle voidscene, int v)
Enables or Disables verbose messages from the Tachyon library during rendering.
Definition: api.c:414
void rt_shadow_filtering(SceneHandle voidscene, int onoff)
Control whether or not transparent surfaces modulate incident light or not.
Definition: api.c:219