OPTOUT.C 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519
  1. /****************************************************************************
  2. * optout.c
  3. *
  4. * This module contains functions for credit, usage, options and stats.
  5. *
  6. * from Persistence of Vision(tm) Ray Tracer
  7. * Copyright 1996,1999 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. * NOTICE: This source code file is provided so that users may experiment
  10. * with enhancements to POV-Ray and to port the software to platforms other
  11. * than those supported by the POV-Ray Team. There are strict rules under
  12. * which you are permitted to use this file. The rules are in the file
  13. * named POVLEGAL.DOC which should be distributed with this file.
  14. * If POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. * Team Coordinator by email to team-coord@povray.org or visit us on the web at
  16. * http://www.povray.org. The latest version of POV-Ray may be found at this site.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23. #include <ctype.h>
  24. #include <time.h>
  25. #include "frame.h"
  26. #include "vector.h"
  27. #include "povproto.h"
  28. #include "atmosph.h"
  29. #include "bezier.h"
  30. #include "blob.h"
  31. #include "bbox.h"
  32. #include "cones.h"
  33. #include "csg.h"
  34. #include "discs.h"
  35. #include "fractal.h"
  36. #include "hfield.h"
  37. #include "lathe.h"
  38. #include "lighting.h"
  39. #include "mesh.h"
  40. #include "polysolv.h"
  41. #include "objects.h"
  42. #include "parse.h"
  43. #include "point.h"
  44. #include "poly.h"
  45. #include "polygon.h"
  46. #include "octree.h"
  47. #include "quadrics.h"
  48. #include "pgm.h"
  49. #include "ppm.h"
  50. #include "prism.h"
  51. #include "radiosit.h"
  52. #include "render.h"
  53. #include "sor.h"
  54. #include "spheres.h"
  55. #include "super.h"
  56. #include "targa.h"
  57. #include "texture.h"
  58. #include "torus.h"
  59. #include "triangle.h"
  60. #include "truetype.h"
  61. #include "userio.h"
  62. #include "lbuffer.h"
  63. #include "vbuffer.h"
  64. #include "povray.h"
  65. #include "optin.h"
  66. #include "optout.h"
  67. /*****************************************************************************
  68. * Local preprocessor defines
  69. ******************************************************************************/
  70. #define NUMBER_LENGTH 19
  71. #define OUTPUT_LENGTH 15
  72. #define NUMBER_OF_AUTHORS_ACROSS 4
  73. /*****************************************************************************
  74. * Local typedefs
  75. ******************************************************************************/
  76. /*****************************************************************************
  77. * Local variables
  78. ******************************************************************************/
  79. static char numbers[64][20] =
  80. {
  81. "0000000000000000001",
  82. "0000000000000000002",
  83. "0000000000000000004",
  84. "0000000000000000008",
  85. "0000000000000000016",
  86. "0000000000000000032",
  87. "0000000000000000064",
  88. "0000000000000000128",
  89. "0000000000000000256",
  90. "0000000000000000512",
  91. "0000000000000001024",
  92. "0000000000000002048",
  93. "0000000000000004096",
  94. "0000000000000008192",
  95. "0000000000000016384",
  96. "0000000000000032768",
  97. "0000000000000065536",
  98. "0000000000000131072",
  99. "0000000000000262144",
  100. "0000000000000524288",
  101. "0000000000001048576",
  102. "0000000000002097152",
  103. "0000000000004194304",
  104. "0000000000008388608",
  105. "0000000000016777216",
  106. "0000000000033554432",
  107. "0000000000067108864",
  108. "0000000000134217728",
  109. "0000000000268435456",
  110. "0000000000536870912",
  111. "0000000001073741824",
  112. "0000000002147483648",
  113. "0000000004294967296",
  114. "0000000008589934592",
  115. "0000000017179869184",
  116. "0000000034359738368",
  117. "0000000068719476736",
  118. "0000000137438953472",
  119. "0000000274877906944",
  120. "0000000549755813888",
  121. "0000001099511627776",
  122. "0000002199023255552",
  123. "0000004398046511104",
  124. "0000008796093022208",
  125. "0000017592186044416",
  126. "0000035184372088832",
  127. "0000070368744177664",
  128. "0000140737488355328",
  129. "0000281474976710656",
  130. "0000562949953421312",
  131. "0001125899906842624",
  132. "0002251799813685248",
  133. "0004503599627370496",
  134. "0009007199254740992",
  135. "0018014398509481984",
  136. "0036028797018963968",
  137. "0072057594037927936",
  138. "0144115188075855872",
  139. "0288230376151711744",
  140. "0576460752303423488",
  141. "1152921504606846976",
  142. "2305843009213693952",
  143. "4611686018427387904",
  144. "9223372036854775808"
  145. };
  146. static char s1[OUTPUT_LENGTH], s2[OUTPUT_LENGTH];
  147. char *Primary_Developers[] =
  148. {
  149. "Steve Anger",
  150. "Dieter Bayer",
  151. "Chris Cason",
  152. "Chris Dailey",
  153. "Andreas Dilger",
  154. "Steve Demlow",
  155. "Alexander Enzmann",
  156. "Dan Farmer",
  157. "Timothy Wegner",
  158. "Chris Young",
  159. NULL /* NULL flags the end of the list */
  160. };
  161. char *Contributing_Authors[] =
  162. {
  163. "Steve A. Bennett",
  164. "David K. Buck",
  165. "Aaron A. Collins",
  166. "Pascal Massimino",
  167. "Jim McElhiney",
  168. "Douglas Muir",
  169. "Bill Pulver",
  170. "Robert Skinner",
  171. "Zsolt Szalavari",
  172. "Scott Taylor",
  173. "Drew Wells",
  174. NULL /* NULL flags the end of the list */
  175. };
  176. /*****************************************************************************
  177. * Static functions
  178. ******************************************************************************/
  179. static void rinfo_on (char *string, unsigned value);
  180. static void add_numbers (char *result, char *c1, char *c2);
  181. static void counter_to_string (COUNTER *counter, char *string, int len);
  182. static void print_intersection_stats (char *text, COUNTER *tests, COUNTER *succeeded);
  183. /*****************************************************************************
  184. *
  185. * FUNCTION
  186. *
  187. * add_numbers
  188. *
  189. * INPUT
  190. *
  191. * OUTPUT
  192. *
  193. * RETURNS
  194. *
  195. * AUTHOR
  196. *
  197. * Dieter Bayer
  198. *
  199. * DESCRIPTION
  200. *
  201. * Add two decimal numbers stored in ASCII strings.
  202. *
  203. * CHANGES
  204. *
  205. * Mar 1995 : Creation
  206. *
  207. ******************************************************************************/
  208. static void add_numbers(char *result, char *c1, char *c2)
  209. {
  210. int i;
  211. char carry, x;
  212. carry = '0';
  213. for (i = NUMBER_LENGTH-1; i >= 0; i--)
  214. {
  215. x = c1[i] + c2[i] + carry - '0' - '0';
  216. if (x > '9')
  217. {
  218. carry = '1';
  219. result[i] = x - 10;
  220. }
  221. else
  222. {
  223. carry = '0';
  224. result[i] = x;
  225. }
  226. }
  227. }
  228. /*****************************************************************************
  229. *
  230. * FUNCTION
  231. *
  232. * counter_to_string
  233. *
  234. * INPUT
  235. *
  236. * OUTPUT
  237. *
  238. * RETURNS
  239. *
  240. * AUTHOR
  241. *
  242. * Dieter Bayer
  243. *
  244. * DESCRIPTION
  245. *
  246. * Convert a low/high precision counter into a decimal number.
  247. *
  248. * CHANGES
  249. *
  250. * Mar 1995 : Creation
  251. *
  252. ******************************************************************************/
  253. static void counter_to_string(COUNTER *counter, char *string, int len)
  254. {
  255. char n[NUMBER_LENGTH+1];
  256. int i, j;
  257. COUNTER c;
  258. c = *counter;
  259. for (i = 0; i < NUMBER_LENGTH; i++)
  260. {
  261. n[i] = '0';
  262. }
  263. n[NUMBER_LENGTH] = '\0';
  264. #if COUNTER_RESOLUTION == HIGH_RESOLUTION
  265. for (i = 0; i < 32; i++)
  266. {
  267. if (c.low & 1)
  268. {
  269. add_numbers(n, n, numbers[i]);
  270. }
  271. c.low >>= 1;
  272. }
  273. for (i = 32; i < 64; i++)
  274. {
  275. if (c.high & 1)
  276. {
  277. add_numbers(n, n, numbers[i]);
  278. }
  279. c.high >>= 1;
  280. }
  281. #else
  282. for (i = 0; i < 32; i++)
  283. {
  284. if (c & 1)
  285. {
  286. add_numbers(n, n, numbers[i]);
  287. }
  288. c >>= 1;
  289. }
  290. #endif
  291. /* Replace leading zeros. */
  292. for (i = 0; i < NUMBER_LENGTH-1; i++)
  293. {
  294. if (n[i] == '0')
  295. {
  296. n[i] = ' ';
  297. }
  298. else
  299. {
  300. break;
  301. }
  302. }
  303. /* Copy number into result string. */
  304. if (i >= NUMBER_LENGTH-len)
  305. {
  306. for (j = 0; j < i-NUMBER_LENGTH+len-1; j++)
  307. {
  308. string[j] = ' ';
  309. }
  310. string[j] = '\0';
  311. string = strcat(string, &n[i]);
  312. }
  313. else
  314. {
  315. /* Print numbers that don't fit into output string in million units. */
  316. string = "";
  317. n[NUMBER_LENGTH-6] = 'm';
  318. n[NUMBER_LENGTH-5] = '\0';
  319. string = strcat(string, &n[NUMBER_LENGTH-len+1-6]);
  320. }
  321. }
  322. /*****************************************************************************
  323. *
  324. * FUNCTION
  325. *
  326. * print_intersections_stats
  327. *
  328. * INPUT
  329. *
  330. * OUTPUT
  331. *
  332. * RETURNS
  333. *
  334. * AUTHOR
  335. *
  336. * Dieter Bayer
  337. *
  338. * DESCRIPTION
  339. *
  340. * -
  341. *
  342. * CHANGES
  343. *
  344. * Mar 1995 : Creation
  345. *
  346. ******************************************************************************/
  347. static void print_intersection_stats(char *text, COUNTER *tests, COUNTER *succeeded)
  348. {
  349. DBL t, s, p;
  350. if (!Test_Zero_Counter(*tests))
  351. {
  352. t = DBL_Counter(*tests);
  353. s = DBL_Counter(*succeeded);
  354. p = 100.0 * s / t;
  355. counter_to_string(tests, s1, OUTPUT_LENGTH);
  356. counter_to_string(succeeded, s2, OUTPUT_LENGTH);
  357. Statistics("%-22s %s %s %8.2f\n", text, s1, s2, p);
  358. }
  359. }
  360. /*****************************************************************************
  361. *
  362. * FUNCTION
  363. *
  364. * rinfo_on
  365. *
  366. * INPUT
  367. *
  368. * OUTPUT
  369. *
  370. * RETURNS
  371. *
  372. * AUTHOR
  373. *
  374. * POV-Ray Team
  375. *
  376. * DESCRIPTION
  377. *
  378. * -
  379. *
  380. * CHANGES
  381. *
  382. * -
  383. *
  384. ******************************************************************************/
  385. static void rinfo_on(char *string, unsigned value)
  386. {
  387. if (value)
  388. {
  389. Render_Info("%s.On",(string));
  390. }
  391. else
  392. {
  393. Render_Info("%sOff",(string));
  394. }
  395. }
  396. /*****************************************************************************
  397. *
  398. * FUNCTION
  399. *
  400. * Print_Credits
  401. *
  402. * INPUT
  403. *
  404. * OUTPUT
  405. *
  406. * RETURNS
  407. *
  408. * AUTHOR
  409. *
  410. * POV-Ray Team
  411. *
  412. * DESCRIPTION
  413. *
  414. * -
  415. *
  416. * CHANGES
  417. *
  418. * -
  419. *
  420. ******************************************************************************/
  421. void Print_Credits()
  422. {
  423. Banner ("Persistence of Vision(tm) Ray Tracer Version %s%s\n", POV_RAY_VERSION, COMPILER_VER);
  424. Banner (" %s\n", DISTRIBUTION_MESSAGE_1);
  425. Banner (" %s\n", DISTRIBUTION_MESSAGE_2);
  426. Banner (" %s\n", DISTRIBUTION_MESSAGE_3);
  427. Banner ("Copyright 1999 POV-Ray Team(tm)\n");
  428. }
  429. /*****************************************************************************
  430. *
  431. * FUNCTION
  432. *
  433. * Print_Help_Screens
  434. *
  435. * INPUT
  436. *
  437. * OUTPUT
  438. *
  439. * RETURNS
  440. *
  441. * AUTHOR
  442. *
  443. * Dieter Bayer
  444. *
  445. * DESCRIPTION
  446. *
  447. * Print all help screens. Use an interactive menu if GET_KEY exists.
  448. *
  449. * CHANGES
  450. *
  451. * Apr 1995 : Creation.
  452. *
  453. ******************************************************************************/
  454. void Print_Help_Screens()
  455. {
  456. #ifdef GET_KEY_EXISTS
  457. char c;
  458. int n, x, ok;
  459. Usage(-1, FALSE);
  460. for (n = 0; ; )
  461. {
  462. Banner("\n");
  463. Banner("[ Press 0 for general help, 1 to %d for help screen. Press 'q' to quit. ]", MAX_HELP_PAGE);
  464. do
  465. {
  466. ok = FALSE;
  467. GET_KEY(x);
  468. c = (char)x;
  469. if ((c >= '0') && (c <= '0' + MAX_HELP_PAGE))
  470. {
  471. ok = TRUE;
  472. n = (int)c - (int)'0';
  473. }
  474. else
  475. {
  476. if ((c == 'q') || (c == 'Q'))
  477. {
  478. ok = TRUE;
  479. }
  480. }
  481. }
  482. while(!ok);
  483. Banner("\n");
  484. if ((c == 'q') || (c == 'Q'))
  485. {
  486. break;
  487. }
  488. Usage(n, FALSE);
  489. }
  490. #else
  491. int n;
  492. for (n = -1; n <= MAX_HELP_PAGE; n++)
  493. {
  494. Usage(n, (n == MAX_HELP_PAGE));
  495. }
  496. #endif
  497. Terminate_POV(0);
  498. }
  499. /*****************************************************************************
  500. *
  501. * FUNCTION
  502. *
  503. * Usage
  504. *
  505. * INPUT
  506. *
  507. * n - Number of usage screen
  508. * f - Flag to terminate
  509. *
  510. * OUTPUT
  511. *
  512. * RETURNS
  513. *
  514. * AUTHOR
  515. *
  516. * POV-Ray Team
  517. *
  518. * DESCRIPTION
  519. *
  520. * Print out usage messages.
  521. *
  522. * CHANGES
  523. *
  524. * Dec 1994 : Changed to show options depending on parameter n. [DB]
  525. *
  526. * Feb 1995 : Changed to terminate only if f != 0. [DB]
  527. *
  528. ******************************************************************************/
  529. void Usage(int n, int f)
  530. {
  531. switch (n)
  532. {
  533. /* Help screen. */
  534. case 0:
  535. Banner("\n");
  536. Banner("Usage: POVRAY [+/-]Option1 [+/-]Option2 ... (-h or -? for help)\n");
  537. Banner("\n");
  538. Banner(" Example: POVRAY scene.ini +Iscene.pov +Oscene.tga +W320 +H200\n");
  539. Banner(" Example: POVRAY +Iscene.pov +Oscene.tga +W160 +H200 +V -D +X\n");
  540. Banner("\n");
  541. Banner("The help screen is divided into several parts. To access one part\n");
  542. Banner("just enter the number of the screen after the -h or -? option.\n");
  543. Banner("\n");
  544. Banner("E.g. use -h5 to see the help screen about the tracing options.\n");
  545. Banner("\n");
  546. Banner(" Number Part\n");
  547. Banner(" 1 Parsing Options\n");
  548. Banner(" 2 Output Options\n");
  549. Banner(" 3 Output Options - display related\n");
  550. Banner(" 4 Output Options - file related\n");
  551. Banner(" 5 Tracing Options\n");
  552. Banner(" 6 Animation Options\n");
  553. Banner(" 7 Redirecting Options\n");
  554. break;
  555. /* Parsing options. */
  556. case 1:
  557. Banner("\n");
  558. Banner("Parsing options\n");
  559. Banner("\n");
  560. Banner(" I<name> = input file name\n");
  561. Banner(" L<name> = library path prefix\n");
  562. Banner(" MVn.n = set compability to version n.n\n");
  563. Banner(" SU = split bounded unions if children are finite\n");
  564. Banner(" UR = remove unnecessary bounding objects\n");
  565. break;
  566. /* Output options. */
  567. case 2:
  568. Banner("\n");
  569. Banner("Output options\n");
  570. Banner("\n");
  571. Banner(" Hnnn = image height\n");
  572. Banner(" Wnnn = image width\n");
  573. Banner("\n");
  574. Banner(" SRnn = start at row nn | SR0.nn start row at nn percent of screen\n");
  575. Banner(" ERnn = end at row nn | ER0.nn end row at nn percent of screen\n");
  576. Banner(" SCnn = start at col nn | SC0.nn start col at nn percent of screen\n");
  577. Banner(" ECnn = end at col nn | EC0.nn end col at nn percent of screen\n");
  578. Banner("\n");
  579. Banner(" C = continue aborted trace\n");
  580. Banner(" P = pause before exit\n");
  581. Banner(" V = verbose messages on\n");
  582. Banner(" Xnnn = enable early exit by key hit (every nnn pixels)\n");
  583. break;
  584. case 3:
  585. Banner("\n");
  586. Banner("Output options - display related\n");
  587. Banner("\n");
  588. Banner(" Dxy = display in format x, using palette option y\n");
  589. Banner(" SPnnn = Mosaic Preview display, Start grid size = 2, 4, 8, 16, ...\n");
  590. Banner(" EPnnn = Mosaic Preview display, End grid size = 2, 4, 8, 16, ...\n");
  591. Banner(" UD = draw vista rectangles\n");
  592. break;
  593. /* Output options - file related. */
  594. case 4:
  595. Banner("\n");
  596. Banner("Output options - file related\n");
  597. Banner("\n");
  598. Banner(" Bnnn = Use nnn KB for output file buffer\n");
  599. Banner(" Fx = write output file in format x\n");
  600. Banner(" FC - Compressed Targa with 24 or 32 bpp\n");
  601. Banner(" FNn - PNG (n bits/color, n = 5 to 16, default is 8)\n");
  602. Banner(" FP - PPM\n");
  603. Banner(" FS - System specific\n");
  604. Banner(" FT - Uncompressed Targa with 24 or 32 bpp\n");
  605. Banner(" O<name> = output file name\n");
  606. #if PRECISION_TIMER_AVAILABLE
  607. Banner("\n");
  608. Banner(" HTx = write CPU utilization histogram in format x\n");
  609. Banner(" HTC - Comma separated values (CSV - spreadsheet)\n");
  610. Banner(" HTN - PNG grayscale\n");
  611. Banner(" HTP - PPM heightfield\n");
  612. Banner(" HTS - System specific\n");
  613. Banner(" HTT - Uncompressed TGA heightfield\n");
  614. Banner(" HTX - No histogram output\n");
  615. Banner(" HN<name>= histogram filename\n");
  616. Banner(" HSx.y = histogram grid number of x, y divisions\n");
  617. #endif
  618. break;
  619. /* Tracing options. */
  620. case 5:
  621. Banner("\n");
  622. Banner("Tracing options\n");
  623. Banner("\n");
  624. Banner(" MBnnn = use slabs if more than nnn objects\n");
  625. Banner(" Qn = image quality (0 = rough, 9 = full, R = radiosity)\n");
  626. Banner(" QR = enable radiosity calculations for ambient light\n");
  627. Banner("\n");
  628. Banner(" A0.n = perform antialiasing\n");
  629. Banner(" AMn = use non-adaptive (n=1) or adaptive (n=2) supersampling\n");
  630. Banner(" Jn.n = set antialiasing-jitter amount\n");
  631. Banner(" Rn = set antialiasing-depth (use n X n rays/pixel)\n");
  632. Banner("\n");
  633. Banner(" UL = use light buffer\n");
  634. Banner(" UV = use vista buffer\n");
  635. break;
  636. /* Animation options. */
  637. case 6:
  638. Banner("\n");
  639. Banner("Animation options\n");
  640. Banner("\n");
  641. Banner(" Kn.n = set frame clock to n.n\n");
  642. Banner(" KFInnn = Initial frame number\n");
  643. Banner(" KFFnnn = Final frame number\n");
  644. Banner(" KInnn.nn = Initial clock value\n");
  645. Banner(" KFnnn.nn = Final clock value\n");
  646. Banner(" SFnn = Start subset at frame nn\n");
  647. Banner(" SF0.nn = Start subset nn percent into sequence\n");
  648. Banner(" EFnn = End subset at frame nn\n");
  649. Banner(" EF0.n = End subset nn percent into sequence\n");
  650. Banner(" KC = Calculate clock value for cyclic animation\n");
  651. Banner("\n");
  652. Banner(" UF = use field rendering\n");
  653. Banner(" UO = use odd lines in odd frames\n");
  654. break;
  655. /* Redirecting options. */
  656. case 7:
  657. Banner("\n");
  658. Banner("Redirecting options\n");
  659. Banner("\n");
  660. Banner(" GI<name>= write all .INI parameters to file name\n");
  661. Banner(" Gx<name>= write stream x to console and/or file name\n");
  662. Banner(" GA - All streams (except status)\n");
  663. Banner(" GD - Debug stream\n");
  664. Banner(" GF - Fatal stream\n");
  665. Banner(" GR - Render stream\n");
  666. Banner(" GS - Statistics stream\n");
  667. Banner(" GW - Warning stream\n");
  668. break;
  669. /* Usage ... */
  670. default:
  671. Print_Authors();
  672. }
  673. #if defined(WAIT_FOR_KEYPRESS_EXISTS) && !defined(GET_KEY_EXISTS)
  674. Banner("\n");
  675. Banner("[ Paused for keypress... ]");
  676. WAIT_FOR_KEYPRESS;
  677. Banner("\n");
  678. #endif
  679. if (f)
  680. {
  681. Terminate_POV(0);
  682. }
  683. }
  684. void Print_Authors()
  685. {
  686. int h, i, j;
  687. Banner("\n");
  688. Banner("POV-Ray is based on DKBTrace 2.12 by David K. Buck & Aaron A. Collins.\n");
  689. Banner("\n");
  690. Banner("Primary POV-Ray 3 Developers: (Alphabetically)\n");
  691. for (i = h = 0; Primary_Developers[h] != NULL; i++)
  692. {
  693. for (j = 0; (j < NUMBER_OF_AUTHORS_ACROSS) && (Primary_Developers[h] != NULL); j++)
  694. {
  695. Banner(" %-18s", Primary_Developers[h++]);
  696. }
  697. Banner("\n");
  698. }
  699. Banner("\n");
  700. Banner("Major Contributing Authors: (Alphabetically)\n");
  701. for (i = h = 0; Contributing_Authors[h] != NULL; i++)
  702. {
  703. for (j = 0; (j < NUMBER_OF_AUTHORS_ACROSS) && (Contributing_Authors[h] != NULL); j++)
  704. {
  705. Banner(" %-18s", Contributing_Authors[h++]);
  706. }
  707. Banner("\n");
  708. }
  709. Banner("\n");
  710. Banner("Other contributors listed in the documentation.\n");
  711. }
  712. /*****************************************************************************
  713. *
  714. * FUNCTION
  715. *
  716. * Print_Options
  717. *
  718. * INPUT
  719. *
  720. * OUTPUT
  721. *
  722. * RETURNS
  723. *
  724. * AUTHOR
  725. *
  726. * POV-Ray Team
  727. *
  728. * DESCRIPTION
  729. *
  730. * -
  731. *
  732. * CHANGES
  733. *
  734. * -
  735. *
  736. ******************************************************************************/
  737. void Print_Options()
  738. {
  739. int i, j;
  740. /* Print parsing options. */
  741. Render_Info("Parsing Options\n");
  742. Render_Info(" Input file: %s", opts.Input_File_Name);
  743. Render_Info(" (compatible to version %.1f)\n", opts.Language_Version);
  744. rinfo_on (" Remove bounds.......", (opts.Options & REMOVE_BOUNDS));
  745. rinfo_on (" Split unions........", (opts.Options & SPLIT_UNION));
  746. Render_Info("\n");
  747. j = 17;
  748. Render_Info(" Library paths:");
  749. for (i = 0; i < opts.Library_Path_Index; i++)
  750. {
  751. j += strlen(opts.Library_Paths[i])+2;
  752. if (j > 77)
  753. {
  754. Render_Info("\n ", j);
  755. j = strlen(opts.Library_Paths[i]) + 5;
  756. }
  757. Render_Info(" %s", opts.Library_Paths[i]);
  758. }
  759. Render_Info("\n");
  760. /* Print output options. */
  761. Render_Info("Output Options\n");
  762. Render_Info(" Image resolution %d by %d",
  763. Frame.Screen_Width, Frame.Screen_Height);
  764. Render_Info(" (rows %d to %d, columns %d to %d).\n",
  765. opts.First_Line+1, opts.Last_Line,
  766. opts.First_Column+1, opts.Last_Column);
  767. if (opts.Options & DISKWRITE)
  768. {
  769. Render_Info(" Output file: %s%s, ", opts.Output_Path, opts.Output_File_Name);
  770. if (toupper(opts.OutputFormat) == 'N' && opts.Options & HF_GRAY_16)
  771. {
  772. Render_Info("%d bpp ", opts.OutputQuality);
  773. }
  774. else
  775. {
  776. Render_Info("%d bpp ", ((opts.Options & OUTPUT_ALPHA) ? 4 : 3) * opts.OutputQuality);
  777. }
  778. switch (toupper(opts.OutputFormat))
  779. {
  780. case 'C': Render_Info("RLE Targa"); break;
  781. case 'N': Render_Info("PNG"); break;
  782. case 'P': Render_Info("PPM"); break;
  783. case 'S': Render_Info("(system format)"); break;
  784. case 'T': Render_Info("Targa"); break;
  785. }
  786. if (opts.Options & HF_GRAY_16)
  787. {
  788. if (toupper(opts.OutputFormat) == 'N')
  789. {
  790. Render_Info(" grayscale");
  791. }
  792. else if (opts.Options & HF_GRAY_16)
  793. {
  794. Render_Info(" POV heightfield");
  795. }
  796. }
  797. if (opts.Options & OUTPUT_ALPHA)
  798. {
  799. Render_Info(" with alpha");
  800. }
  801. if ((opts.Options & BUFFERED_OUTPUT) && (opts.File_Buffer_Size != 0))
  802. {
  803. Render_Info(", %d KByte buffer\n", opts.File_Buffer_Size/1024);
  804. }
  805. else
  806. {
  807. Render_Info("\n");
  808. }
  809. }
  810. else if (opts.Options & DISPLAY)
  811. {
  812. if (opts.histogram_on == TRUE)
  813. {
  814. Warning(0.0, " Rendering to screen and histogram file only.\n");
  815. }
  816. else
  817. {
  818. Warning(0.0, " Rendering to screen only. No file output.\n");
  819. }
  820. }
  821. else if (opts.histogram_on == TRUE)
  822. {
  823. Warning(0.0, " Rendering to histogram file only.\n");
  824. }
  825. else
  826. {
  827. Warning(0.0, " Rendering to nothing! No screen or file output.\n");
  828. }
  829. rinfo_on (" Graphic display.....", (opts.Options & DISPLAY));
  830. if (opts.Options & DISPLAY)
  831. {
  832. Render_Info(" (type: %c, palette: %c, gamma: %4.2g)",
  833. toupper(opts.DisplayFormat), toupper(opts.PaletteOption),
  834. opts.DisplayGamma);
  835. }
  836. Render_Info("\n");
  837. rinfo_on (" Mosaic preview......", (opts.Options & PREVIEW));
  838. if (opts.Options & PREVIEW)
  839. {
  840. Render_Info(" (pixel sizes %d to %d)",
  841. opts.PreviewGridSize_Start, opts.PreviewGridSize_End);
  842. }
  843. Render_Info("\n");
  844. #if PRECISION_TIMER_AVAILABLE
  845. rinfo_on (" CPU usage histogram.", opts.histogram_on);
  846. if (opts.histogram_on)
  847. {
  848. char *type;
  849. switch (opts.histogram_type)
  850. {
  851. case CSV: type = "CSV"; break;
  852. case TARGA: type = "TGA"; break;
  853. case PNG: type = "PNG"; break;
  854. case PPM: type = "PPM"; break;
  855. case SYS: type = "(system format)"; break;
  856. case NONE: /* Just to stop warning messages */
  857. default: type = "None"; break;
  858. }
  859. Render_Info(" (name: %s type: %s, grid: %dx%d)",
  860. opts.Histogram_File_Name,type,opts.histogram_x,opts.histogram_y);
  861. }
  862. Render_Info("\n");
  863. #endif /* PRECISION_TIMER_AVAILABLE */
  864. rinfo_on (" Continued trace.....", (opts.Options & CONTINUE_TRACE));
  865. rinfo_on (" Allow interruption..", (opts.Options & EXITENABLE));
  866. rinfo_on (" Pause when done.....", (opts.Options & PROMPTEXIT));
  867. Render_Info("\n");
  868. rinfo_on (" Verbose messages....", (opts.Options & VERBOSE));
  869. Render_Info("\n");
  870. /* Print tracing options. */
  871. Render_Info("Tracing Options\n");
  872. Render_Info(" Quality: %2d\n", opts.Quality);
  873. rinfo_on (" Bounding boxes......", opts.Use_Slabs);
  874. if (opts.Use_Slabs)
  875. {
  876. Render_Info(" Bounding threshold: %d ", opts.BBox_Threshold);
  877. }
  878. Render_Info("\n");
  879. rinfo_on(" Light Buffer........", (opts.Options & USE_LIGHT_BUFFER));
  880. rinfo_on(" Vista Buffer........", (opts.Options & USE_VISTA_BUFFER));
  881. if (opts.Options & USE_VISTA_BUFFER && opts.Options & DISPLAY)
  882. {
  883. rinfo_on(" Draw Vista Buffer...", (opts.Options & USE_VISTA_DRAW));
  884. }
  885. Render_Info("\n");
  886. rinfo_on (" Antialiasing........", (opts.Options & ANTIALIAS));
  887. if (opts.Options & ANTIALIAS)
  888. {
  889. Render_Info(" (Method %d, ", opts.Tracing_Method);
  890. Render_Info("Threshold %.3f, ", opts.Antialias_Threshold);
  891. Render_Info("Depth %ld, ", opts.AntialiasDepth);
  892. Render_Info("Jitter %.2f)", opts.JitterScale);
  893. }
  894. Render_Info("\n");
  895. rinfo_on (" Radiosity...........", (opts.Options & RADIOSITY));
  896. Render_Info("\n");
  897. /* Print animation options. */
  898. Render_Info("Animation Options\n");
  899. if (opts.FrameSeq.FrameType == FT_MULTIPLE_FRAME)
  900. {
  901. Render_Info(" Initial Frame..%8d", opts.FrameSeq.InitialFrame);
  902. Render_Info(" Final Frame....%8d\n", opts.FrameSeq.FinalFrame);
  903. Render_Info(" Initial Clock..%8.3f", opts.FrameSeq.InitialClock);
  904. Render_Info(" Final Clock....%8.3f\n", opts.FrameSeq.FinalClock);
  905. rinfo_on (" Cyclic Animation....", (opts.Options & CYCLIC_ANIMATION));
  906. rinfo_on (" Field render........", (opts.FrameSeq.Field_Render_Flag));
  907. rinfo_on (" Odd lines/frames....", (opts.FrameSeq.Odd_Field_Flag));
  908. }
  909. else
  910. {
  911. Render_Info(" Clock value....%8.3f", opts.FrameSeq.Clock_Value);
  912. Render_Info(" (Animation off)");
  913. }
  914. Render_Info("\n");
  915. /* Print redirecting options. */
  916. Render_Info("Redirecting Options\n");
  917. rinfo_on (" All Streams to console.........", Stream_Info[ALL_STREAM].do_console);
  918. if (Stream_Info[ALL_STREAM].name == NULL)
  919. {
  920. Render_Info("\n");
  921. }
  922. else
  923. {
  924. Render_Info(" and file %s\n", Stream_Info[ALL_STREAM].name);
  925. }
  926. rinfo_on (" Debug Stream to console........", Stream_Info[DEBUG_STREAM].do_console);
  927. if (Stream_Info[DEBUG_STREAM].name == NULL)
  928. {
  929. Render_Info("\n");
  930. }
  931. else
  932. {
  933. Render_Info(" and file %s\n", Stream_Info[DEBUG_STREAM].name);
  934. }
  935. rinfo_on (" Fatal Stream to console........", Stream_Info[FATAL_STREAM].do_console);
  936. if (Stream_Info[FATAL_STREAM].name == NULL)
  937. {
  938. Render_Info("\n");
  939. }
  940. else
  941. {
  942. Render_Info(" and file %s\n", Stream_Info[FATAL_STREAM].name);
  943. }
  944. rinfo_on (" Render Stream to console.......", Stream_Info[RENDER_STREAM].do_console);
  945. if (Stream_Info[RENDER_STREAM].name == NULL)
  946. {
  947. Render_Info("\n");
  948. }
  949. else
  950. {
  951. Render_Info(" and file %s\n", Stream_Info[RENDER_STREAM].name);
  952. }
  953. rinfo_on (" Statistics Stream to console...", Stream_Info[STATISTIC_STREAM].do_console);
  954. if (Stream_Info[STATISTIC_STREAM].name == NULL)
  955. {
  956. Render_Info("\n");
  957. }
  958. else
  959. {
  960. Render_Info(" and file %s\n", Stream_Info[STATISTIC_STREAM].name);
  961. }
  962. rinfo_on (" Warning Stream to console......", Stream_Info[WARNING_STREAM].do_console);
  963. if (Stream_Info[WARNING_STREAM].name == NULL)
  964. {
  965. Render_Info("\n");
  966. }
  967. else
  968. {
  969. Render_Info(" and file %s\n", Stream_Info[WARNING_STREAM].name);
  970. }
  971. }
  972. /*****************************************************************************
  973. *
  974. * FUNCTION
  975. *
  976. * Print_Stats
  977. *
  978. * INPUT
  979. *
  980. * OUTPUT
  981. *
  982. * RETURNS
  983. *
  984. * AUTHOR
  985. *
  986. * POV-Ray Team
  987. *
  988. * DESCRIPTION
  989. *
  990. * -
  991. *
  992. * CHANGES
  993. *
  994. * -
  995. *
  996. ******************************************************************************/
  997. void Print_Stats(COUNTER *pstats)
  998. {
  999. unsigned long hours, minutes;
  1000. DBL seconds, taverage, ttotal;
  1001. long Pixels_In_Image;
  1002. Pixels_In_Image = (long)Frame.Screen_Width * (long)Frame.Screen_Height;
  1003. Statistics ("\n%s Statistics", opts.Input_File_Name);
  1004. if ( Pixels_In_Image > DBL_Counter(pstats[Number_Of_Pixels]) )
  1005. Statistics (" (Partial Image Rendered)");
  1006. Statistics (", Resolution %d x %d\n", Frame.Screen_Width, Frame.Screen_Height);
  1007. Statistics ("----------------------------------------------------------------------------\n");
  1008. Statistics ("Pixels: %15.0f Samples: %15.0f Smpls/Pxl: ",
  1009. DBL_Counter(pstats[Number_Of_Pixels]),
  1010. DBL_Counter(pstats[Number_Of_Samples]));
  1011. if (!Test_Zero_Counter(pstats[Number_Of_Pixels]))
  1012. {
  1013. Statistics ("%.2f\n",
  1014. DBL_Counter(pstats[Number_Of_Samples]) /
  1015. DBL_Counter(pstats[Number_Of_Pixels]));
  1016. }
  1017. else
  1018. {
  1019. Statistics ("-\n");
  1020. }
  1021. counter_to_string(&pstats[Number_Of_Rays], s1, OUTPUT_LENGTH);
  1022. counter_to_string(&pstats[ADC_Saves], s2, OUTPUT_LENGTH);
  1023. Statistics ("Rays: %s Saved: %s Max Level: %d/%d\n",
  1024. s1, s2, Highest_Trace_Level, Max_Trace_Level);
  1025. Statistics ("----------------------------------------------------------------------------\n");
  1026. Statistics ("Ray->Shape Intersection Tests Succeeded Percentage\n");
  1027. Statistics ("----------------------------------------------------------------------------\n");
  1028. print_intersection_stats("Bezier Patch", &pstats[Ray_Bicubic_Tests],
  1029. &pstats[Ray_Bicubic_Tests_Succeeded]);
  1030. print_intersection_stats("Blob", &pstats[Ray_Blob_Tests],
  1031. &pstats[Ray_Blob_Tests_Succeeded]);
  1032. #ifdef BLOB_EXTRA_STATS
  1033. print_intersection_stats("Blob Component", &pstats[Blob_Element_Tests],
  1034. &pstats[Blob_Element_Tests_Succeeded]);
  1035. print_intersection_stats("Blob Bound", &pstats[Blob_Bound_Tests],
  1036. &pstats[Blob_Bound_Tests_Succeeded]);
  1037. #endif
  1038. print_intersection_stats("Box", &pstats[Ray_Box_Tests],
  1039. &pstats[Ray_Box_Tests_Succeeded]);
  1040. print_intersection_stats("Cone/Cylinder", &pstats[Ray_Cone_Tests],
  1041. &pstats[Ray_Cone_Tests_Succeeded]);
  1042. print_intersection_stats("CSG Intersection", &pstats[Ray_CSG_Intersection_Tests],
  1043. &pstats[Ray_CSG_Intersection_Tests_Succeeded]);
  1044. print_intersection_stats("CSG Merge", &pstats[Ray_CSG_Merge_Tests],
  1045. &pstats[Ray_CSG_Merge_Tests_Succeeded]);
  1046. print_intersection_stats("CSG Union", &pstats[Ray_CSG_Union_Tests],
  1047. &pstats[Ray_CSG_Union_Tests_Succeeded]);
  1048. print_intersection_stats("Disc", &pstats[Ray_Disc_Tests],
  1049. &pstats[Ray_Disc_Tests_Succeeded]);
  1050. print_intersection_stats("Fractal", &pstats[Ray_Fractal_Tests],
  1051. &pstats[Ray_Fractal_Tests_Succeeded]);
  1052. print_intersection_stats("Height Field", &pstats[Ray_HField_Tests],
  1053. &pstats[Ray_HField_Tests_Succeeded]);
  1054. #ifdef HFIELD_EXTRA_STATS
  1055. print_intersection_stats("Height Field Box", &pstats[Ray_HField_Box_Tests],
  1056. &pstats[Ray_HField_Box_Tests_Succeeded]);
  1057. print_intersection_stats("Height Field Triangle", &pstats[Ray_HField_Triangle_Tests],
  1058. &pstats[Ray_HField_Triangle_Tests_Succeeded]);
  1059. print_intersection_stats("Height Field Block", &pstats[Ray_HField_Block_Tests],
  1060. &pstats[Ray_HField_Block_Tests_Succeeded]);
  1061. print_intersection_stats("Height Field Cell", &pstats[Ray_HField_Cell_Tests],
  1062. &pstats[Ray_HField_Cell_Tests_Succeeded]);
  1063. #endif
  1064. print_intersection_stats("Lathe", &pstats[Ray_Lathe_Tests],
  1065. &pstats[Ray_Lathe_Tests_Succeeded]);
  1066. #ifdef LATHE_EXTRA_STATS
  1067. print_intersection_stats("Lathe Bound", &pstats[Lathe_Bound_Tests],
  1068. &pstats[Lathe_Bound_Tests_Succeeded]);
  1069. #endif
  1070. print_intersection_stats("Mesh", &pstats[Ray_Mesh_Tests],
  1071. &pstats[Ray_Mesh_Tests_Succeeded]);
  1072. print_intersection_stats("Plane", &pstats[Ray_Plane_Tests],
  1073. &pstats[Ray_Plane_Tests_Succeeded]);
  1074. print_intersection_stats("Polygon", &pstats[Ray_Polygon_Tests],
  1075. &pstats[Ray_Polygon_Tests_Succeeded]);
  1076. print_intersection_stats("Prism", &pstats[Ray_Prism_Tests],
  1077. &pstats[Ray_Prism_Tests_Succeeded]);
  1078. #ifdef PRISM_EXTRA_STATS
  1079. print_intersection_stats("Prism Bound", &pstats[Prism_Bound_Tests],
  1080. &pstats[Prism_Bound_Tests_Succeeded]);
  1081. #endif
  1082. print_intersection_stats("Quadric", &pstats[Ray_Quadric_Tests],
  1083. &pstats[Ray_Quadric_Tests_Succeeded]);
  1084. print_intersection_stats("Quartic/Poly", &pstats[Ray_Poly_Tests],
  1085. &pstats[Ray_Poly_Tests_Succeeded]);
  1086. print_intersection_stats("Sphere", &pstats[Ray_Sphere_Tests],
  1087. &pstats[Ray_Sphere_Tests_Succeeded]);
  1088. print_intersection_stats("Superellipsoid", &pstats[Ray_Superellipsoid_Tests],
  1089. &pstats[Ray_Superellipsoid_Tests_Succeeded]);
  1090. print_intersection_stats("Surface of Revolution", &pstats[Ray_Sor_Tests],
  1091. &pstats[Ray_Sor_Tests_Succeeded]);
  1092. #ifdef SOR_EXTRA_STATS
  1093. print_intersection_stats("Surface of Rev. Bound", &pstats[Sor_Bound_Tests],
  1094. &pstats[Sor_Bound_Tests_Succeeded]);
  1095. #endif
  1096. print_intersection_stats("Torus", &pstats[Ray_Torus_Tests],
  1097. &pstats[Ray_Torus_Tests_Succeeded]);
  1098. #ifdef TORUS_EXTRA_STATS
  1099. print_intersection_stats("Torus Bound", &pstats[Torus_Bound_Tests],
  1100. &pstats[Torus_Bound_Tests_Succeeded]);
  1101. #endif
  1102. print_intersection_stats("Triangle", &pstats[Ray_Triangle_Tests],
  1103. &pstats[Ray_Triangle_Tests_Succeeded]);
  1104. print_intersection_stats("True Type Font", &pstats[Ray_TTF_Tests],
  1105. &pstats[Ray_TTF_Tests_Succeeded]);
  1106. print_intersection_stats("Bounding Object", &pstats[Bounding_Region_Tests],
  1107. &pstats[Bounding_Region_Tests_Succeeded]);
  1108. print_intersection_stats("Clipping Object", &pstats[Clipping_Region_Tests],
  1109. &pstats[Clipping_Region_Tests_Succeeded]);
  1110. print_intersection_stats("Bounding Box", &pstats[nChecked],
  1111. &pstats[nEnqueued]);
  1112. print_intersection_stats("Light Buffer", &pstats[LBuffer_Tests],
  1113. &pstats[LBuffer_Tests_Succeeded]);
  1114. print_intersection_stats("Vista Buffer", &pstats[VBuffer_Tests],
  1115. &pstats[VBuffer_Tests_Succeeded]);
  1116. Statistics ("----------------------------------------------------------------------------\n");
  1117. if (!Test_Zero_Counter(pstats[Polynomials_Tested]))
  1118. {
  1119. counter_to_string(&pstats[Polynomials_Tested], s1, OUTPUT_LENGTH);
  1120. counter_to_string(&pstats[Roots_Eliminated], s2, OUTPUT_LENGTH);
  1121. Statistics ("Roots tested: %s eliminated: %s\n", s1, s2);
  1122. }
  1123. counter_to_string(&pstats[Calls_To_Noise], s1, OUTPUT_LENGTH);
  1124. counter_to_string(&pstats[Calls_To_DNoise], s2, OUTPUT_LENGTH);
  1125. Statistics ("Calls to Noise: %s Calls to DNoise: %s\n", s1, s2);
  1126. Statistics ("----------------------------------------------------------------------------\n");
  1127. /* Print media samples. */
  1128. if (!Test_Zero_Counter(pstats[Media_Intervals]))
  1129. {
  1130. counter_to_string(&pstats[Media_Intervals], s1, OUTPUT_LENGTH);
  1131. counter_to_string(&pstats[Media_Samples], s2, OUTPUT_LENGTH);
  1132. Statistics ("Media Intervals: %s Media Samples: %s (%4.2f)\n", s1, s2,
  1133. DBL_Counter(pstats[Media_Samples]) / DBL_Counter(pstats[Media_Intervals]));
  1134. }
  1135. if (!Test_Zero_Counter(pstats[Shadow_Ray_Tests]))
  1136. {
  1137. counter_to_string(&pstats[Shadow_Ray_Tests], s1, OUTPUT_LENGTH);
  1138. counter_to_string(&pstats[Shadow_Rays_Succeeded], s2, OUTPUT_LENGTH);
  1139. Statistics ("Shadow Ray Tests: %s Succeeded: %s\n", s1, s2);
  1140. }
  1141. if (!Test_Zero_Counter(pstats[Reflected_Rays_Traced]))
  1142. {
  1143. counter_to_string(&pstats[Reflected_Rays_Traced], s1, OUTPUT_LENGTH);
  1144. Statistics ("Reflected Rays: %s", s1);
  1145. if (!Test_Zero_Counter(pstats[Internal_Reflected_Rays_Traced]))
  1146. {
  1147. counter_to_string(&pstats[Internal_Reflected_Rays_Traced], s1, OUTPUT_LENGTH);
  1148. Statistics (" Total Internal: %s", s1);
  1149. }
  1150. Statistics ("\n");
  1151. }
  1152. if (!Test_Zero_Counter(pstats[Refracted_Rays_Traced]))
  1153. {
  1154. counter_to_string(&pstats[Refracted_Rays_Traced], s1, OUTPUT_LENGTH);
  1155. Statistics ("Refracted Rays: %s\n", s1);
  1156. }
  1157. if (!Test_Zero_Counter(pstats[Transmitted_Rays_Traced]))
  1158. {
  1159. counter_to_string(&pstats[Transmitted_Rays_Traced], s1, OUTPUT_LENGTH);
  1160. Statistics ("Transmitted Rays: %s\n", s1);
  1161. }
  1162. if (!Test_Zero_Counter(pstats[Istack_overflows]))
  1163. {
  1164. counter_to_string(&pstats[Istack_overflows], s1, OUTPUT_LENGTH);
  1165. Statistics ("I-Stack overflows: %s\n", s1);
  1166. }
  1167. if ( ra_reuse_count || ra_gather_count )
  1168. {
  1169. Statistics ("----------------------------------------------------------------------------\n");
  1170. Statistics ("Radiosity samples calculated: %9ld (%.2f percent)\n", ra_gather_count,
  1171. 100.*(DBL) ra_gather_count / ((DBL)(ra_gather_count + ra_reuse_count)));
  1172. /* Note: don't try to put in a percent sign. There is basically no way to do this
  1173. which is completely portable using va_start */
  1174. Statistics ("Radiosity samples reused: %9ld\n", ra_reuse_count);
  1175. }
  1176. #if defined(MEM_STATS)
  1177. Statistics ("----------------------------------------------------------------------------\n");
  1178. Long_To_Counter(mem_stats_smallest_alloc(), pstats[MemStat_Smallest_Alloc]);
  1179. counter_to_string(&pstats[MemStat_Smallest_Alloc], s1, OUTPUT_LENGTH);
  1180. Long_To_Counter(mem_stats_largest_alloc(), pstats[MemStat_Largest_Alloc]);
  1181. counter_to_string(&pstats[MemStat_Largest_Alloc], s2, OUTPUT_LENGTH);
  1182. #if (MEM_STATS==1)
  1183. Statistics ("Smallest Alloc: %s bytes Largest: %s\n", s1, s2);
  1184. #elif (MEM_STATS>=2)
  1185. Statistics ("Smallest Alloc: %s bytes @ %s:%d\n", s1, mem_stats_smallest_file(), mem_stats_smallest_line());
  1186. Statistics ("Largest Alloc: %s bytes @ %s:%d\n", s2, mem_stats_largest_file(), mem_stats_largest_line());
  1187. Long_To_Counter(mem_stats_total_allocs(), pstats[MemStat_Total_Allocs]);
  1188. counter_to_string(&pstats[MemStat_Total_Allocs], s1, OUTPUT_LENGTH);
  1189. Long_To_Counter(mem_stats_total_frees(), pstats[MemStat_Total_Frees]);
  1190. counter_to_string(&pstats[MemStat_Total_Frees], s2, OUTPUT_LENGTH);
  1191. Statistics ("Total Alloc calls: %s Free calls:%s\n", s1, s2);
  1192. #endif
  1193. Long_To_Counter(mem_stats_largest_mem_usage(), pstats[MemStat_Largest_Mem_Usage]);
  1194. counter_to_string(&pstats[MemStat_Largest_Mem_Usage], s1, OUTPUT_LENGTH);
  1195. Statistics ("Peak memory used: %s bytes\n", s1);
  1196. #endif
  1197. Statistics ("----------------------------------------------------------------------------\n");
  1198. /* Get time in case the trace was aborted. */
  1199. if (trender == 0.0)
  1200. {
  1201. STOP_TIME
  1202. trender = TIME_ELAPSED
  1203. }
  1204. if (opts.FrameSeq.FrameType == FT_MULTIPLE_FRAME)
  1205. {
  1206. if (tparse_total != 0.0)
  1207. {
  1208. taverage = tparse_total /
  1209. (DBL)(opts.FrameSeq.FrameNumber - opts.FrameSeq.InitialFrame + 1);
  1210. SPLIT_TIME(taverage,&hours,&minutes,&seconds);
  1211. Statistics ("Time For Parse/Frame: %3ld hours %2ld minutes %5.1f seconds (%ld seconds)\n",
  1212. hours, minutes, seconds, (long)taverage);
  1213. SPLIT_TIME(tparse_total,&hours,&minutes,&seconds);
  1214. Statistics ("Time For Parse Total: %3ld hours %2ld minutes %5.1f seconds (%ld seconds)\n",
  1215. hours, minutes, seconds, (long)tparse_total);
  1216. }
  1217. if (trender_total != 0.0)
  1218. {
  1219. taverage = trender_total /
  1220. (DBL)(opts.FrameSeq.FrameNumber - opts.FrameSeq.InitialFrame + 1);
  1221. SPLIT_TIME(taverage,&hours,&minutes,&seconds);
  1222. Statistics ("Time For Trace/Frame: %3ld hours %2ld minutes %5.1f seconds (%ld seconds)\n",
  1223. hours, minutes, seconds, (long)taverage);
  1224. SPLIT_TIME(trender_total,&hours,&minutes,&seconds);
  1225. Statistics ("Time For Trace Total: %3ld hours %2ld minutes %5.1f seconds (%ld seconds)\n",
  1226. hours, minutes, seconds, (long)trender_total);
  1227. }
  1228. ttotal = tparse_total + trender_total;
  1229. if (ttotal != 0.0)
  1230. {
  1231. SPLIT_TIME(ttotal,&hours,&minutes,&seconds);
  1232. Statistics (" Total Time: %3ld hours %2ld minutes %5.1f seconds (%ld seconds)\n",
  1233. hours, minutes, seconds, (long)ttotal);
  1234. }
  1235. }
  1236. else
  1237. {
  1238. if (tparse != 0.0)
  1239. {
  1240. SPLIT_TIME(tparse,&hours,&minutes,&seconds);
  1241. Statistics ("Time For Parse: %3ld hours %2ld minutes %5.1f seconds (%ld seconds)\n",
  1242. hours, minutes, seconds, (long)tparse);
  1243. }
  1244. if (trender != 0.0)
  1245. {
  1246. SPLIT_TIME(trender,&hours,&minutes,&seconds);
  1247. Statistics ("Time For Trace: %3ld hours %2ld minutes %5.1f seconds (%ld seconds)\n",
  1248. hours, minutes, seconds, (long)trender);
  1249. }
  1250. ttotal = tparse + trender;
  1251. if (ttotal != 0.0)
  1252. {
  1253. SPLIT_TIME(ttotal,&hours,&minutes,&seconds);
  1254. Statistics (" Total Time: %3ld hours %2ld minutes %5.1f seconds (%ld seconds)\n",
  1255. hours, minutes, seconds, (long)ttotal);
  1256. }
  1257. }
  1258. }