home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / povray3a / POV3Demo / Recurse / pov / Sponge3 < prev   
Text File  |  1996-01-16  |  2KB  |  50 lines

  1. // Persistence Of Vision raytracer version 3.0 sample file.
  2. // File by Steve Demlow
  3. // Recursive Menger Sponge demo #3
  4.  
  5. // Recursively defines a Menger sponge.  The recursion is done by recursively
  6. // including sponge3.inc.  Since there is no notion of private data, the state
  7. // of all data must be restored to its original calling value when a level of
  8. // recursion is finished.
  9. //
  10. // This implementation starts with a single cube and differences (subtracts)
  11. // away the "holes" of the sponge.  It recurses over a 2D area and uses the
  12. // location variables (X and Y) as (X,Y), (X,Z), and (Y,Z) pairs to position
  13. // the holes that are punched along each axis of the sponge.  This parses
  14. // faster than sponge1.inc and sponge2.inc but renders slower since the
  15. // automatic bounding doesn't work nearly as well on the larger primitives
  16. // used here.
  17.  
  18. #version 3.0
  19. global_settings { assumed_gamma 2.2 }
  20. background { color red 0 green 0 blue 1 }
  21.  
  22. camera {
  23.     location <1.75,0.9,1>
  24.     direction <0,1.5,0>
  25.     up <0,1,0>
  26.     look_at <0,-0.1,0>
  27. } // camera
  28.  
  29. light_source { <6, 2, 3> color rgb 0.9 }
  30.  
  31. // Define "parameters" for the Menger sponge "function"
  32.  
  33. #declare SpongeTxt = texture { pigment { color green 1.0 } }
  34. #declare SpongeX = 0
  35. #declare SpongeY = 0
  36. #declare SpongeDim = 1.0
  37. #declare SpongeLevel = 3 // Controls recursion depth, & hence sponge complexity
  38. #declare SpongeCounter = 0
  39.  
  40. // Make top-level "call" to recursive sponge generator
  41.  
  42. difference {
  43.     box { -SpongeDim * 0.5,SpongeDim * 0.5 }
  44. #   include "sponge3.inc"
  45.     texture { SpongeTxt }
  46. }
  47.  
  48. #debug concat("\nRendering sponge with ", str(SpongeCounter,1,0),
  49.     " primitives...\n")
  50.