home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / graphics / raydance.lzh / demo_scripts.lha / tutorial10.art < prev    next >
Encoding:
Text File  |  1991-10-20  |  2.1 KB  |  100 lines

  1. !---------------------------------------------------------------
  2. !
  3. ! TUTORIAL10 - RayDance tutorial script #10.
  4. !
  5. ! This script demonstrates the extrude statement.
  6. !
  7. ! Concepts include :
  8. !
  9. !  o Creating a sheet extrusion.
  10. !
  11. !  o Algorithmic outline creation
  12. !
  13. !  o PHONG smoothing of the extrusion
  14. !
  15. !---------------------------------------------------------------
  16.  
  17. ! Use a print statement to display descriptive text on the
  18. ! message window.
  19.  
  20.  
  21. ? "TUTORIAL10 - This script creates two extruded 'flag'\n",
  22.   "objects.  Both are extruded from the same outline.  The\n",
  23.   "outlines vertices are calculated to form a sine wave.\n",
  24.   "The blue 'flag' is NOT phong smoothed.  The orange 'flag'\n",
  25.   "is phong smoothed.\n";
  26.  
  27.  
  28. ! Create colors for our objects
  29.  
  30. BLUE   : color(RGB, [0,0,.7] );
  31. ORANGE : color(RGB, [.6,.3,0] );
  32.  
  33. ! Make up a surface for our objects
  34.  
  35. !                       ka kd ks  n km kr ir kb flgs
  36. SHINY  : surface(PHONG, .5,.8,.4,30, 0, 0, 0, 0, 0 );
  37.  
  38.  
  39.  
  40. ! Creat the outline for our "flags".  We declare the outline
  41. ! first then calculate the points for it.  The flag will be
  42. ! based on a sine curve showing 3 cycles.
  43.  
  44. FLAG_OUTLINE : outline[20];
  45.  
  46. integer  K;
  47.  
  48. real     DEGREES_PER_CYCLE = 360,
  49.          NUM_CYCLES = 3.0,
  50.          AMPLITUDE = 100;
  51.  
  52. ! Step through the outline calculating positions for each corner
  53.  
  54. K = 0;
  55. while (K < 20) {
  56.   FLAG_OUTLINE[k] =
  57.     [k*40, AMPLITUDE*sin(K*DEGREES_PER_CYCLE*NUM_CYCLES/19.0),0];
  58.   K = K + 1;
  59. }
  60.  
  61. extrude( ( FLAG_OUTLINE ),
  62.   200, [0,0,200], [1,1,1], [-400,0,25], [0,0,0],
  63.   BLUE, SHINY, OPEN NOENDS );
  64.  
  65. extrude( ( FLAG_OUTLINE ),
  66.   200, [0,0,200], [1,1,1], [-400,0,-225], [0,0,0],
  67.   ORANGE, SHINY, OPEN NOENDS PHONG );
  68.  
  69.  
  70.  
  71. ! Specify the ambient light.
  72.  
  73. AMBIENT( [0,0,0], [0.6,0.6,0.6], [0,0,1], 0, 0 );
  74.  
  75. ! Specify the STAR light.
  76.  
  77. STAR( [3000,-50000,10000], [1,.9,1], 300 );
  78.  
  79.  
  80. ! Set the background color to a dark purple
  81.  
  82. BACKGROUND( PLAIN, [0,0.05,0.15] );
  83.  
  84.  
  85. ! The camera will be positioned along the negative y axis aiming
  86. ! toward the central objects
  87.  
  88. CAMERA'POS = [0,-1500,-300];
  89. CAMERA'TARGET = [0,0,0];
  90.  
  91.  
  92. ! The scene has now been constructed, render it!
  93.  
  94. RENDER;
  95.  
  96.  
  97. ! All scripts must terminate with an END
  98.  
  99. END
  100.