home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / animate / thresh / movesph3.pi < prev    next >
Encoding:
Text File  |  1994-12-31  |  1.9 KB  |  75 lines

  1. // Static variable demo - blob components bounce off the sides of a box
  2. // Polyray input file: Alexander Enzmann
  3. start_frame 0
  4. end_frame 300
  5.  
  6. // Set up the camera
  7. viewpoint {
  8.    from <0,10,-20>
  9.    at <0, 0, 0>
  10.    up <0,1,0>
  11.    angle 18
  12.    resolution 320, 160
  13.    aspect 2
  14.    }
  15.  
  16. background <0, 0, 0>
  17. light <-10, 10, -20>
  18. include "..\..\colors.inc"
  19.  
  20. // Dimensions of the box that things rattle around in
  21. define box_width 5
  22. define box_height 5
  23. define box_thick 0.05
  24.  
  25. // Size of randomness added to velocity after a bounce off a wall
  26. define rscale 0.05
  27. define rbounce rscale * brownian(<0, 0, 0>, 1)[0]
  28.  
  29. // Size of the ball
  30. define sphrad 0.5
  31.  
  32. // Size of the walls to the enclosing area
  33. define wall_wid 1
  34. define wall_height 0.5
  35.  
  36. /* Change position from frame to frame bouncing off the walls of a box */
  37.  
  38. // Make the reflection calculations a little easier
  39. define bwidth box_width - sphrad
  40. define bheight box_height - sphrad
  41.  
  42. // Include the file that calculates the blob component positions
  43. include "blbmv.inc"
  44.  
  45. static define pos0 <px0, sphrad+box_thick, py0>
  46. static define pos1 <px1, sphrad+box_thick, py1>
  47. static define pos2 <px2, sphrad+box_thick, py2>
  48. static define pos3 <px3, sphrad+box_thick, py3>
  49. static define pos4 <px4, sphrad+box_thick, py4>
  50.  
  51. // Moving, and bouncing blob components
  52. object {
  53.    blob 0.5:
  54.       sphere pos0, 1, 2*sphrad,
  55.       sphere pos1, 1, 2*sphrad,
  56.       sphere pos2, 1, 2*sphrad,
  57.       sphere pos3, 1, 2*sphrad,
  58.       sphere pos4, 1, 2*sphrad
  59.    shiny_red
  60.    }
  61.  
  62. // Boundary box
  63. define wid0 box_width + wall_wid
  64. object {
  65.      object {
  66.     box <-wid0, 0.0, -wid0>, <wid0, wall_height, wid0>
  67.     texture { special shiny { color white_marble_map[marble_fn] } }
  68.     }
  69.    - object {
  70.         box <-box_width, box_thick, -box_width>,
  71.         < box_width, wall_height+0.1, box_width>
  72.     texture { /* matte */ reflective { color aquamarine } }
  73.     }
  74.    }
  75.