home *** CD-ROM | disk | FTP | other *** search
/ ANews 3 / AnewsCD3.iso / atari / GRAPHX / POV / 68030.060 / POV31G30 / POVRAY_3.1G / SCENES / MACROS / MACRO2.POV < prev    next >
Text File  |  1999-10-30  |  1KB  |  51 lines

  1. // Persistence of Vision Ray Tracer POV-Ray 3.1 Sample Scene
  2. // by Chris Young
  3. // MACRO2.POV demonstrates basic use of a macro to modify an 
  4. // identifier parameter, not just do something based upon the 
  5. // parameter.  Defines a macro called Turn_Me which takes 
  6. // an object identifier and re-declares it turned a specified
  7. // amount about a particular axis. The result is passed back
  8. // through the parameter.
  9.  
  10. #include "colors.inc"
  11.  
  12. light_source { <1000,1000,-1000>, White}
  13.  
  14. camera { location <3,3,-10> direction 2*z look_at <0,0,0>}
  15.  
  16. union { 
  17.  plane{y,-2} plane{-z,-10} plane{x,-10}
  18.  pigment{checker Cyan,Yellow}
  19. }
  20.  
  21. // Define the macro.  Parameters are:
  22. //   Stuff:    The stuff to be rotated.  This identifier is
  23. //             actually re-declared and the new object is passed
  24. //             back to the calling module.
  25. //   Degrees:  Number of degrees to rotate
  26. //   Axis:     The axis about which we'll rotate
  27. #macro Turn_Me(Stuff,Degrees,Axis)
  28.     #declare Stuff=object{Stuff rotate Axis*Degrees}
  29. #end
  30.  
  31. #declare Thing = cone{0,1/2,y,0}
  32.  
  33. object{Thing               // Display the original Thing
  34.   pigment{rgb<1,0,0>}
  35.   translate -2.25*x
  36. }
  37.  
  38. Turn_Me(Thing,-90,x)       // Turn -90 about x
  39.  
  40. object{Thing               // Thing was changed by Turn_Me
  41.   pigment{rgb<0,1,1>}
  42. }
  43.  
  44. Turn_Me(Thing,-90,y)       // Turn -90 about y
  45.  
  46. object{Thing               // Thing was changed again
  47.   pigment{rgb<1,1,0>}
  48.   translate 2.25*x
  49. }
  50.  
  51.