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