home *** CD-ROM | disk | FTP | other *** search
/ Avalon - 3D Objects & Resources / Avalon.iso / misc / mac / pov_rayd / povlang.doc < prev    next >
Text File  |  1995-01-01  |  9KB  |  211 lines

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