!---------------------------------------------------------------
!
! TUTORIAL9 - RayDance tutorial script #9.
!
! This script demonstrates the extrude statement.
!
! Concepts include :
!
!  o Creating a solid extrusions.
!
!  o Using the BEVEL extrusion flag.
!
!  o Algorithmic outline creation
!
!---------------------------------------------------------------

! Use a print statement to display descriptive text on the
! message window.


? "TUTORIAL9 - This script creates 3 boxes using the extrude\n",
  "statement.  The blue box has no top or bottom.  The green\n",
  "box has both top and bottom.  The brown box has beveled\n",
  "edges around the top and bottom.\n";


! Variables

integer  SEGMENTS = 64;     ! # of steps around lathed objects
vector   SCALING = [1,1,1]; ! Full size



! Create colors for our objects

BLUE   : color(RGB, [0,0,.7] );
GREEN  : color(RGB, [.1,.6,0] );
ORANGE : color(RGB, [.6,.3,0] );

! Make up a surface for our objects

!                       ka kd ks  n km kr ir kb flgs
MATTE  : surface(PHONG, .5,.8, 0, 0, 0, 0, 0, 0, 0 );
SHINY  : surface(PHONG, .5,.8,.4,30, 0, 0, 0, 0, 0 );


! Create the outlines we're going to extrude.


! The outline for our boxes

BOX_OUTLINE : outline[4] = (
  [-100,-100,0], [-100,100,0], [100,100,0], [100,-100,0]
);

!  EXTRUDE( <corner list>, <extrude len>, <extrude dir>, <scale>,
!    <position>, <rot angles>, <color>, <surf>, <flags> );

! Create "box" extrusion with out ends.

extrude( ( BOX_OUTLINE ),
  200, [0,0,1], [1,1,1], [-350,0,0], [0,0,60],
  BLUE, MATTE, NOENDS );


! Create "box" extrusion with ends.

extrude( ( BOX_OUTLINE ),
  200, [0,0,1], [1,1,1], [0,0,0], [0,0,45],
  GREEN, MATTE, 0 );


! Create "box" extrusion with beveled ends

extrude( ( BOX_OUTLINE ),
  200, [0,0,1], [1,1,1], [350,0,0], [0,0,30],
  ORANGE, SHINY, BEVEL PHONG );


! Specify the ambient light.

AMBIENT( [0,0,0], [0.6,0.6,0.6], [0,0,1], 0, 0 );

! Specify the STAR light.

STAR( [40000,-50000,60000], [1,.9,1], 300 );


! Set the background color to a dark purple

BACKGROUND( PLAIN, [0,0.05,0.15] );


! The camera will be positioned along the negative y axis aiming
! toward the central objects

CAMERA'POS = [0,-1300,800];
CAMERA'TARGET = [0,0,100];


! The scene has now been constructed, render it!

RENDER;


! All scripts must terminate with an END

END
