home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / EXPLODE.ZIP / GLASS.POV < prev    next >
Encoding:
Text File  |  1997-03-10  |  2.1 KB  |  65 lines

  1. // OBJECT EXPLODER: BREAKING GLASS ANIMATION
  2. // *****************************************
  3. // This animation shows an empty wineglass being smashed on a tiled
  4. // floor.
  5.  
  6. // CAMERA AND LIGHTS
  7.    camera {location <-20, 30, -50> look_at <0, 5, 0> angle 40}
  8.    light_source {<30, 150, -150> rgb <.7, .5, .5>}
  9.    light_source {<-50, 300, 100> rgb <.5, .6, .8>}
  10.  
  11. // SCENE DEFINITIONS
  12.    #declare Glass = union {
  13.       disc {<0, 0, 0>, y, 3}
  14.       cone {<0, 0, 0>, 3, <0, 1, 0>, .5 open}
  15.       cylinder {<0, 1, 0>, <0, 10, 0>, .5 open}
  16.       sphere {<0, 0, 0>, 1
  17.          scale <4, 5, 4> translate <0, 15, 0>
  18.          clipped_by {box {<-4.5, 10, -4.5>, <4.5, 18, 4.5>}}}
  19.       pigment {rgbf <1, 1, 1, .6>}
  20.       finish {specular .6 roughness .05 refraction 1 ior 1.04 caustics 1}}
  21.       
  22.    #declare Tiled = slope_map {
  23.       [0 <0, 1>]   [.05 <1, 1>]  [.05 <1, 0>]
  24.       [.95 <1, 0>] [.95 <1, -1>] [1 <0, -1>]}
  25.  
  26. // TILED FLOOR
  27.    plane {y, 0
  28.       pigment {checker rgb <1, 1, 1>, rgb <.7, .7, .7> scale 10}
  29.       normal {average normal_map {
  30.          [1 gradient x 1 slope_map {Tiled}]
  31.          [1 gradient z 1 slope_map {Tiled}]}
  32.          scale 10}
  33.       finish {phong .2 phong_size 2}}
  34.  
  35.    #declare explode_object = object {Glass rotate z * 80 translate <9, 4, 0>}
  36.  
  37. // THROW WINEGLASS AT THE FLOOR
  38.    #switch (clock)
  39.       #range (0, .4)
  40.          object {explode_object translate <6, 20, 0> * (.4 - clock) * 2.5}
  41.          #break
  42.  
  43. // EXPLOSION PARAMETERS
  44.    #else
  45.       #declare explode_clock = (clock - .4) * 1.7 * 4
  46.       #declare object_corner1 = <-9, 0, -4>
  47.       #declare object_corner2 = <9, 8, 4>
  48.       #declare particle_res = <4, 3, 2>
  49.       #declare exp_location = <0, 4, 0>
  50.       #declare exp_strength = 5
  51.       #declare exp_gravity = 5
  52.       #declare exp_spin = .5
  53.       #declare ground_plane = true
  54.       #declare ground_reflection = 0
  55.       #declare exp_turb = 1
  56.       #declare scale_turb = .6
  57.       #declare rotate_turb = .4
  58.       #declare vel_turb = .5
  59.       #declare dir_turb = .1
  60.       #declare spin_turb = .4
  61.  
  62. // CREATE SMASHING WINEGLASS
  63.       #include "Explode.inc"
  64.    #end
  65.