home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / animate / thresh / movesph4.pi < prev    next >
Encoding:
Text File  |  1994-12-31  |  2.4 KB  |  90 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 200
  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 "blbmv2.inc"
  44.  
  45. // Only define the complicated texture the first time...
  46. if (frame == start_frame)
  47.    include "blbmvtx.inc"
  48.  
  49. static define pos0 <px0, sphrad+box_thick, py0>
  50. static define pos1 <px1, sphrad+box_thick, py1>
  51. static define pos2 <px2, sphrad+box_thick, py2>
  52. static define pos3 <px3, sphrad+box_thick, py3>
  53. static define pos4 <px4, sphrad+box_thick, py4>
  54. static define pos5 <px5, sphrad+box_thick, py5>
  55. static define pos6 <px6, sphrad+box_thick, py6>
  56. static define pos7 <px7, sphrad+box_thick, py7>
  57. static define pos8 <px8, sphrad+box_thick, py8>
  58. static define pos9 <px9, sphrad+box_thick, py9>
  59.  
  60. // Moving, and bouncing blob components
  61. object {
  62.    blob 0.5:
  63.       sphere pos0, 1, 2*sphrad,
  64.       sphere pos1, 1, 2*sphrad,
  65.       sphere pos2, 1, 2*sphrad,
  66.       sphere pos3, 1, 2*sphrad,
  67.       sphere pos4, 1, 2*sphrad,
  68.       sphere pos5, 1, 2*sphrad,
  69.       sphere pos6, 1, 2*sphrad,
  70.       sphere pos7, 1, 2*sphrad,
  71.       sphere pos8, 1, 2*sphrad,
  72.       sphere pos9, 1, 2*sphrad
  73.    shiny_red
  74.    }
  75.  
  76. // Boundary box
  77. define wid0 box_width + wall_wid
  78. object {
  79.      object {
  80.     box <-wid0, 0.0, -wid0>, <wid0, wall_height, wid0>
  81.     // texture { special shiny { color white_marble_map[marble_fn] } }
  82.     Stone24
  83.     }
  84.    - object {
  85.         box <-box_width, box_thick, -box_width>,
  86.         < box_width, wall_height+0.1, box_width>
  87.     texture { /* matte */ reflective { color aquamarine } }
  88.     }
  89.    }
  90.