home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / raytrace / pov_10 / docs / povlang < prev    next >
Encoding:
Text File  |  1992-07-26  |  8.6 KB  |  305 lines

  1. Persistence of Vision Raytracer
  2. Version 1.0 
  3. Quick Reference
  4. -------------------------------
  5. By Chris Young
  6.  
  7. This is a formal grammar definition of the POV-Ray scene description 
  8. language.  It is based on PARSE.C and TOKENIZE.C from version 1.0 of 
  9. POV-Ray.  See POVRAY.DOC for in-depth description of the program and 
  10. language
  11.  
  12. The POV-Ray language is used to describe something called a FRAME.  
  13. Everything needed to render that image is stored in a text file 
  14. describing that FRAME.
  15.  
  16. Also note,
  17.  
  18.    #include "filename.inc"
  19.  
  20.    can appear anywhere in the text to include text from another file. 
  21. The parser will behave as if all the text from filename.inc were 
  22. inserted at that point in the file.
  23.  
  24. Note that the use of "#" is currently optional, but recommended for 
  25. readability when using include and declare for readability. This will 
  26. be mandatory in future versions.
  27.  
  28. Any text following "//" to the end of the line is ignored as comments. 
  29. Furthermore text between "/*" and "*/" is considered a comment. /* */ 
  30. comments can be nested.
  31.  
  32. In the notation used below in general a single character in quotes is 
  33. that literal character.  All lower case words are also literal and they 
  34. are reserved keywords.  Upper case words denote language constructs.
  35.  
  36. An ellipsis denotes one or more.  Square brackets denote optional. A 
  37. bar | denotes a choice of item or items. A scroll bracket is a literal 
  38. "{" or "}" but the quotes have been omitted for clarity.
  39.  
  40. For example:
  41.       ITEM              one occurrence of ITEM
  42.       ITEM...           one or more occurrences of ITEM
  43.       [ITEM]            zero or one occurrence of ITEM
  44.       [ITEM...]         zero or more occurrences of ITEM
  45.       ITEM_1 | ITEM_2   one occurrence of either ITEM_1 or ITEM_2 
  46.  
  47. NOTE: STRING is defined as a string of characters in quotes
  48.       IDENTIFIER is an alphabetic character followed by one or more 
  49.                   alphanumerics or underscores
  50.       ITEM_IDENTIFIER is an IDENTIFIER of type ITEM
  51.  
  52. Leave questions/comments to Chris Young CIS:[76702,1655]
  53. --------------------------------------------------------------
  54.  
  55. DIGIT = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
  56.  
  57. POINT = "."
  58.  
  59. EXP   = "e" | "E"
  60.  
  61. SIGN  = "+" | "-"
  62.  
  63. FLOAT_CONST = [DIGIT...] [POINT] DIGIT... [EXP [SIGN] DIGIT...]
  64.  
  65. FLOAT = [SIGN] FLOAT_CONST | [SIGN] FLOAT_IDENTIFIER
  66.  
  67. COLOR_ITEM  = red FLOAT   | green FLOAT | blue FLOAT |
  68.               alpha FLOAT | COLOR_IDENTIFIER
  69.  
  70. COLOR_SPEC  = color [COLOR_ITEM...] 
  71.  
  72. Note:"color" and "colour" can be used interchangeably everywhere.
  73.  
  74. COLOR_MAP_ENTRY   = "[" FLOAT FLOAT COLOR_SPEC COLOR_SPEC "]"
  75.  
  76. COLOR_MAP   = color_map { [COLOR_MAP_ENTRY...] }
  77.  
  78. VECTOR      = "<" FLOAT FLOAT FLOAT ">"
  79.  
  80. MAP_PREFIX  = FLOAT | VECTOR
  81.  
  82. MAP_FILE    = iff STRING | 
  83.               tga STRING |
  84.               gif STRING |
  85.               dump STRING
  86.  
  87. IMAGE_ATTRIB= once |
  88.               interpolate FLOAT |
  89.               map_type FLOAT |
  90.               use_color |
  91.               use_index |
  92.               alpha all FLOAT |
  93.               alpha FLOAT FLOAT
  94.  
  95. BUMP_ATTRIB = once |
  96.               interpolate FLOAT |
  97.               map_type FLOAT |
  98.               bump_size FLOAT |
  99.               use_color |
  100.               use_index 
  101.  
  102. MATER_ATTRIB= once |
  103.               interpolate FLOAT |
  104.               map_type FLOAT |
  105.               TEXTURE 
  106.  
  107. TEXTURE_ITEM= TEXTURE_IDENTIFIER |
  108.               FLOAT | 
  109.               once |
  110.               turbulence FLOAT |
  111.               octaves FLOAT |
  112.               brick color COLOR_SPEC color COLOR_SPEC |
  113.               mortar FLOAT |
  114.               checker [COLOR_SPEC [COLOR_SPEC]] |
  115.               tiles { [TEXTURE] tile2 [TEXTURE] } |
  116.               bozo | marble | wood | spotted | agate | 
  117.               granite | metallic | onion | leopard |
  118.               painted1 | painted2 | painted3 |
  119.               gradient VECTOR |
  120.               ambient FLOAT |
  121.               brilliance FLOAT |
  122.               roughness FLOAT |
  123.               phong_size FLOAT |
  124.               diffuse FLOAT |
  125.               specular FLOAT |
  126.               phong FLOAT |
  127.               ior FLOAT |
  128.               refraction FLOAT |
  129.               reflection FLOAT |
  130.               waves FLOAT [phase FLOAT] |
  131.               frequency FLOAT |
  132.               phase FLOAT |
  133.               ripples FLOAT |
  134.               wrinkles FLOAT |
  135.               bumps FLOAT |
  136.               dents FLOAT |
  137.               translate VECTOR |
  138.               rotate VECTOR |
  139.               scale VECTOR |
  140.               COLOR_SPEC |
  141.               COLOR_MAP |
  142.               image_map {
  143.                   [MAP_PREFIX...]
  144.                   MAP_FILE
  145.                   [IMAGE_ATTRIB...] } |
  146.               bump_map { 
  147.                   [MAP_PREFIX...]
  148.                   MAP_FILE
  149.                   [BUMP_ATTRIB...] } |
  150.               material_map {
  151.                   [MAP_PREFIX...]
  152.                   MAP_FILE
  153.                   [MATER_ATTRIB...] }
  154.  
  155. TEXTURE     = texture { [TEXTURE_ITEMS...] }
  156.  
  157. USUAL_MODS  = translate VECTOR |
  158.               rotate VECTOR |
  159.               scale VECTOR |
  160.               inverse |
  161.               TEXTURE |
  162.               COLOR_SPEC
  163.  
  164. SPHERE_BODY = VECTOR FLOAT |
  165.               SPHERE_IDENTIFIER
  166.  
  167. SPHERE      = sphere { SPHERE_BODY [USUAL_MODS...] }
  168.  
  169. PLANE_BODY  = VECTOR FLOAT |
  170.               PLANE_IDENTIFIER
  171.  
  172. PLANE       = plane { PLANE_IDENTIFIER [USUAL_MODS...] }
  173.  
  174. HFILE_TYPE  = gif STRING | 
  175.               pot STRING |
  176.               tga STRING |
  177.               HFIELD_IDENTIFIER
  178.  
  179. HFIELD_MODS = USUAL_MODS |
  180.               water_level FLOAT
  181.  
  182. HFIELD      = height_field { HFILE_TYPE [HFIELD_MODS...] }
  183.  
  184. TRI_BODY    = VECTOR VECTOR VECTOR |
  185.               TRIANGLE_IDENTIFIER
  186.  
  187. TRIANGLE    = triangle { TRI_BODY [USUAL_MODS...] }
  188.  
  189. SMO_TRI_BODY= VECTOR VECTOR VECTOR VECTOR VECTOR VECTOR |
  190.               SMOOTH_TRIANGLE_IDENTIFIER
  191.  
  192. SMO_TRIANGLE= smooth_triangle { SMO_TRI_BODY [USUAL_MODS...] }
  193.  
  194. QUAD_BODY   = VECTOR VECTOR VECTOR FLOAT |
  195.               QUADRIC_IDENTIFIER
  196.  
  197. QUADRIC     = quadric { QUAD_BODY [USUAL_MODS...] }
  198.  
  199. Note a POLY_N has M terms where M = (N+1)*(N+2)*(N+3)/6 
  200.  
  201. POLY_N      = "<" float_1 float_2... FLOAT_M ">" |
  202.               POLY_IDENTIFIER
  203.  
  204. POLY_MODS   = USUAL_MODS | sturm
  205.  
  206. CUBIC       = cubic { POLY_3 [POLY_MODS...] }
  207.  
  208. QUARTIC     = quartic { POLY_4 [POLY_MODS...] }
  209.  
  210. POLY        = poly { FLOAT POLY_N [POLY_MODS...] }
  211.  
  212. BI_BODY     = FLOAT [FLOAT] FLOAT FLOAT VECTOR_1 VECTOR_2...
  213.               VECTOR_16 | BICUBIC_IDENTIFIER
  214.  
  215. BICUBIC     = bicubic_patch { BI_BODY [USUAL_MODS...] }
  216.  
  217. BOX_BODY    = VECTOR VECTOR |
  218.               BOX_IDENTIFIER
  219.  
  220. BOX         = box { BOX_BODY [USUAL_MODS...] }
  221.  
  222. BLOB_ITEM   = threshold FLOAT |
  223.               component FLOAT FLOAT VECTOR
  224.  
  225. BLOB_BODY   = [BLOB_ITEM...] |
  226.               BLOB_IDENTIFIER
  227.  
  228. BLOB        = blob { BLOB_BODY [POLY_MODS...] }
  229.  
  230. LIGHT_MODS  = translate VECTOR |
  231.               rotate VECTOR |
  232.               scale VECTOR |
  233.               point_at VECTOR |
  234.               tightness FLOAT |
  235.               radius FLOAT |
  236.               falloff FLOAT |
  237.               spotlight |
  238.               COLOR_SPEC
  239.  
  240. LIGHT_BODY  = VECTOR | LIGHT_IDENTIFIER
  241.  
  242. LIGHT_SOURCE= light_source { LIGHT_BODY [LIGHT_MODS..] }
  243.  
  244. SHAPE       = LIGHT_SOURCE | SPHERE | PLANE | TRIANGLE | SMO_TRIANGLE |
  245.               QUADRIC | HFIELD | CUBIC | QUARTIC | POLY | BICUBIC |
  246.               BOX | BLOB | UNION | INTERSECTION | DIFFERENCE
  247.  
  248. CSG_BODY    = SHAPE | CSG_IDENTIFIER
  249.  
  250. CSG_MODS    = translate VECTOR |
  251.               rotate VECTOR |
  252.               scale VECTOR |
  253.               inverse 
  254.  
  255. INTERSECTION= intersection { [CSG_BODY...] [CSG_MODS...] }
  256.  
  257. UNION       = union { [CSG_BODY...] [CSG_MODS...] }
  258.  
  259. DIFFERENCE  = difference { [CSG_BODY...] [CSG_MODS...] }
  260.  
  261. BOUNDED_BY  = bounded_by { [SHAPE...] }
  262.  
  263. CLIPPED_BY  = clipped_by { [SHAPE...] }
  264.  
  265. OBJ_BODY    = SHAPE | OBJECT_IDENTIFIER
  266.  
  267. OBJ_MODS    = USUAL_MODS | BOUNDED_BY | CLIPPED_BY | no_shadow
  268.  
  269. OBJECT      = object { OBJ_BODY [OBJ_MODS...] }
  270.  
  271. COMP_MODS   = CSG_MODS | BOUNDED_BY | CLIPPED_BY
  272.  
  273. COMP_BODY   = COMPOSITE | OBJECT | COMP_IDENTIFIER
  274.  
  275. COMPOSITE   = composite { COMP_BODY... [COMP_MODS...] }
  276.  
  277. CAMERA_BODY = location VECTOR |
  278.               direction VECTOR |
  279.               up VECTOR |
  280.               right VECTOR |
  281.               sky VECTOR |
  282.               look_at VECTOR |
  283.               translate VECTOR |
  284.               rotate VECTOR |
  285.               scale VECTOR |
  286.               CAMERA_IDENTIFIER
  287.  
  288. CAMERA      = camera { [CAMERA_BODY...] }
  289.  
  290. FOG_BODY    = COLOR_SPEC | FLOAT
  291.  
  292. FOG         = fog { [FOG_BODY...] }
  293.  
  294. DECLARE_BODY= OBJECT | SHAPE | COMPOSITE | TEXTURE... | COLOR_SPEC | 
  295.               CAMERA | VECTOR | FLOAT  
  296.  
  297. DECLARE     = declare IDENTIFIER "=" DECLARE_BODY
  298.  
  299. DEFAULT     = default { TEXTURE }
  300.  
  301. FRAME_ITEM  = FOG | DEFAULT | OBJECT | COMPOSITE | DECLARE | CAMERA |
  302.               max_trace_level FLOAT
  303.  
  304. FRAME       = FRAME_ITEM...
  305.