home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / graphics / polyfilm / manual.doc < prev    next >
Text File  |  1993-06-01  |  81KB  |  2,311 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                     Polyfilm User Manual
  11.  
  12.  
  13.                       Martin Brownlow
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. 1. Alert boxes
  22.  
  23. The user will not get very far  in  Polyfilm  without  being
  24. able  to use an alert box.  An alert box is formed by a dou-
  25. ble edged box containing text  and  between  one  and  three
  26. (inclusive!)  buttons,  one of which will have an edge twice
  27. as thick as the others.  They appear usually when  the  user
  28. has  done  something unwise, but also when there is a choice
  29. of options, for instance, the Polyfilm title  screen  is  an
  30. alert box with three items.
  31.  
  32.      They function in exactly the same manner as GEM's alert
  33. boxes.   Pressing  a  button  (by clicking on it with either
  34. button) will select the relevant option, informing the  pro-
  35. gram  of  your  choice.  Pressing return counts as selecting
  36. the button with the double thick edge.  While an  alert  box
  37. is present on screen, nothing else will work, since the pro-
  38. gram is waiting for your input.
  39.  
  40.  
  41. 2. The fileselector
  42.  
  43. Any functions which involve the selection of a filename will
  44. at  some  time call the fileselector.  It is invaluable that
  45. the user knows how to correctly  manipulate  this  form,  or
  46. else  correct  usage  of Polyfilm will be impossible.  It is
  47. similar in many ways to the GEM fileselector of TOS 1.4  up,
  48. with  buttons  for each drive present to allow easy swapping
  49. between drives.  The drive buttons are located down the left
  50. hand side of the form, and each can be one of three colours;
  51. white for present but not selected, green for not present or
  52. red to indicate the currently selected drive.  Clicking on a
  53. white drive button will change to that drive and read  files
  54. from  there.  Clicking on a green or red drive button has no
  55. effect.
  56.  
  57.      Dominating the middle of the form is the file-list win-
  58. dow.   Contained  in  this  window  are all the files in the
  59. current directory which match the current file  mask  (shown
  60. in  the  top-right  of  this window) along with all the sub-
  61.  
  62.  
  63.  
  64.                         June 1, 1993
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                            - 2 -
  71.  
  72.  
  73. directories present.  Selectable files  are  show  in  black
  74. text,  with  directories  written in red.  To select a file,
  75. click on it in the window, and it will turn  black  and  its
  76. name  will  appear  in  the selected box to the right of the
  77. file window.  Clicking on the name again, or clicking on the
  78. OK  button  will use this file as the filename wanted by the
  79. function.  Click on cancel (or OK with no file selected)  to
  80. cancel  the  function.  To change to a sub-directory, simply
  81. click once on the directory name in  the  file  window.   To
  82. regress back through the subdirectories (ie go back a direc-
  83. tory), click on the black square in the top left of the win-
  84. dow.  The final function available in the file window is the
  85. ability to scroll through all the files present if there are
  86. more  than  eleven.   To  do this, simply click on the up or
  87. down buttons at the top and bottom right of the window.
  88.  
  89.      One final feature is the ability to edit  the  filename
  90. to,  for  instance,  create a new file.  This is done in the
  91. selected box of the fileselector.  Pressing either the  left
  92. or  right  arrow  keys  will move a green cursor through the
  93. filename, and typing while the cursor is visible will insert
  94. text  into  the  cursor position, moving the cursor on after
  95. each character.  The backspace key will delete the character
  96. to  the  left  of the cursor, and the delete key will delete
  97. the character  under  the  cursor.   Finally,  pressing  the
  98. escape key will clear the filename and put the cursor to the
  99. beginning of the filename.
  100.  
  101.  
  102. 3. The editor
  103.  
  104.  
  105. 3.1 Introduction
  106.  
  107. The editor is where the user will create all of the  objects
  108. for  use  in a film, as well as the preferences file for the
  109. film (the file which holds all the  palettes,  patterns  and
  110. lightsource shadings).
  111.  
  112.      The editor screen consists of four windows in the  left
  113. two-thirds  of  the  screen, and a menu of options and three
  114. bars in the right third of the  screen.   The  windows  each
  115. hold a projection of the current object; the top left window
  116. holds the front projection of the object, the top right win-
  117. dow  holds the end projection of the object, the bottom left
  118. window holds the plan projection of the object, and  finally
  119. the  bottom right window holds a three dimensional wireframe
  120. projection of the object, whose orientation is described  by
  121. the three bars in the lower right corner of the screen.
  122.  
  123.      Each window consists of the main image, two scroll bars
  124. (to the right and bottom sides of the window) and a zoom box
  125. (in the bottom right corner of the  window)  which  controls
  126. the magnification of the image in the window.  Clicking with
  127.  
  128.  
  129.  
  130.                         June 1, 1993
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                            - 3 -
  137.  
  138.  
  139. the mouse on a scroll bar will  centre  the  window  at  the
  140. corresponding point in space.  Clicking on the zoom box will
  141. either increase the magnification of the image in the window
  142. (ie  zoom-in) or reduce it, depending on whether the left or
  143. right button is pressed.  Clicking in the body of the window
  144. has no effect unless you are adding shapes to the object.
  145.  
  146.      The three bars in  the  bottom  right  portion  of  the
  147. screen  control  the  orientation of the object in the three
  148. dimensional projection window.  Clicking on the arrows  with
  149. the  left  button  will  change the corresponding angle by 1
  150. degree, using the  right  will  change  it  by  15  degrees.
  151. Finally,  clicking  directly  on  the  bar  will immediately
  152. change the angle to the corresponding amount.
  153.  
  154.      The final element of the editor is the menu.   Clicking
  155. on  a  menu item (or pressing the indicated key) will do the
  156. corresponding function.  Many menu items  bring  up  further
  157. menus  to control the action of the function.  For instance,
  158. the first menu item, add, brings up  a  further  menu  whose
  159. items  consist  of  Point,  Line,  Triangle,  Quad,  Sphere,
  160. Detail, Colour and Menu.  Choosing Point or Line  from  here
  161. will  immediately  put  you into creation mode, in which you
  162. can create new shapes inside the object's definition.
  163.  
  164.      As stated earlier, the  editor  uses  four  windows  to
  165. display  the object being edited, each one having individual
  166. zoom and location settings.  Contained in these windows  are
  167. the  wireframe  views of the object; three orthographic pro-
  168. jections and a configurable  three  dimensional  projection.
  169. The  three  dimensional projection can have its Euler angles
  170. (Euler angles are the three angles which define an  object's
  171. attitude)  changed  by means of the three bars in the bottom
  172. right of the screen.  It should  be  noted  that  the  Euler
  173. angles  defined  by the bars describe the object's attitude,
  174. not the camera's, so Euler angles of [0,0,0] do not give the
  175. front projection, since this faces into the screen.  Instead
  176. [180,0,0] should be used, or, for use  in  the  interpreter,
  177. [180*16,0,0]  (the interpreter uses 360*16 divisions for its
  178. angle measurements to give increased accuracy).   The  atti-
  179. tude  of the three dimensional image is important in several
  180. functions, for example the view functions and  the  orienta-
  181. tion function.  See later for descriptions of their usage.
  182.  
  183.      The editor can be exited at any  time  while  the  main
  184. menu  is  showing, either by clicking on the Quit button, or
  185. by pressing the escape key.  If there are objects that  have
  186. changed  since  they  were last saved then the user is given
  187. the chance to abort quitting the editor.  When the editor is
  188. exited,  all banks and preferences which have not been saved
  189. are lost forever.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.                         June 1, 1993
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                            - 4 -
  203.  
  204.  
  205. 3.2 Adding a shape
  206.  
  207. The first thing the user will want to do  is  add  a  shape.
  208. This  is  a quite simple activity, and forms the core of the
  209. editor; you can't do very much without  adding  a  shape  at
  210. some time or another...
  211.  
  212.      In order to add a shape, you must first enter  the  Add
  213. menu by either clicking on the add button, or pressing A (on
  214. all functions which have a keyboard  shortcut,  the  key  to
  215. press  is  indicated in squared parentheses after the button
  216. name).  After selecting the add button, the menu will change
  217. to  one offering a choice of different shapes for use in the
  218. image, along with options for colour, detail and going  back
  219. to  the main menu.  Clicking on point or line (or pressing P
  220. or L) will immediately take you into the  windows  to  enter
  221. the  defining  points  of  the  shape  (see  below), whereas
  222. selecting triangle, quad or sphere  will  bring  up  another
  223. menu for further defining the properties of the shape.
  224.  
  225.  
  226. 3.2.1 Further shape options
  227.  
  228. If you chose triangle or quad, you will encounter  two  main
  229. groups  of  buttons;  single  sided or double sided.  Double
  230. sided means that the surface is  visible  from  both  sides.
  231. Although  this makes the entering of the shape slightly fas-
  232. ter, it slows down calculation and drawing of the  shape  by
  233. the renderer, so it should only be used if both sides can be
  234. seen.  Single sided shapes can only be viewed from one side.
  235. When  entering  a  single  sided shape, the points should be
  236. entered so that when looking from the direction you wish the
  237. shape  to  be  visible  from,  the  points go in a clockwise
  238. direction.  If you get this wrong, the shape  will  only  be
  239. visible  from the other side.  However, this can be remedied
  240. using the flip normal function in the edit menu.
  241.  
  242.      Choosing a sphere, however, only gives you one  set  of
  243. options,  since  spheres  are automatically visible from all
  244. directions.
  245.  
  246.      The options for a shape not only define which direction
  247. it is visible from, but also what it will look like.  Choos-
  248. ing outline will make the shape be drawn  in  outline  only,
  249. with  any  shapes  behind  being  visible  through its body.
  250. Choosing solid will make the shape a solid region of colour.
  251. Finally, choosing both will make the shape be drawn in solid
  252. colour with an  outline,  too  (preferably,  the  user  will
  253. define the two colours to be different!).
  254.  
  255.      After choosing which type of shape you want, the editor
  256. will  throw you into the windows to enter the points consti-
  257. tuting the shape.
  258.  
  259.  
  260.  
  261.  
  262.                         June 1, 1993
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                            - 5 -
  269.  
  270.  
  271. 3.2.2 Entering a point
  272.  
  273. When entering a point, the mouse pointer disappears,  to  be
  274. replaced  by  three  red  crosshairs, one in each projection
  275. window, the menu is replaced by some information about  what
  276. you  are  doing  and the keys which will have an effect, and
  277. finally, the orientation bars disappear to  be  replaced  by
  278. three co-ordinate counters which tell you where in space the
  279. crosshairs are.  Moving the mouse without the right   button
  280. pressed  will affect the position of the crosshairs directly
  281. in the front projection window, ie moving the mouse up  will
  282. move  the  crosshairs  in the front window up (and as a side
  283. effect, it will move the crosshairs in  the  end  projection
  284. window  up,  too)  and  moving the mouse right will move the
  285. crosshairs in the front projection  window  right  (and  the
  286. crosshairs in the plan projection window right, too).  Hold-
  287. ing the right mouse  button  while  moving  the  mouse  will
  288. directly  affect  the position of the crosshairs in the plan
  289. projection window (ie you have no control over the  y  posi-
  290. tion of the crosshairs).
  291.  
  292.      The speed of the crosshair movement on-screen is depen-
  293. dent  on  the magnification of the window, since for a given
  294. mouse movement, the crosshairs will move by  a  certain  co-
  295. ordinate  displacement,  not pixel displacement.  This means
  296. that the user can get perfect positioning at any  magnifica-
  297. tion  using  the  co-ordinate  counter  in  the bottom right
  298. corner of the screen.
  299.  
  300.      Problems can arise in two  ways  using  this  graphical
  301. method of input.  The first kind of problem occurs because a
  302. mouse isn't the easiest thing to use with perfect  accuracy.
  303. For  instance, if the user wants to put a point at [50,0,0],
  304. starting with the mouse at [0,0,0], then all that is  needed
  305. is  to  move  the  mouse right until the x counter reads 50.
  306. This sounds very easy, but in practice it is all too easy to
  307. let the mouse drift upwards while moving across, and then to
  308. let it drift across while  correcting  the  vertical  drift,
  309. making  the  entering of a point take up to twice as long as
  310. it should.  To  counter  this,  the  editor  supports  three
  311. lock-out  keys,  which  each lock the co-ordinates on one of
  312. the axes.  The three keys are control, left shift and alter-
  313. nate  which  lock the x, y and z co-ordinates, respectively.
  314. Now in our example, the user just needs to  press  and  hold
  315. the  left  shift  key and move the mouse right until the co-
  316. ordinates read [50,0,0].
  317.  
  318.      The second type of problem occurs when the  user  needs
  319. to place a point at exactly the same place as another point.
  320. This should occur often, since most objects designed  should
  321. be closed.  Points positioned at the same place are detected
  322. by Polyfilm, and are only counted as one point,  which  both
  323. saves on memory, allowing larger objects, and speeds up pro-
  324. cessing time, since it is one less point to  calculate.   If
  325.  
  326.  
  327.  
  328.                         June 1, 1993
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                            - 6 -
  335.  
  336.  
  337. the  object has not been designed on paper first, it is easy
  338. to forget where exactly each point is.  The different window
  339. magnifications  do not help solve this problem, since at the
  340. lower magnifications, many pixels are  represented  by  just
  341. one  pixel,  so it is impossible to tell exactly which pixel
  342. the point the user wants occupies.  Polyfilm overcomes  this
  343. problem  using  two keys, which are active nearly all of the
  344. time during the entering of a point.  These keys are  S  and
  345. K,  which  snap  the  crosshairs  to  the nearest predefined
  346. point.  The difference between  the  keys  is  that  K  also
  347. enters  the  point  as  if  the  left  mouse button had been
  348. pressed.  If the keys are active, then it will say so in the
  349. right panel.
  350.  
  351.      Other keys which are active during the  entering  of  a
  352. point  are  Z,  which  returns the crosshairs to [0,0,0] and
  353. centres the windows on that point, and C which  simply  cen-
  354. tres  the  windows on the crosshairs.  Finally, pressing the
  355. escape key will quit from the entering of the point,  losing
  356. any shapes which are partly defined.
  357.  
  358.  
  359. 3.2.3 Entering a shape; multiple points
  360.  
  361. If a shape other than point is chosen  from  the  add  menu,
  362. then  the  user  will  need to define more than one point to
  363. enter the shape.  When this is the case, after the input  of
  364. a  point,  the  editor  will show an elasticated view of the
  365. shape  so  far,  which  changes  as  the  user   moves   the
  366. crosshairs.   As the user enters more points, the shape will
  367. be formed by the elastic lines, showing  what  the  finished
  368. shape  will look like in the image.  Pressing the escape key
  369. during the entering of multiple points  will  lose  all  the
  370. points defined in the current elastic shape defined so far.
  371.  
  372.      There is a special case when  entering  a  point  which
  373. requires  the  use of more keys, and that is the entering of
  374. the last point on a quadrilateral.  Since the finished  qua-
  375. drilateral  must  be  planar  (ie two-dimensional), the last
  376. point cannot just be positioned anywhere, so  Polyfilm  will
  377. try  to make the shape planar by projecting the point into a
  378. window until it forms a planar shape with the  rest  of  the
  379. shape.   Projecting  into  a window means that in the chosen
  380. window, the co-ordinates remain the same, but the  point  is
  381. moved  along the axis which goes into the window until it is
  382. in the correct place.  This means that the user can position
  383. the  point  in  the  correct place visibly in one window and
  384. then tell Polyfilm to find the correct place  in  the  other
  385. windows.
  386.  
  387.      Although Polyfilm makes an informed choice as to  which
  388. window  to  project  into,  it would be useful to know which
  389. window this would be, or more precisely, to be able to  tell
  390. Polyfilm  which  window  to  project into.  Six keys control
  391.  
  392.  
  393.  
  394.                         June 1, 1993
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                            - 7 -
  401.  
  402.  
  403. which window to project into, F, E and P project into front,
  404. end  and  plan  windows  respectively,  but do not enter the
  405. point (like the S key), while 1, 2 and 3  project  into  the
  406. same  windows, but enter the point (like the K key).  Alter-
  407. natively, pressing the left mouse button tells  Polyfilm  to
  408. choose the best window to project into.  A reminder of these
  409. keys is printed in the right panel when they become active.
  410.  
  411.      Another restraint on the last point of a  quadrilateral
  412. is  that it must make a convex shape when projected.  A con-
  413. vex shape is one which doesn't  turn  back  on  itself,  one
  414. which, when walking clockwise around the outside lines, only
  415. turns to the right from one line to the next.  If the  shape
  416. is not convex then Polyfilm will not allow the user to enter
  417. it.
  418.  
  419.  
  420. 3.2.4 Colour
  421.  
  422. Choosing the colour option from the add menu brings up a low
  423. resolution  screen which enables you to choose the colour of
  424. the next and subsequent shapes.  Dominating  the  centre  of
  425. the  screen  is  a  display  of all the colours and patterns
  426. available for use.  Clicking here with the left button  will
  427. change the first colour, clicking with the right will change
  428. the  second  colour.   The  first  and  second  colours  are
  429. displayed just above the colours and patterns.  It should be
  430. noted that the second colour can only be selected  from  the
  431. top  row  (the colours in the palette, not patterns or light
  432. source shadings (see below)).  Finally, there are three but-
  433. tons  on  the  periphery  of the screen.  Selecting the Done
  434. button will return to the editor  with  the  current  colour
  435. selection.   Selecting the Choose palette button will enable
  436. the user to change  the  current  palette  via  the  palette
  437. selection  screen  (see later).  Although the palette can be
  438. changed on this screen, this does not mean  that  an  object
  439. can have more than one palette in it.  In fact, the palettes
  440. have no effect on the object, they only select which set  of
  441. sixteen colours is to be used in the rendering.
  442.  
  443.      The Select LSS button  replaces  the  colour  selection
  444. screen with the light source selection screen, which enables
  445. the user to define a shape's first colour to be an LSS  (see
  446. the  section  on  defining  preferences,  below).  The light
  447. source selection screen has, in place  of  the  colours  and
  448. patterns,  two of the possible thirty two light source shad-
  449. ings displayed.  To display the rest, the UP and  DOWN  but-
  450. tons  should be used.  Only a shape's first colour can be an
  451. LSS.
  452.  
  453.      The difference between  the  first  colour  and  second
  454. colour of a shape is simple.  The first colour is the colour
  455. of the shape when it is drawn, be it outline or solid.   The
  456. second  colour is only used when the shape is both solid and
  457.  
  458.  
  459.  
  460.                         June 1, 1993
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                            - 8 -
  467.  
  468.  
  469. outlined, and it is used to draw the outline of  the  shape,
  470. after the first colour has been used to draw the solid.
  471.  
  472.      It is possible to define a line or point to be  an  LSS
  473. or  a  pattern  in colour.  In this case, the user should be
  474. aware that, in the case of a pattern,  the  colour  directly
  475. above  the  pattern on-screen will be used, not the pattern,
  476. or, in the case of an LSS, it is the LSS number minus one in
  477. modulo  16  which  is  used for the colour number.  Defining
  478. lines and points to be LSS's or patterns  is  only  used  in
  479. conjunction  with the rotation function (see below) to allow
  480. easy definition of patterned or light source shaded surfaces
  481. of revolution.
  482.  
  483.  
  484. 3.2.5 Surface detail
  485.  
  486. Surface detail can be used to enhance the  final  appearance
  487. of  an  object, and also to overcome certain shortcomings in
  488. the rendering routines.  A piece  of  surface  detail  is  a
  489. shape  which  is  inscribed on the surface of another shape,
  490. and which, therefore, is visible only when the  parent  sur-
  491. face (the surface which it rests on) is visible.
  492.  
  493.      From the definition above, it can be seen that  surface
  494. detail  must  be two-dimensional, and it must also rest on a
  495. planar shape.  Thus this prohibits points, lines and spheres
  496. from being parent surfaces, and it also prohibits spheres as
  497. a form of surface detail.
  498.  
  499.      To add a piece of surface detail, click on  the  Detail
  500. button  in the add menu (or press D).  You are now presented
  501. with a menu which enables you to select which surface to put
  502. the  detail  on.   To cycle through the applicable surfaces,
  503. use the buttons marked Next, Previous, Forward 10  and  Back
  504. 10.   The  surface  which  is  currently  selected  will  be
  505. highlighted in green.  To select the surface to  add  detail
  506. to, simply click on the Select button.  To return to the add
  507. menu, select the Cancel button.
  508.  
  509.      Once you have selected the surface you want to put  the
  510. detail  on,  the  menu  will change to a list of valid shape
  511. types, similar to the  add  menu,  except  with  sphere  and
  512. detail missing.  This menu functions in exactly the same way
  513. as the add menu, as do the shape type sub-menus.  One  small
  514. difference is that surface detail cannot be single or double
  515. sided by choice, it inherits its sidedness from  its  parent
  516. shape.
  517.  
  518.      When defining the points constituting a piece  of  sur-
  519. face  detail,  it should be noticed that the usual add point
  520. keys and functions do not work.  Instead, since  the  detail
  521. actually  needs  to be on the surface, each point defined is
  522. snapped to the parent shape's plane.  To see how to do this,
  523.  
  524.  
  525.  
  526.                         June 1, 1993
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                            - 9 -
  533.  
  534.  
  535. refer  to  section 3.2.3, Entering a shape; multiple points,
  536. above.
  537.  
  538.  
  539. 3.3 Editing and deleting a shape
  540.  
  541. If an error is made during the entering of a shape, then  it
  542. is  useful to be able to either edit the shape or delete it.
  543. This is done by the second and third items in the main menu,
  544. respectively.  Choosing either one brings up a sub-menu with
  545. three buttons which enable  you  to  choose  to  edit/delete
  546. either  a  normal  shape  (polygon)  or  a  piece of surface
  547. detail, or to go back to the  main  menu.   Choosing  either
  548. polygon  or  detail  then brings up a further sub-menu which
  549. allows the user to choose which shape/detail to edit/delete.
  550. This  functions  in  exactly  the  same  way as the sub-menu
  551. described in the addition on surface detail,  above,  except
  552. that  when choosing a piece of detail to edit, the currently
  553. selected detail is highlighted in red.
  554.  
  555.      Choosing select from this menu has a  different  effect
  556. depending  on whether you chose edit or delete from the main
  557. menu.  If you chose delete, an alert box will appear, asking
  558. whether  or  not  the user is sure about deleting the shape.
  559. Clicking on OK will proceed with the delete, while  clicking
  560. on  ABORT  stops the deletion.  Both buttons return the user
  561. to the surface selection menu.
  562.  
  563.      If the user chose edit, however, a further sub-menu  is
  564. produced,  allowing three different editing functions.  If a
  565. function is unavailable on the  current  shape,  then  there
  566. will  not be a box around it, and the user will be unable to
  567. select that function.  The  first  of  the  three  functions
  568. allows  the  shape's colour to be altered.  This function is
  569. always available.  The next of the  three  functions  allows
  570. the  changing of the type of shape (in this context, type of
  571. shape refers to either outline, solid, both, single sided or
  572. double  sided,  not  triangle,  quad etc).  This function is
  573. only available for  editing  triangles,  quadrilaterals  and
  574. spheres.  Finally, a single sided, planar shape's normal can
  575. be flipped, allowing it to be viewed from the other side.
  576.  
  577.  
  578. 3.4 The extra sub-menu
  579.  
  580. The fourth option on the  main  menu,  Extra,  brings  up  a
  581. further  menu  of useful functions.  These are; Paste, Rota-
  582. tion, Orientation, View and Info.  Choosing info  brings  up
  583. an  alert  box  which  informs you how many points, normals,
  584. surfaces and surface details are used by the current object.
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                         June 1, 1993
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                            - 10 -
  599.  
  600.  
  601. 3.4.1 Paste
  602.  
  603. The Paste option allows the user to add objects together  to
  604. form  larger objects.  This is particularly useful when cou-
  605. pled with the rotation function (see below), since the rota-
  606. tion function will only rotate about [0,0,0] using the whole
  607. object.  So, for example, the  rotation  function  could  be
  608. used  to  create  a  wheel,  which could then be pasted onto
  609. another bank four times to create the four wheels of  a  car
  610. or truck (see below for an explanation of banks).
  611.  
  612.      When paste is selected, the extra sub-menu is  replaced
  613. with a bank selection menu, with which you choose which bank
  614. to paste the current bank onto.  Clicking on a  bank  button
  615. will display the current contents of that bank, and clicking
  616. on select will choose the currently displayed bank to  paste
  617. onto.  Clicking on cancel will abort the paste operation and
  618. leave all banks unchanged.  The bank which is the source for
  619. the  paste  is  the  one  which was displayed when the paste
  620. option was selected.
  621.  
  622.      After selection of which bank to paste onto,  you  must
  623. then  position  the  object  to be pasted inside the current
  624. object's space.  This is done in exactly  the  same  way  as
  625. adding  a  point, above.  Every time the mouse is moved, the
  626. whole object and paste object must be redrawn  in  the  win-
  627. dows.  This means that when you are pasting a complex object
  628. onto a complex object, things can slow down  alot.   To  get
  629. around  this,  Polyfilm  supports  two extra keys during the
  630. pasting of an object.  The f2 key will stop Polyfilm drawing
  631. the  paste  object,  leaving just the red crosshairs to mark
  632. the position of the cursor; this speeds things up, and it is
  633. recommended  that  you  do  this  to position your object in
  634. roughly the right place before using  f1  to  redisplay  the
  635. paste  object for fine positioning.  Pressing the left mouse
  636. button will paste the object into the current  bank  at  the
  637. current  co-ordinates.   Alternatively,  pressing the escape
  638. key will abort the operation.
  639.  
  640.  
  641. 3.4.2 Orientation
  642.  
  643. The orientation function is used to rotate the current shape
  644. if,  for instance, you suddenly find out that you've entered
  645. the object the wrong way around.  When the orientation  but-
  646. ton  is  pressed,  the  object  is rotated to the same Euler
  647. angles as the three dimensional projection window  and  then
  648. displayed  in  its rotated form.  Choosing Keep from the new
  649. menu will keep the rotated shape,  whereas  choosing  Cancel
  650. will return the shape to its original form.
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.                         June 1, 1993
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                            - 11 -
  665.  
  666.  
  667. 3.4.3 Rotation
  668.  
  669. The rotation function is the editor's  most  powerful  func-
  670. tion.  The power of it is reflected in the number of parame-
  671. ters the user must set before there is  any  effect  on  the
  672. object.   Rotation  of objects is restricted to objects con-
  673. taining only points and lines.  Upon rotation, points become
  674. lines,  and  lines  become  quadrilaterals, since new points
  675. created are automatically joined to  the  points  they  were
  676. rotated from.
  677.  
  678.      When the rotate function is first  selected,  the  user
  679. must  decide  which window Polyfilm is to rotate the current
  680. shape in, or, if it is preferred, which axis to  rotate  the
  681. shape  about.   Rotation  in  a window will rotate the shape
  682. around [0,0] in the given window, whereas rotation about  an
  683. axis will rotate the shape around a line, for example around
  684. z=0 is a rotation around the z-axis.  This  is  exactly  the
  685. same as a rotation in the front projection window.
  686.  
  687.      The next thing that  must  be  selected  is  the  angle
  688. through  which the object is to be rotated.  This can be one
  689. of seven predefined values; 30, 45, 60, 90, 180, 270 or  360
  690. degrees.   After  this  selection,  the  user must enter the
  691. number of steps in  the  rotation;  ie  how  many  different
  692. shapes  are  to  be created for each shape already declared.
  693. To do this, press backspace until the number displayed reads
  694. zero,  and then type your new number, followed by the return
  695. key.  Choosing Cancel here will  abort  the  rotation.   The
  696. constraints  on  the  number  of  steps  are that it must be
  697. between three and sixty steps, inclusive (this is reiterated
  698. on-screen), and that it must divide the total rotation angle
  699. multiplied  by  sixteen  exactly,  ie  there  must   be   no
  700. remainder.   If these constraints are not met then the rota-
  701. tion will not proceed.
  702.  
  703.      The final thing that needs selecting  is  the  type  of
  704. quadrilateral  or  triangle  that  lines  will become.  This
  705. selection is exactly the same as that given in Further shape
  706. options,  above.   It  should be noted that if you are using
  707. lines changing into single  sided  shapes,  then  all  lines
  708. defined in you image should be defined in a clockwise direc-
  709. tion in the right hand half of the window at 90o to the  one
  710. that  you'll  be rotating in, and in an anticlockwise direc-
  711. tion in the left hand half...  in short, define all lines in
  712. the right half of a window for a rotation.
  713.  
  714.      As an example  of  rotation,  put  a  single  point  at
  715. [0,50,0]  (ie  50  pixels  up  in the front window) with the
  716. default colour (this should be light source  shading  number
  717. 1)  in  an  empty  bank (see below for how to change banks).
  718. Now choose to rotate the image in the front  window  by  180
  719. degrees  in  12  steps.   Since the Polyfilm editor is a bit
  720. silly, it'll ask what lines should be made into,  but  there
  721.  
  722.  
  723.  
  724.                         June 1, 1993
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                            - 12 -
  731.  
  732.  
  733. are no lines, so just click on anything.  After a very short
  734. delay (less than a quarter of a second), the windows  should
  735. be redrawn with a semicircle in the front view and a line in
  736. each of the other two projection  windows.   The  reason  we
  737. only rotated the point by 180 degrees is that if we had done
  738. the full 360 degrees then the left hand half  of  the  front
  739. view  would  be  going  clockwise,  producing a sphere which
  740. would have only half of its outer edge looking outwards when
  741. single  sided is chosen later.  The final thing to do in our
  742. example is to perform another rotation, this time about  the
  743. plan  view,  by  360 degrees in 24 steps, with lines turning
  744. into single sided solid type  shapes.   After  entering  all
  745. that,  the editor should go to sleep for a short while (less
  746. than 5 seconds for such a small rotation), with  the  legend
  747. Working  displayed  in  the menu area.  When the windows are
  748. redrawn, they will contain a full sphere, ready to be  light
  749. source  shaded  (this  light source shading is the reason we
  750. did not simply use the in-built sphere shape type).  To view
  751. your  creation  in  all  its  glory, see the instructions on
  752. viewing an object, below.
  753.  
  754.  
  755. 3.4.4 View
  756.  
  757. Clicking on the view object button from the extra menu  will
  758. bring up a new menu containing the view options available to
  759. the user.  Most of these new buttons control the  rotational
  760. movement  of  the  object.   All view modes take the current
  761. orientation of the three dimensional projection window to be
  762. the starting orientation of the object.
  763.  
  764.      Stationary simply draws the  object  and  waits  for  a
  765. keypress.   This  is  useful  for checking an object from an
  766. exact angle.  The  next  three  buttons  rotate  the  object
  767. around  each  of the three principle axes.  The Alpha button
  768. is the same as the first angle specified by the first orien-
  769. tation  bar, Beta is the same as the second orientation bar,
  770. and Gamma is the same as the third orientation  bar.   While
  771. viewing  in this mode, the plus and minus keys on the keypad
  772. affect rotation speed (which can be either positive or nega-
  773. tive),  and the S key stops the rotation.  Finally, pressing
  774. the escape key will exit the rotation and return the user to
  775. the view sub-menu.
  776.  
  777.      The final button which views the  object  is  the  Free
  778. move button.  In this mode, all three angular velocities can
  779. be altered, resulting in impressive, somewhat chaotic, rota-
  780. tion patterns.  The keys which affect the angular velocities
  781. are; Q, W and E to speed up the rotation  about  the  alpha,
  782. beta and gamma angles, respectively, Z, X and C to slow down
  783. the rotation, and A, S and D to stop each of the three rota-
  784. tions.   Finally,  F  will  stop the whole rotation, and the
  785. escape key will leave the view mode.
  786.  
  787.  
  788.  
  789.  
  790.                         June 1, 1993
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                            - 13 -
  797.  
  798.  
  799.      The last option on the menu (apart from the cancel but-
  800. ton),  is  the  palette  button.   This allows you to change
  801. which palette to use for the low resolution  mode  viewings.
  802. See the section on preferences for how to select a palette.
  803.  
  804.  
  805. 3.5 Banks
  806.  
  807. One powerful feature of Polyfilm is its  ability  to  create
  808. more  than one object at a time by its use of banks.  A bank
  809. is simply a place in memory which can hold an object.  Poly-
  810. film  supports  five independent banks, each of which can be
  811. edited, viewed, deleted, copied, pasted, etc.  To be able to
  812. perform  certain  bank  operations, it is necessary to be in
  813. the banks sub-menu.  Access to this is gained by clicking on
  814. the Bank button from the main menu.
  815.  
  816.      Changing bank can be achieved with the use of the first
  817. five  buttons, or by pressing one of the first five function
  818. keys (these keys are indicated on the bank buttons).  Chang-
  819. ing banks with the function keys works on nearly every menu,
  820. whether indicated or not.  The exception  to  this  is  when
  821. deciding whether or not to keep an object which has just had
  822. its orientation changed (see orientation, above).  When  the
  823. bank  has  been changed, the windows will be cleared and the
  824. new bank drawn in, and then all subsequent  operations  will
  825. be applied to the new bank.
  826.  
  827.      Deletion of a bank is performed using the  Delete  but-
  828. ton.  Pressing this button will cause the current bank to be
  829. deleted, except if the bank has changed since  it  was  last
  830. saved.  In this case, an alert box appears asking whether or
  831. not to proceed with the deletion.  If the user clicks on the
  832. OK button, then the deletion will proceed.
  833.  
  834.      Finally, a bank can be copied onto another  bank  (this
  835. obviously  results  in  the loss of the target bank) via the
  836. Copy button.  Whichever bank is active when the copy  button
  837. is  selected  will become the source bank, that is, the bank
  838. which is to be copied.  The user must then choose the desti-
  839. nation bank, in exactly the same way as for the paste opera-
  840. tion (see above).  When this has been done, the source  bank
  841. will be copied over the target bank.  If the target bank has
  842. changed since it was last saved,  then  an  alert  box  will
  843. appear  asking  for  confirmation  before the copy operation
  844. takes place.
  845.  
  846.  
  847. 3.6 Loading and saving an object
  848.  
  849. Loading and saving objects are essential functions, since it
  850. isn't possible to send files from the editor directly to the
  851. interpreter, and it is desirable to be  able  to  save  your
  852. work,  anyway.   The  Load and Save buttons work in much the
  853.  
  854.  
  855.  
  856.                         June 1, 1993
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                            - 14 -
  863.  
  864.  
  865. same way, each one calling up the fileselector for the  user
  866. to choose which file to load/save.  If either of these func-
  867. tions have been used on the bank before, and  the  bank  has
  868. not been deleted since, then the default fileselector choice
  869. is the same as the filename  last  used  by  the  bank.   To
  870. select the same filename, just press return, or click on the
  871. OK button.  After filename selection, the  load/save  opera-
  872. tion  will  then  take  place.  If the user selects the load
  873. option on a bank which has changed since it was last  saved,
  874. then  an  alert  box  appears asking for confirmation of the
  875. load.  Loading will only proceed if confirmation is given.
  876.  
  877.  
  878. 3.7 Preferences
  879.  
  880. The preferences section of the Polyfilm  editor  allows  the
  881. user  to  set all of the patterns, palettes and light source
  882. shadings used in the rendering process.  Each of the  previ-
  883. ously  mentioned  categories  can be selected via the button
  884. with the same name  from  the  preferences  menu.   Complete
  885. preferences  files  can  also be saved and loaded from here.
  886. It should be noted that a preferences file consists of  five
  887. palettes,  thirty  two light source shadings and forty eight
  888. patterns, and that only one preferences file can  be  loaded
  889. into the editor at any one time.
  890.  
  891.  
  892. 3.7.1 Editing the palette
  893.  
  894. When the palette option is chosen from the preferences menu,
  895. the screen will change to one containing four buttons, three
  896. colour bars and a bank  of  sixteen  colours.   The  buttons
  897. allow  the  user to change which palette is being edited, to
  898. save or load a single palette, or to exit the  palette  edi-
  899. tor.   The  changing  of the palette is done via the palette
  900. selection screen as defined above.
  901.  
  902.      Clicking on one of the colours in the bank  of  sixteen
  903. colours  will  make  that colour the current colour and move
  904. its RGB values into the bars.  Clicking on one of the arrows
  905. above  or below a bar will change the corresponding value by
  906. one  either  up  or  down  (depending  on  which  arrow  was
  907. pressed).   Actually  clicking  inside the bar will move the
  908. corresponding slider to the value clicked on.  As the colour
  909. values  change, so does the colour selected in the bank, and
  910. the colour of the sliders on the bars.  The  current  colour
  911. components  displayed  in  the  bars are written below them,
  912. along with which colour  the  bar  represents,  either  red,
  913. green or blue.
  914.  
  915.  
  916. 3.7.2 Editing the patterns
  917.  
  918. The pattern editing screen consists of two large windows  in
  919.  
  920.  
  921.  
  922.                         June 1, 1993
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                            - 15 -
  929.  
  930.  
  931. the  upper  left  portion of the screen, the larger of which
  932. displays  a  magnification  of  the  pattern,  the   smaller
  933. displays a magnification of the pattern mask, a bank of six-
  934. teen colours in the top right of the screen, below which are
  935. five buttons.  To the left of the buttons, under the smaller
  936. window are four small images.  The  upper  two  contain  the
  937. regular size versions of the pattern and mask, the lower two
  938. contain the colours which the left and right  mouse  buttons
  939. lay  down,  respectively.   Finally,  at  the  bottom of the
  940. screen is a bank containing all 48 patterns.
  941.  
  942.      To change a pattern, the user must press  the  left  or
  943. right  buttons in either of the two large windows.  Pressing
  944. them in the leftmost of the two windows lays down a pixel of
  945. the appropriate colour, and changes the mask and both of the
  946. regular sized views of the pattern.  Clicking  in  the  mask
  947. window  will  alter  the mask, either laying down a piece of
  948. white or a piece of black, depending  on  which  button  was
  949. pressed.   The significance of the mask colours is simple to
  950. understand; if a part of the mask is white, then whatever if
  951. behind  the  pattern  is  seen  behind  the shape, but black
  952. prohibits vision through the pattern.  Some strange  effects
  953. can  be  achieved by altering the mask so that pieces of the
  954. background are visible through a part of the  pattern  which
  955. contains  colour.   In short, the mask should not be altered
  956. unless you know what you are doing, or are experimenting.
  957.  
  958.      To change which colour each button  lays  down,  simply
  959. click  the  button  whose colour you want to change over the
  960. colour you want to change it to, and it changes.
  961.  
  962.      A pattern is not included in the bank of patterns until
  963. it  is  put there by the user.  This is done by clicking the
  964. right button over the space that you want it to occupy.  The
  965. pattern  will  then  be  placed in that position, completely
  966. erasing the previous occupant.   Similarly,  to  retrieve  a
  967. pattern  for  editing,  press the left button on the desired
  968. pattern.
  969.  
  970.      The final thing to describe is the function of the but-
  971. tons  beneath  the  colour  bank.   Most  of these are self-
  972. explanatory; clear clears the current pattern, load and save
  973. cover  disk  operations (although they only work on the pat-
  974. tern being edited, not the whole bank), and exit  exits  the
  975. pattern  editor.  However, the stipple operation is a useful
  976. and interesting button.  Clicking on this button  will  turn
  977. the  pattern  being edited into a checkerboard pattern using
  978. the left and right button colours as  the  black  and  white
  979. squares.   In  this  way,  effective  mid-way colours can be
  980. easily made to increase the effectiveness of a light  source
  981. shading.
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.                         June 1, 1993
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                            - 16 -
  995.  
  996.  
  997. 3.7.3 Editing the lightsource shadings
  998.  
  999. Before describing how to edit the LSS's,  it  is  perhaps  a
  1000. good  idea  to say exactly what an LSS is.  In short, an LSS
  1001. is a list of the series of colours  that  a  shape  will  go
  1002. through  as  its angle to the lightsource increases.  When a
  1003. shape which is defined to be a lightsource shading is to  be
  1004. printed,  then  its  angle  to the lightsource is found, and
  1005. then this (along with the backlit flag) is used to determine
  1006. where in the list the correct colour for the surface is.
  1007.  
  1008.      The backlit flag determines whether  or  not  the  list
  1009. will  be consulted when the lightsource is on the other side
  1010. of the shape.  If the LSS is defined to not be backlit  then
  1011. the  reverse  side  colour  is  used when the lightsource is
  1012. behind the shape, if the backlit flag is set then the  posi-
  1013. tion  in  the  LSS  is  calculated  differently, taking into
  1014. account the back of the object.
  1015.  
  1016.      The LSS editing screen consists of three main  rows  of
  1017. icons  and  buttons.  The top row contains a list of all the
  1018. colours and patterns.  The middle row contains a representa-
  1019. tion of the current LSS, and the bottom row holds eight but-
  1020. tons.
  1021.  
  1022.      Examining the middle row, you will see that there is an
  1023. arrow  above  the  first square in the LSS definition.  This
  1024. arrow shows  where  a  colour  will  be  placed  if  one  is
  1025. selected.   The  middle  row  itself consists of two rows of
  1026. sixteen icons, slightly displaced to the left of centre, and
  1027. one  icon  on  its  own on the right of the screen.  The two
  1028. rows of sixteen icons represent the  list  of  colours,  the
  1029. order  going along the top row, then down to the next row as
  1030. you would when reading.  If one of theses icons is a  cross,
  1031. then  that  colour  is not used, since a lightsource has the
  1032. number of colours it uses defined.   The  icon  on  its  own
  1033. represents the back colour of the shape, and only comes into
  1034. effect when the backlit button reads No.  Clicking with  the
  1035. left  button  anywhere on the middle row will move the arrow
  1036. over the corresponding icon.  Clicking with the right button
  1037. on  an icon will delete the icon, moving the rest up to fill
  1038. the gap.
  1039.  
  1040.      Clicking in the top row with the left button  will  put
  1041. the  colour  or pattern clicked on into the space in the LSS
  1042. pointed to by the arrow.  Clicking with the right,  however,
  1043. will insert the colour into the LSS at the arrow's position,
  1044. moving colours further down the LSS to make room.
  1045.  
  1046.      The buttons in the left hand half  of  the  bottom  row
  1047. control  which  lightsource  is  being edited, the number of
  1048. colours it contains  and  whether  or  not  it  is  backlit.
  1049. Clicking  on  one of these buttons with the left button will
  1050. decrease the corresponding value, the right  increasing  it.
  1051.  
  1052.  
  1053.  
  1054.                         June 1, 1993
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                            - 17 -
  1061.  
  1062.  
  1063. The  exception  is  the  backlit  button, which toggles when
  1064. clicked on.
  1065.  
  1066.      The right hand half of the bottom row contains  buttons
  1067. which  are  self  explanatory, allowing changing of palette,
  1068. saving and loading of  the  current  LSS,  clearing  of  the
  1069. current LSS and exiting back to the preferences menu.
  1070.  
  1071.  
  1072. 4. The Polyfilm Motion Control Language
  1073.  
  1074. In order to create a film, it is necessary  to  be  able  to
  1075. tell  Polyfilm  what  each entity, be it a camera, object or
  1076. lightsource, has to do during each and every frame.  This is
  1077. achieved  using  the Polyfilm Motion Control Language, which
  1078. is a programming language unique to Polyfilm designed  espe-
  1079. cially to allow easy manipulation of objects in three dimen-
  1080. sional  space.   Programs  are  written  in  this   language
  1081. (hereafter  referred  to as MCL) using a text editor (unfor-
  1082. tunately, a text editor was beyond the scope  of  this  pro-
  1083. ject), and then saved to disk as a text file with the exten-
  1084. sion .MCL.  This file will contain  commands  defining  each
  1085. entity  in  the film, its initial position and attitude, and
  1086. its motions during the film.
  1087.  
  1088.      The language was designed to be as much like C as  pos-
  1089. sible  for  a  language  of  this type.  This means that the
  1090. language is not interpreted like a standard BASIC, which  is
  1091. interpreted  dependent  on line numbers.  Instead the inter-
  1092. preter goes through the program from line to line  down  the
  1093. file.   It should also be noted that there is no GOTO state-
  1094. ment.  If you are unfamiliar with  this  type  of  language,
  1095. then you are referred to any good C text book.
  1096.  
  1097.  
  1098. 4.1 Interpreting Modes
  1099.  
  1100. The interpreter itself has three modes, and it is vital that
  1101. the  user understands the use of each mode and its limits on
  1102. commands.  The first mode, called mode 0  in  the  following
  1103. documentation,  is  the first pass mode.  It is in this mode
  1104. that the interpreter first looks through the program,  find-
  1105. ing  out  which objects, cameras etc have been declared, and
  1106. initialising them.  In this mode, the interpreter also finds
  1107. each  entity's  main  function  (the point where an entity's
  1108. program running is to start from) and loads any object types
  1109. (three  dimensional  shapes  defined  using  the editor) and
  1110. preferences set by the program.  Finally, any commands  out-
  1111. side of any functions are done as the interpreter encounters
  1112. them.
  1113.  
  1114.      After the first  pass  has  been  completed,  the  data
  1115. structures which have been created are checked for complete-
  1116. ness; every entity must  have  a  main  function  and  every
  1117.  
  1118.  
  1119.  
  1120.                         June 1, 1993
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                            - 18 -
  1127.  
  1128.  
  1129. object  must  have  a  type.  If the first pass is completed
  1130. successfully and  the  entities  created  are  correct,  the
  1131. interpreter enters mode 1 and the film proper is begun.
  1132.  
  1133.      In mode 1, the interpreter goes through  each  entity's
  1134. program, entity by entity, until either an endsim command is
  1135. encountered, a wait condition fails or a  frame  command  is
  1136. found.   Upon  the first of these events, the film is ended,
  1137. but the other two events  tell  the  interpreter  that  this
  1138. entity's  program  has finished for this frame, and then the
  1139. interpreter starts on the next entity's program.
  1140.  
  1141.      Mode 2, the last mode, is the mode in which the  inter-
  1142. preter processes any keypresses for which commands have been
  1143. defined (this, too, is determined in mode  0).   Mode  2  is
  1144. entered every frame, before processing of entities' programs
  1145. has begun.
  1146.  
  1147.      In each mode, there are limits on  which  commands  are
  1148. allowed,  and also the mode they must take.  A complete list
  1149. of commands, and which modes they are allowed  in  is  given
  1150. later.
  1151.  
  1152.      In mode 0, all objects, cameras and lightsources  which
  1153. are  to  be used in the film must be defined, along with all
  1154. types of objects, all entity main functions,  any  functions
  1155. which  are  to  be used in the film and all simkey programs.
  1156. Entities may only be defined in mode 0.  This is enforced by
  1157. simply  not  allowing  the  definition commands in any other
  1158. mode.  In addition to these constraints, no  function  calls
  1159. of  any  type  are  allowed, any commands given in this mode
  1160. must be object-referenced (see command list, below) and  any
  1161. variables accessed must be object referenced (see variables,
  1162. below).
  1163.  
  1164.      Similarly, in mode 2, all variables and  commands  must
  1165. be  object-referenced  and  no  function  calls are allowed.
  1166. However, in mode  1,  object-referencing  is  optional,  and
  1167. function  calls are allowed.  The only restriction on mode 1
  1168. is that object definition commands are not allowed.
  1169.  
  1170.  
  1171. 4.2 Expressions
  1172.  
  1173. An expression is merely a series of variables,  numbers  and
  1174. operators  which  evaluates  to  a  certain value.  Usually,
  1175. expressions are enclosed in square brackets, [], since  whi-
  1176. tespace  and  round  brackets,  (),  can  be used within the
  1177. expression  itself.   However,  in  many  cases,  when   co-
  1178. ordinates  and Euler angles are being defined, three expres-
  1179. sions are gathered together, limited with  square  brackets,
  1180. but separated by commas; eg [16,32,48].
  1181.  
  1182.      Unfortunately, the interpreter's  expression  evaluater
  1183.  
  1184.  
  1185.  
  1186.                         June 1, 1993
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                            - 19 -
  1193.  
  1194.  
  1195. does  not  work  as  expected  by  the newcomer to Polyfilm.
  1196. Instead of working the expression out from the left,  taking
  1197. certain  operators  over  others, Polyfilm works out expres-
  1198. sions from the right, giving all operators  equal  priority,
  1199. so, for instance, 5 * 8 + 4 evaluates to 60 in Polyfilm, not
  1200. to 44 as expected.  To  counter  this,  brackets  should  be
  1201. used, so ( 5 * 8 ) + 4 should be used instead to achieve the
  1202. required result.
  1203.  
  1204.      Polyfilm supports many operators,  most  of  which  are
  1205. self  explanatory, for instance, the function of *, /, +, -,
  1206. <, >, <=, >=, ( and ) should be obvious.  ! is used to logi-
  1207. cally  negate  the  following value, & is used for a logical
  1208. and, and | is used for the  logical  or.   The  MCL  logical
  1209. values  are quite simple; anything over 0 gets thought of as
  1210. 1, or true, and anything less than or equal to 0 is  thought
  1211. of  as  0,  or  false.   It should be noted that although !=
  1212. could be used for an inequality check, <> is quicker,  since
  1213. it  is already programmed as a check, whereas != is the con-
  1214. catanation of two operators.
  1215.  
  1216.  
  1217. 4.3 Variables and identifiers
  1218.  
  1219. Variables (or identifiers) are strings of up to  32  charac-
  1220. ters  which  represent  either  a value, entity, function or
  1221. object type.  An identifier's type is defined by the way  in
  1222. which  it  is  declared.  For example, when an identifier is
  1223. declared in a type command, then the identifier is  of  type
  1224. type,  but  if  it is defined in an object command, it is of
  1225. type object.  However, if it is defined  on  the  left  hand
  1226. side  of  an  arithmetic  equation,  it is a variable, whose
  1227. parent object is either given by  the  variable  prefix  (eg
  1228. st.arc,  is  a  variable called arc, belonging to the object
  1229. st) or, if no prefix is given,  its  parent  object  is  the
  1230. object which is currently being interpreted (obviously, this
  1231. only applies in mode 1).
  1232.  
  1233.      To access a variable, simply include  its  name  in  an
  1234. expression, for instance the expression [arc*16] returns the
  1235. value of arc multiplied by 16 as its answer.  The  value  of
  1236. the  variable arc is taken from the currently active object.
  1237. If this is not the desired  case  of  the  variable,  simply
  1238. object-reference  the name by putting the object whose vari-
  1239. able you want to access as a prefix to  the  variable  name,
  1240. for  instance, [st.arc*16] will use the object st's variable
  1241. arc, even if st is not the current object.
  1242.  
  1243.      It should be noted that each entity has its  own  vari-
  1244. able space, and that any variables defined by one object can
  1245. be defined by another, with no  confusion,  since  they  are
  1246. totally  independent.  In order to define a variable, simply
  1247. use it as the left hand side of  an  equation,  as  in  most
  1248. languages, for example
  1249.  
  1250.  
  1251.  
  1252.                         June 1, 1993
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                            - 20 -
  1259.  
  1260.  
  1261.  
  1262.         centre_x = x - 800;
  1263.  
  1264.  
  1265.      would define a variable called centre_x for the current
  1266. object  and give it the value x - 800.  It is perfectly pos-
  1267. sible to define a variable for  a  different  object.   This
  1268. would  be  achieved  by  prefixing centre_x with the desired
  1269. object's name, as stated above.
  1270.  
  1271.      Each entity has twelve reserved variables.   These  are
  1272. given  to  allow  easy access to the current position, atti-
  1273. tude,  speed  and  angular  velocity  of  the  entity.   The
  1274. reserved variables are called; x, y, z, xs, ys, zs, a, b, c,
  1275. as, bs and cs.  These represent the x, y and z  position  of
  1276. the  object,  the  x,  y  and  z  velocity components of the
  1277. object, the alpha, beta and gamma Euler angles of the object
  1278. and  the  three  angular velocities, respectively.  Reserved
  1279. variables may be accessed and set at any time, but  remember
  1280. that  changing them is like doing a move command or a rotate
  1281. command.
  1282.  
  1283.  
  1284. 4.4 Main functions
  1285.  
  1286. As stated above, every entity must  have  a  main  function,
  1287. since  this  is  where  processing  of  the entity's program
  1288. begins.  The syntax for defining a main function is  simple;
  1289. first  the  object's name is given followed by .main[] (with
  1290. no space), and finally the actual function itself,  enclosed
  1291. within {}.  For example, a simple main function would be;
  1292.  
  1293.         st.main[] {
  1294.           rotate speed [16,0,0];
  1295.           wait;
  1296.         }
  1297.  
  1298.  
  1299.      This main function is defined for an object called  st,
  1300. which  must  have  been  previously declared.  If it has not
  1301. been declared when the interpreter comes  across  this  main
  1302. function,  then an error is given.  It is important to real-
  1303. ise that when an object  has  finished  executing  its  main
  1304. function (provided it hasn't called it; see below) then exe-
  1305. cution will restart from the beginning of the main function.
  1306. If an object finishes executing a called main function, then
  1307. control returns to just after the point where  the  function
  1308. was called, exactly as for a normal function call.
  1309.  
  1310.      Main functions can also be  called,  just  like  normal
  1311. functions  (see below).  In order to do this, simply use the
  1312. following command;
  1313.  
  1314.         st.main[];
  1315.  
  1316.  
  1317.  
  1318.                         June 1, 1993
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                            - 21 -
  1325.  
  1326.  
  1327.      The above line would make the current object  call  the
  1328. main function of object st.  When used in this way, the main
  1329. function must be object-referenced to avoid an  error,  even
  1330. if an object is calling its own main function.
  1331.  
  1332.  
  1333. 4.5 Functions and function calls
  1334.  
  1335. As in most C type languages, PMCL supports  function  calls.
  1336. However,  function  usage  is  different  to  normal  C use.
  1337. Unlike C, during a function, all of  an  object's  variables
  1338. are still accessible; there is no notion of local and global
  1339. variables.  This means that parameter  passing  is  more  or
  1340. less  pointless.  However, PMCL allows functions to have one
  1341. parameter passed to them.  Only one parameter may be  passed
  1342. (although  this  is  optional),  and this must be defined at
  1343. definition.  When the function is called,  the  value  given
  1344. will  be  loaded  into  the  variable  named in the function
  1345. header.
  1346.  
  1347.      To define a function,  simply  include  the  function's
  1348. name  in  a  line  in  the  root  program (ie not inside any
  1349. entity's program).  The function name should be followed  by
  1350. the  parameter  name,  if  any, enclosed in square brackets,
  1351. followed by the function body enclosed in {}.  If the  func-
  1352. tion  has  no  parameters, the square brackets must still be
  1353. used.  An example of a simple function follows;
  1354.  
  1355.  
  1356.         x_move [x_dest] {
  1357.           speed=10;
  1358.  
  1359.           if [x>x_dest]{
  1360.             speed=speed*-1;
  1361.           }
  1362.           while [x<>x_dest] {
  1363.             move by [10,0,0];
  1364.             frame;
  1365.           }
  1366.         }
  1367.  
  1368.  
  1369.      This function takes a single parameter, called  x_dest.
  1370. It  should  be  simple  to  see  that the function moves the
  1371. entity along in the x direction until the destination  point
  1372. is reached.  Functions like this can greatly improve program
  1373. legibility and size, since a piece of code  which  is  often
  1374. repeated can be used as a function.
  1375.  
  1376.      To call a function, it a simply a matter of  using  its
  1377. name  as a command, with and parameter value needed enclosed
  1378. in square brackets  (again,  the  square  brackets  must  be
  1379. included even if there is no parameter).  After the function
  1380. has  finished,  interpretation  continues  from  after   the
  1381.  
  1382.  
  1383.  
  1384.                         June 1, 1993
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                            - 22 -
  1391.  
  1392.  
  1393. function call as if the function call were a simple command.
  1394.  
  1395.      It should be noted that functions do not belong to  any
  1396. entity, and should not be object-referenced.
  1397.  
  1398.  
  1399. 4.6 Simkeys
  1400.  
  1401. Simkeys are defined by the simkey command, and, put  simply,
  1402. are  blocks of code which are executed when the relevant key
  1403. is pressed.  A block of simkey code cannot contain  function
  1404. calls,  frame  or  wait commands, and all commands and vari-
  1405. ables must be object-referenced.  For  more  information  on
  1406. defining  a  simkey  block  of  code,  see the command list,
  1407. below.
  1408.  
  1409.  
  1410. 4.7 Commands and keywords
  1411.  
  1412. A command is a word which  the  interpreter  recognises  and
  1413. which  tells  it to do a certain operation.  A keyword, how-
  1414. ever, is a word which elaborates on what the user wants  the
  1415. command  to do.  A keyword is usually followed by an expres-
  1416. sion telling it how much to do something, for instance,  how
  1417. far  to  move.   Often,  a  command will perform no function
  1418. unless a keyword is given.  A command  may  also  have  more
  1419. than  one  keyword.   In  this case, the keywords are inter-
  1420. preted sequentially.
  1421.  
  1422.      For some commands, it  is  possible  to  tell  Polyfilm
  1423. which object you want it to affect.  This is stated where it
  1424. is possible.  To tell the command to work on an object other
  1425. than  the  current  object,  put  the object's name directly
  1426. after the command.  For instance,
  1427.  
  1428.         rotate st to [0,0,0];
  1429.  
  1430.  
  1431.      will rotate the object called st to face in the  direc-
  1432. tion [0,0,0], no matter which object is the current object.
  1433.  
  1434.      Some commands are restricted  in  certain  modes.   For
  1435. instance,  it is impossible to declare an object in any mode
  1436. but mode 0, the initial mode.  There follows a complete list
  1437. of  all  the  commands, the keywords which are applicable to
  1438. them, a description of their effects and an example of their
  1439. use.
  1440.  
  1441.  
  1442. 4.7.1 type
  1443.  
  1444. The type command is used to load in  a  file  containing  an
  1445. object definition.  This file can then be referred to by the
  1446. name given.  The  type  command  must  be  followed  by  two
  1447.  
  1448.  
  1449.  
  1450.                         June 1, 1993
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                            - 23 -
  1457.  
  1458.  
  1459. parameters.   The  first is the name which the type is to be
  1460. called, the second is the name of the file which  is  to  be
  1461. loaded.   The  filename should include the pathname, ideally
  1462. starting with a drive name in usual ST fashion, but  failing
  1463. that,  starting  with  a  backslash, \, to indicate that the
  1464. path starts in the root directory.  The type command is res-
  1465. tricted to mode 0.
  1466.  
  1467. Example of use;
  1468.  
  1469.         type st "\data\st.3d";
  1470.  
  1471.  
  1472.  
  1473. 4.7.2 prefs
  1474.  
  1475. The prefs command is used to load in a preferences file.  It
  1476. should  be  followed by the full filename of the preferences
  1477. file to load, as for type.  Prefs is restricted  to  mode  0
  1478. only.
  1479.  
  1480. Example of use;
  1481.  
  1482.         prefs "\data\prefs_1.prf";
  1483.  
  1484.  
  1485.  
  1486. 4.7.3 object
  1487.  
  1488. The object command is used to declare objects.  Every object
  1489. must  have a type and a main function declared by the end of
  1490. the initial pass.  The type of an  object  can  be  declared
  1491. with  the  keyword  type.   The  word  directly following an
  1492. object command is taken to be the name the user  wishes  the
  1493. object to be called.  An object is not called into existence
  1494. until it is declared by the object command,  so  any  refer-
  1495. ences  made  to the object must be done so only after it has
  1496. been declared.  The object command is only allowed  in  mode
  1497. 0.
  1498.  
  1499.      The following keywords are  applicable  to  the  object
  1500. command.
  1501.  
  1502. type The type keyword must be followed by the  name  of  the
  1503.      type  which the user wants the object to be.  This key-
  1504.      word must be included in the definition of an object to
  1505.      avoid an error.
  1506.  
  1507. at   The at keyword declares the starting  position  of  the
  1508.      object.   It must be followed by a co-ordinate triplet.
  1509.      If the at keyword is omitted, the object will  be  con-
  1510.      sidered to be positioned at [0,0,0].
  1511.  
  1512. looking
  1513.  
  1514.  
  1515.  
  1516.                         June 1, 1993
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                            - 24 -
  1523.  
  1524.  
  1525.      The keyword looking declares the starting  attitude  of
  1526.      the  object.   It  must be followed by an attitude tri-
  1527.      plet.  If the looking keyword is omitted,  an  attitude
  1528.      of [0,0,0] is assumed.
  1529.  
  1530. hiddenThe hidden keyword declares the object to be hidden at
  1531.      the start of the film.  It may be omitted.
  1532.  
  1533. visible
  1534.      Visible declares the object to be visible.  The default
  1535.      state of an object when declared is visible.
  1536.  
  1537. Example of use;
  1538.  
  1539.         object obj_1 type st at [0,0,256] looking [0,0,180*16] visible;
  1540.  
  1541.  
  1542.  
  1543. 4.7.4 camera
  1544.  
  1545. The camera command is used to declare a camera.  Every  film
  1546. must have at least one camera declared.  The first camera to
  1547. be declared is automatically thought of as the active camera
  1548. unless  the  program  is told otherwise.  As for object, the
  1549. camera must be followed by the camera's name, and every cam-
  1550. era  must  have  a main function.  The use of camera is res-
  1551. tricted to mode 0.
  1552.  
  1553.      The following keywords are  applicable  to  the  camera
  1554. command.
  1555.  
  1556. at   The at keyword declares the starting  position  of  the
  1557.      camera.   It must be followed by a co-ordinate triplet.
  1558.      If the at keyword is omitted, the camera will  be  con-
  1559.      sidered to be positioned at [0,0,0].
  1560.  
  1561. looking
  1562.      The keyword looking declares the starting  attitude  of
  1563.      the  camera.   It  must be followed by an attitude tri-
  1564.      plet.  If the looking keyword is omitted,  an  attitude
  1565.      of [0,0,0] is assumed.
  1566.  
  1567. activeThe active keyword tells the program that this is  the
  1568.      camera which should be considered to be on.
  1569.  
  1570. Example of use;
  1571.  
  1572.         camera cam_1 at [0,0,-256] looking [0,0,0] active;
  1573.  
  1574.  
  1575.  
  1576. 4.7.5 lightsource
  1577.  
  1578. The lightsource command is used  to  define  a  lightsource.
  1579.  
  1580.  
  1581.  
  1582.                         June 1, 1993
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                            - 25 -
  1589.  
  1590.  
  1591. Directly  following  this  command should be the name of the
  1592. lightsource being  defined.   Lightsources  may  be  of  two
  1593. types;  parallel  and  point.   Parallel  lightsources  give
  1594. parallel rays of light, like from an far  away  lightsource.
  1595. When  declaring a parallel lightsource, an illumination vec-
  1596. tor must be given.  This vector represents the direction  of
  1597. the  light.  Parallel lightsources may not have their system
  1598. variables altered and may not be moved using a move command.
  1599. Point  lightsources  behave  as any other entity.  They give
  1600. light off from their current location  in  every  direction.
  1601. This command is restricted to mode 0.
  1602.  
  1603.      The following keywords are  applicable  to  the  light-
  1604. source command.
  1605.  
  1606. at   The at keyword declares the starting  position  of  the
  1607.      lightsource.  It must be followed by a co-ordinate tri-
  1608.      plet.  It also defines the lightsource to  be  a  point
  1609.      lightsource, and from this point on, no parallel light-
  1610.      source commands will work on it.
  1611.  
  1612. vectorThe vector keyword declares the illumination vector of
  1613.      the  lightsource.   The desired vector must be declared
  1614.      after the keyword as a triplet.  The magnitude of  this
  1615.      vector does not matter, since it is made to equal unity
  1616.      when it is interpreted.  It  also  defines  the  light-
  1617.      source  to  be a parallel lightsource.  From this point
  1618.      on, move commands will not work on this entity, and its
  1619.      system variables will be inaccessible.
  1620.  
  1621. lit  The lit keyword tells the interpreter that this  light-
  1622.      source should be the one being used.
  1623.  
  1624. Example of use;
  1625.  
  1626.         lightsource lig_1 vector [1,0,0];
  1627.  
  1628.  
  1629.  
  1630. 4.7.6 palette
  1631.  
  1632. The palette command tells the interpreter which  palette  to
  1633. use.   It  must  be  followed  by  a  number between 1 and 5
  1634. inclusive.  It can be used in any mode.
  1635.  
  1636. Example of use;
  1637.  
  1638.         palette 2;
  1639.  
  1640.  
  1641.  
  1642. 4.7.7 simkey
  1643.  
  1644. The simkey command defines a block of  code  which  will  be
  1645.  
  1646.  
  1647.  
  1648.                         June 1, 1993
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                            - 26 -
  1655.  
  1656.  
  1657. executed  upon a certain keypress.  The key in question must
  1658. be placed in quotes after the simkey command.  Following the
  1659. key comes the block of code to be executed, contained within
  1660. {}.  Within a simkey block of code there can be no  function
  1661. calls,  and  all  variables  and  commands  must  be object-
  1662. referenced.  The simkey command itself is restricted to mode
  1663. 0.  The case of the key (upper or lower) does not matter.
  1664.  
  1665. Example of use;
  1666.  
  1667.         simkey "a" {
  1668.           kick obj_1;
  1669.           kick obj_2;
  1670.         }
  1671.  
  1672.  
  1673.  
  1674. 4.7.8 rotate
  1675.  
  1676. The rotate command instructs the interpreter that a rotation
  1677. is  to  be performed.  This command can be object referenced
  1678. and can be called from any mode.
  1679.  
  1680.      The following keywords are  applicable  to  the  rotate
  1681. command.
  1682.  
  1683. by   The keyword by tells the interpreter that the following
  1684.      rotation is to be done relative to the current attitude
  1685.      of the object.  The keyword  must  be  followed  by  an
  1686.      attitude  triplet.   This  triplet is then added to the
  1687.      current attitude of the entity.
  1688.  
  1689. to   This  tells  the  interpreter  to  rotate  the   entity
  1690.      directly  to  the  given angle.  Following this keyword
  1691.      must be an attitude triplet.
  1692.  
  1693. speedThis keyword sets the angular velocities of  the  given
  1694.      entity.  The new values must be given in triplet form.
  1695.  
  1696. Example of use;
  1697.  
  1698.         rotate st speed [80,0,0];
  1699.  
  1700.  
  1701.  
  1702. 4.7.9 move
  1703.  
  1704. The move command instructs the interpreter that  a  movement
  1705. is  to  be performed.  This command can be object referenced
  1706. and can be called from any mode.
  1707.  
  1708.      The following keywords are applicable to the move  com-
  1709. mand.
  1710.  
  1711.  
  1712.  
  1713.  
  1714.                         June 1, 1993
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                            - 27 -
  1721.  
  1722.  
  1723. by   The keyword by tells the interpreter that the following
  1724.      movement is to be done relative to the current position
  1725.      of the object.  The keyword must be followed by  a  co-
  1726.      ordinate  triplet.   This  triplet is then added to the
  1727.      current position of the entity.
  1728.  
  1729. to   This tells the interpreter to move the entity  directly
  1730.      to  the given position.  Following this keyword must be
  1731.      a co-ordinate triplet.
  1732.  
  1733. speedThis keyword sets the component velocities of the given
  1734.      entity.  The new values must be given in triplet form.
  1735.  
  1736. forward
  1737.      This tells the interpreter to  move  the  given  object
  1738.      forward  by  a given amount.  The distance to move must
  1739.      be given in square brackets directly after the keyword,
  1740.      and must be one value, not a triplet.
  1741.  
  1742. backward
  1743.      This tells the interpreter to  move  the  given  object
  1744.      backwards by a given amount.  The distance to move must
  1745.      be given in square brackets directly after the keyword,
  1746.      and must be one value, not a triplet.
  1747.  
  1748. forwardspeed
  1749.      This keyword sets  the  components  velocities  of  the
  1750.      entity.   Following this keyword must be a single value
  1751.      enclosed  in  square  brackets.   This  value  is  then
  1752.      rotated  to  find the speeds to move the object to make
  1753.      it go forward by this amount.  It should be noted  that
  1754.      if the entity is rotated afterwards, the entity will no
  1755.      longer be moving forward, and this command must be done
  1756.      again.
  1757.  
  1758. backwardspeed
  1759.      This keyword sets  the  components  velocities  of  the
  1760.      entity.   Following this keyword must be a single value
  1761.      enclosed  in  square  brackets.   This  value  is  then
  1762.      rotated  to  find the speeds to move the object to make
  1763.      it go backwards by this amount.   It  should  be  noted
  1764.      that  if  the  entity is rotated afterwards, the entity
  1765.      will no longer be moving backwards,  and  this  command
  1766.      must be done again.
  1767.  
  1768. Example of use;
  1769.  
  1770.         move to [0,0,256] forwardspeed [50];
  1771.  
  1772.  
  1773.  
  1774. 4.7.10 face
  1775.  
  1776. This is similar to rotate, except that it tells the  current
  1777.  
  1778.  
  1779.  
  1780.                         June 1, 1993
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                            - 28 -
  1787.  
  1788.  
  1789. object  to  face  a  given direction.  It may not be object-
  1790. referenced, and therefore it is only available  in  mode  1.
  1791. It must be followed by an attitude triplet.
  1792.  
  1793. Example of use;
  1794.  
  1795.         face [0,0,0];
  1796.  
  1797.  
  1798.  
  1799. 4.7.11 endsim
  1800.  
  1801. The endsim command ends the simulation when  it  is  encoun-
  1802. tered.  It takes no parameters and may be used in any mode.
  1803.  
  1804. Example of use;
  1805.  
  1806.         endsim;
  1807.  
  1808.  
  1809.  
  1810. 4.7.12 frame
  1811.  
  1812. The frame command tells an entity to finish its program  for
  1813. this  frame.   It  can only be used in mode 1, and cannot be
  1814. object-referenced.
  1815.  
  1816. Example of use;
  1817.  
  1818.         frame;
  1819.  
  1820.  
  1821.  
  1822. 4.7.13 wait
  1823.  
  1824. The wait command is  a  powerful  conditional  command.   It
  1825. instructs  the  entity  to wait, acting as if it had encoun-
  1826. tered a frame  command.   It  is  followed  by  an  optional
  1827. expression  which  is  enclosed in square brackets.  If this
  1828. expression is not present, then the entity waits  for  ever.
  1829. However, if the expression is present, then the entity waits
  1830. until the expression works out to be true (the  wait  condi-
  1831. tions  are  checked  at the beginning of every frame).  This
  1832. command is restricted to mode 1.
  1833.  
  1834. Example of use;
  1835.  
  1836.         wait [x=5];
  1837.           or
  1838.         wait;
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.                         June 1, 1993
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                            - 29 -
  1853.  
  1854.  
  1855. 4.7.14 kick
  1856.  
  1857. The kick command is the only command in Polyfilm which  must
  1858. be object-referenced.  It instructs the named object to stop
  1859. its wait at the start of the next frame, whether the  condi-
  1860. tion evaluates or not.  It has no effect if the given object
  1861. is not waiting.
  1862.  
  1863. Example of use;
  1864.  
  1865.         kick obj_1;
  1866.  
  1867.  
  1868.  
  1869. 4.7.15 show
  1870.  
  1871. This command tells the given object to show itself, negating
  1872. the  effect  of a hide command.  This command may be object-
  1873. referenced and used in any mode, however, the entity  it  is
  1874. referenced  to  must  be  an  object, not a camera or light-
  1875. source.
  1876.  
  1877. Example of use;
  1878.  
  1879.         show obj_1;
  1880.  
  1881.  
  1882.  
  1883. 4.7.16 hide
  1884.  
  1885. This command tells the given object to hide itself, negating
  1886. the  effect  of a show command.  This command may be object-
  1887. referenced and used in any mode, however, the entity  it  is
  1888. referenced  to  must  be  an  object, not a camera or light-
  1889. source.
  1890.  
  1891. Example of use;
  1892.  
  1893.         hide obj_1;
  1894.  
  1895.  
  1896.  
  1897. 4.7.17 activate
  1898.  
  1899. The activate command tells the  interpreter  to  change  the
  1900. camera  in  use  to  the  given camera.  This command may be
  1901. object-referenced and used in any mode, however, the  entity
  1902. it  is  referenced  to  must  be  a camera, not an object or
  1903. lightsource.
  1904.  
  1905. Example of use;
  1906.  
  1907.         activate cam_1;
  1908.  
  1909.  
  1910.  
  1911.  
  1912.                         June 1, 1993
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                            - 30 -
  1919.  
  1920.  
  1921. 4.7.18 light
  1922.  
  1923. The light command tells the interpreter to change the light-
  1924. source in use to the given lightsource.  This command may be
  1925. object-referenced and used in any mode, however, the  entity
  1926. it  is referenced to must be a lightsource, not an object or
  1927. camera.
  1928.  
  1929. Example of use;
  1930.  
  1931.         light lig_1;
  1932.  
  1933.  
  1934.  
  1935. 4.7.19 revector
  1936.  
  1937. This command changes the vector of a  parallel  lightsource.
  1938. It  must  be  followed by the new vector.  It may be object-
  1939. referenced and used in any mode, but the object it is refer-
  1940. enced to must be a parallel lightsource.
  1941.  
  1942. Example of use;
  1943.  
  1944.         revector lig_1 [0,1,0];
  1945.  
  1946.  
  1947.  
  1948. 4.7.20 changetype
  1949.  
  1950. This command allows the changing of an  object's  type.   It
  1951. may  be  object-referenced  and  so used in any mode, but it
  1952. must be referenced to an object,  not  a  camera  or  light-
  1953. source.  The command must be followed by the name of the new
  1954. type for the object, preceeded by the keyword to.  This key-
  1955. word differs from others in that it is not optional.
  1956.  
  1957. Example of use;
  1958.  
  1959.         changetype to sphere;
  1960.  
  1961.  
  1962.  
  1963. 4.7.21 stop
  1964.  
  1965. The stop command is rather special.  Used  on  its  own,  it
  1966. stops  all movement and rotation for the given object.  How-
  1967. ever, keywords may be used to limit its effect  to  movement
  1968. or  rotation.  The command may be object-referenced and used
  1969. in any mode.
  1970.  
  1971.      The following keywords are applicable to the stop  com-
  1972. mand.
  1973.  
  1974. movement
  1975.  
  1976.  
  1977.  
  1978.                         June 1, 1993
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.                            - 31 -
  1985.  
  1986.  
  1987.      This limits the effect of the command to  stopping  the
  1988.      movement of the entity.
  1989.  
  1990. rotation
  1991.      This limits the effect of the command to  stopping  the
  1992.      rotation of the entity.
  1993.  
  1994. Example of use;
  1995.  
  1996.         stop st movement;
  1997.  
  1998.  
  1999.  
  2000. 4.7.22 colour
  2001.  
  2002. This command changes one of the colours in the palette.   It
  2003. must  be  followed  by  two values, separated by a comma and
  2004. enclosed in square brackets.  The first value is the  colour
  2005. index, and should be between 0 and 15 inclusive.  The second
  2006. value is the new RGB value.  The value of  this  is  derived
  2007. from the decimal value expression.  For instance, a value of
  2008. 342 would give a red value of 3, a blue value  of  4  and  a
  2009. green value of 2.  This value should not exceed 777, and the
  2010. separate digits should each not exceed 7.  Also, this  value
  2011. should  not  be negative.  The colour command may be used in
  2012. any mode.
  2013.  
  2014. Example of use;
  2015.  
  2016.         colour [15, new_colour*111];
  2017.  
  2018.  
  2019.  
  2020. 4.7.23 while
  2021.  
  2022. The while command works exactly the same as the one in C and
  2023. in most other languages.  It is followed first by an expres-
  2024. sion in square  brackets,  and  then  by  a  block  of  code
  2025. enclosed  in  {}.  If the expression evaluates to true, then
  2026. the block of code is executed, if not it is  skipped.   When
  2027. the  end of the block of code is used, then the condition is
  2028. tested again.  If it is  still  false,  then  the  block  is
  2029. repeated,  else it is exited.  This command is restricted to
  2030. modes 1 and 2.
  2031.  
  2032. Example of use;
  2033.  
  2034.         while [a<>180*16] {
  2035.           rotate by [16,0,0];
  2036.           frame;
  2037.         }
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.                         June 1, 1993
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.                            - 32 -
  2051.  
  2052.  
  2053. 4.7.24 if and else
  2054.  
  2055. The following two commands should be familiar to every  pro-
  2056. grammer of any degree of competence.  The if command is fol-
  2057. lowed by an expression in square brackets  and  a  block  of
  2058. code in {}.  If the expression in the brackets is true, then
  2059. the block of code is executed  once,  else  it  is  skipped.
  2060. Following the block of code for the if statement, it is pos-
  2061. sible to have an else command, followed by another block  of
  2062. code in {}.  Then, if the if expression fails, this block of
  2063. code is done once.  If the if expression evaluated to  true,
  2064. then  after  the  if code is done, the else code is skipped.
  2065. Else is entirely optional.  These commands are restricted to
  2066. modes one and two.
  2067.  
  2068. Example of use;
  2069.  
  2070.         if [a=180*16] {
  2071.           move forwardspeed [50];
  2072.         } else {
  2073.           rotate to [180*16,0,0];
  2074.         }
  2075.  
  2076.  
  2077.  
  2078. 5 The Film Control Program and CFF viewer
  2079.  
  2080. The film control program and CFF viewer enable the  user  to
  2081. watch  a  film.  The programs each operate from a form.  The
  2082. film control program form has three  toggle  buttons,  three
  2083. normal buttons and two filename buttons.  The toggle buttons
  2084. are labelled View frame build-up, Single-step and Make  CFF.
  2085. Clicking  on  these will change their settings.  Single step
  2086. forces the film to be viewed frame by frame, waiting  for  a
  2087. mouse  button  to be pressed between each frame.  View frame
  2088. build-up makes the frame be drawn  to  the  visible  screen,
  2089. rather  than  to  an  invisible one.  This has the effect of
  2090. letting the user see how the frame  was  constructed.   Make
  2091. CFF  tells the computer to make the film that is about to be
  2092. viewed into a CFF,  whose  filename  is  given  in  the  CFF
  2093. filename box.
  2094.  
  2095.      The filename buttons are green  boxes  which  show  the
  2096. current filename in them.  Initially, no filenames are shown
  2097. in these boxes.  To change the filename in the box, click on
  2098. the  box  and choose the new filename from the fileselector.
  2099. The three buttons at the bottom of the form allow  the  view
  2100. CFF  form  to be entered, the film to be viewed (and hence a
  2101. CFF made if the Make CFF button is enabled),  and  the  film
  2102. control program to be quit.
  2103.  
  2104.      When viewing a film, pressing escape ends the film  and
  2105. returns to the film control program form.
  2106.  
  2107.  
  2108.  
  2109.  
  2110.                         June 1, 1993
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                            - 33 -
  2117.  
  2118.  
  2119.      The view CFF form allows a  CFF  to  be  chosen  via  a
  2120. filename box.  When this is done, two values may be changed.
  2121. These are the playback speed of the film and whether or  not
  2122. the  film should be repeated.  The playback speed is altered
  2123. by clicking on it.  Using  the  left  button  increases  the
  2124. speed  (the  lower  the  number,  the higher the speed), and
  2125. using the right decreases the speed.  A speed of 0  is  spe-
  2126. cial;  it  makes  the  viewer  wait  for  a keypress between
  2127. frames.  Finally, two buttons at  the  bottom  of  the  form
  2128. allow  the quitting of the CFF viewer and the playing of the
  2129. CFF.
  2130.  
  2131.      When viewing a  CFF,  pressing  escape  will  quit  and
  2132. return  the  program  to the CFF viewer.  The function keys,
  2133. f1-f10, alter the playback speed of the  film  during  play.
  2134. F1 corresponds to a speed of 0, and f10 to a speed of 9.
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.                         June 1, 1993
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.                            - 34 -
  2183.  
  2184.  
  2185.                          Appendix A
  2186.  
  2187.  
  2188.                     Example MCL Program
  2189.  
  2190.  
  2191. The following example program shows how an MCL  program  may
  2192. be  written.   Line  numbers  have been added along the left
  2193. hand side of each listing to aid explanation.  If the  list-
  2194. ing is to be typed in, then the line numbers should be omit-
  2195. ted.
  2196.  
  2197.  
  2198. Simple Object Rotation
  2199.  
  2200.  
  2201.  
  2202.         1   % Two flying saucers rotating on screen
  2203.         2   % uses point light source
  2204.         3
  2205.         4   type saucer "\data\saucer.3d";
  2206.         5
  2207.         6   prefs "\data\prefs.prf";
  2208.         7   palette 1;
  2209.         8
  2210.         9   object obj1 type saucer at [200,0,500];
  2211.         10  object obj2 type saucer at [-200,0,500];
  2212.         11  camera cam1;
  2213.         12  lightsource lig1 at [0,0,250];
  2214.         13
  2215.         14  obj1.main[]{
  2216.         15    rotate speed [16,24,32];
  2217.         16    wait;
  2218.         17  }
  2219.         18  obj2.main[]{
  2220.         19    rotate speed [-16,-24,-32];
  2221.         20    wait;
  2222.         21  }
  2223.         22
  2224.         23  cam1.main[]{ wait; }
  2225.         24  lig1.main[]{ wait; }
  2226.  
  2227.  
  2228.  
  2229.  
  2230. The first two lines of the above program  are  comments  and
  2231. are  ignored  by  the interpreter.  Line 4 defines an object
  2232. type called saucer and loads  the  object  definition  whose
  2233. filename is given.  Line 6 loads in the preferences file and
  2234. line 7 defines which palette we want  to  use.   Lines  9-12
  2235. declare  all  the  entities  which are to be used during the
  2236. film.  Lines 14, 18, 23 and 24 define the main functions  of
  2237. the  entities.   All of this information is extracted during
  2238. mode 0.
  2239.  
  2240.  
  2241.  
  2242.                         June 1, 1993
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.                            - 35 -
  2249.  
  2250.  
  2251.      In mode 1, each object's program is run until either  a
  2252. wait  condition  fails  or a frame command is reached.  This
  2253. means that obj1 and obj2 both do their rotate commands, set-
  2254. ting  themselves  rotating,  and  then hit the wait command,
  2255. which makes them stop executing the program  and  wait  for-
  2256. ever.   However,  they  will  still rotate, since we set the
  2257. rotation speed.  cam1 and lig1 both immediately hit  a  wait
  2258. command, forcing them to wait forever.
  2259.  
  2260.      The result of this film is two saucers  revolving  con-
  2261. stantly.   The  only way the film will finish is if the user
  2262. presses escape while viewing it.
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.                         June 1, 1993
  2309.  
  2310.  
  2311.