home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 May / PCWorld_2000-05_cd.bin / Software / TemaCD / povray / povwin3.exe / %MAINDIR% / scenes / macros / macro1.pov < prev    next >
Encoding:
Text File  |  2000-04-06  |  1.3 KB  |  50 lines

  1. // Persistence of Vision Ray Tracer POV-Ray 3.1 Sample Scene
  2. // by Chris Young
  3. // MACRO1.POV demonstrates basic use of a macro.  Defines
  4. // a macro called Make_Many which takes an object and
  5. // makes many copies of it rotated about a particular axis.
  6.  
  7. #include "colors.inc"
  8.  
  9. light_source { <1000,1000,-1000>, White}
  10.  
  11. camera { location <3,3,-10> direction 2*z look_at <0,0,0>}
  12.  
  13. union { 
  14.  plane{y,-2} plane{-z,-10} plane{x,-10}
  15.  pigment{checker Cyan,Yellow}
  16. }
  17.  
  18. // Define the macro.  Parameters are:
  19. //   Stuff:    The stuff to be multiplied and rotated
  20. //   How_Many: Number of copies to make
  21. //   Axis:     The axis about which we'll rotate the copies.
  22. #macro Make_Many (Stuff,How_Many,Axis)
  23.   #local Count=0;   // this identifier is local and 
  24.                     // temporary to this macro
  25.   #while (Count<How_Many)
  26.     object{Stuff rotate Axis*Count*(360/How_Many)}
  27.     #local Count=Count+1;
  28.   #end
  29. #end
  30.  
  31. #declare Thing = cylinder{0,x,0.1}
  32.  
  33. union {
  34.   Make_Many (Thing,4,z)  // Make 4 things rotated about z
  35.   pigment{Red}
  36.   translate -2.25*x
  37. }
  38.  
  39. union {
  40.   Make_Many (Thing,6,z)  // Make 6 things rotated about z
  41.   pigment{Blue}
  42. }
  43.  
  44. union {
  45.   Make_Many (Thing,6,y)  // Make 6 things rotated about y
  46.   pigment{Green}
  47.   translate 2.25*x
  48. }
  49.  
  50.