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 / tutorial6.art < prev    next >
Encoding:
Text File  |  1991-10-31  |  2.9 KB  |  127 lines

  1. !---------------------------------------------------------------
  2. !
  3. ! TUTORIAL6 - RayDance tutorial script #6.
  4. !
  5. ! This script demonstrates points, polygons, autopoint polygons,
  6. ! and polygon holes.
  7. !
  8. ! Concepts include :
  9. !
  10. !  o Creating a polygon using previously declared points.
  11. !
  12. !  o Printing the location of points
  13. !
  14. !  o Creating a polygon using autopoint mode.
  15. !
  16. !  o Creating a polygon with holes in it.
  17. !
  18. !  o Using vector arithmetic to locate a polygon
  19. !
  20. !  o A bullseye ground pattern
  21. !
  22. !---------------------------------------------------------------
  23.  
  24. ! Use a print statement to display descriptive text on the
  25. ! message window.
  26.  
  27.  
  28. ? "TUTORIAL6 - This script creates a number of polygons some\n",
  29.   "of which have holes.\n\n";
  30.  
  31. ! Define colors for this scene
  32.  
  33. RED    : COLOR ( RGB, [1,0,0] );
  34. GREEN  : COLOR ( RGB, [0,1,0] );
  35. CYAN   : COLOR ( RGB, [0,1,1] );
  36. BLUE   : COLOR ( RGB, [0,0,1] );
  37. YELLOW : COLOR ( RGB, [1,1,0] );
  38.  
  39.  
  40. ! All objects have non-glossy surfaces.
  41.  
  42. !                      ka kd ks n  km kr ir kb flags
  43. MATTE : SURFACE(PHONG, 1, 1, 0, 0, 0, 0, 0, 0, 0 );
  44.  
  45.  
  46. ! Define where the polygons will go
  47.  
  48. vector POLYPOS1 = [-550,200,400],
  49.        POLYPOS2 = [0, 100,300],
  50.        POLYPOS3 = [550,250,350];
  51.  
  52. ! Create some points
  53.  
  54. POINT  p1 = [-200,0,-100] + POLYPOS1,
  55.        p2 = [-300,0,200] + POLYPOS1,
  56.        p3 = [250,0,270] + POLYPOS1,
  57.        p4 = [240,0,-120] + POLYPOS1;
  58.  
  59.  
  60. ! Create a polygon based on the previously setup points.
  61.  
  62. POLYGON( p1, p2, p3, p4, RED, MATTE, 0 );
  63.  
  64.  
  65. ! Create a similar polygon but use auto point creation.  The
  66. ! polygon vertices are vector values preceded by an @ character.
  67.  
  68. POLYGON( @[-200,0,-100] + POLYPOS2,
  69.          @[-300,0,200] + POLYPOS2,
  70.          @[250,0,270] + POLYPOS2,
  71.          @[240,0,-120] + POLYPOS2,
  72.          GREEN, MATTE, 0 );
  73.  
  74.  
  75. ! Create another polygon but make some holes in it.  There will
  76. ! be one circular hole and one polygonal hole
  77.  
  78. HOLE1 : HOLE( CIRCLE, [-20,0,100]+POLYPOS3, 50 );
  79.  
  80. HOLE2 : HOLE( POLYGON,
  81.          @[-25,0,-18] + POLYPOS3 + [30,0,20],
  82.          @[-35,0,30] + POLYPOS3 + [30,0,20],
  83.          @[29,0,29] + POLYPOS3 + [30,0,20],
  84.          @[28,0,-17] + POLYPOS3 + [30,0,20] );
  85.  
  86. POLYGON( @[-200,0,-100] + POLYPOS3,
  87.          @[-300,0,200] + POLYPOS3,
  88.          @[250,0,270] + POLYPOS3,
  89.          @[240,0,-120] + POLYPOS3,
  90.          CYAN, MATTE, 0, HOLE1, HOLE2 );
  91.  
  92.  
  93. ! Specify the ambient light.
  94.  
  95. AMBIENT( [0,0,0], [0.6,0.6,0.6], [0,0,1], 0, 0 );
  96.  
  97. ! Specify the STAR light.
  98.  
  99. STAR( [2000,-5000,4000], [1,.9,1], 300 );
  100.  
  101.  
  102. ! Set the background color to a dark purple
  103.  
  104. BACKGROUND( PLAIN, [0,0.05,0.15] );
  105.  
  106.  
  107. ! Make the ground plane.  This time we'll use a bullseye pattern
  108.  
  109. GROUND( BULLSEYE, 0, 200, BLUE, MATTE, YELLOW, MATTE );
  110.  
  111.  
  112. ! The camera will be positioned along the negative y axis
  113. ! looking at the second polygon's position
  114.  
  115. CAMERA'POS = [0,-2500,550];
  116. CAMERA'TARGET = POLYPOS2;
  117.  
  118.  
  119. ! The scene has now been constructed, render it!
  120.  
  121. RENDER;
  122.  
  123.  
  124. ! All scripts must terminate with an END
  125.  
  126. END
  127.