home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / 3d / irit / scripts / animball.irt < prev    next >
Encoding:
Text File  |  1995-02-20  |  5.9 KB  |  218 lines

  1. #
  2. # Simple animation demo
  3. #
  4. #            Zvika Zilberman and Haggay Dagan
  5. #
  6.  
  7. save_mat = view_mat;
  8. save_res = resolution;
  9.  
  10. view_mat = view_mat * sc( 0.1 );
  11. viewobj( view_mat );
  12.  
  13. a = sphere( vector(  0.99, 0, 0 ), 1.0 );
  14. b = sphere( vector( -0.99, 0, 0 ), 1.0 );
  15.  
  16. pt0 =  ctlpt( e3,  0.0,  0.0, 0.0 );
  17. pt1 =  ctlpt( e3,  1.0,  1.0, 0.0 );
  18. pt2 =  ctlpt( e3,  2.0,  2.0, 0.0 );
  19. pt4 =  ctlpt( e3,  4.0,  4.0, 0.0 );
  20. pt5 =  ctlpt( e3, -1.0, -1.0, 0.0 );
  21. pt6 =  ctlpt( e3, -2.0, -2.0, 0.0 );
  22. pt7 =  ctlpt( e3, -4.0, -4.0, 0.0 );
  23. pt8 =  ctlpt( e3,  0.4,  0.4, 0.0 );
  24. pt9 =  ctlpt( e3,  2.0,  2.0, 0.0 );
  25. pt11 = ctlpt( e2,  3.0,  3.0 );
  26. pt12 = ctlpt( e2, -3.0, -3.0 );
  27. pt13 = ctlpt( e2,  1.5,  1.5 );
  28. pt14 = ctlpt( e2, -1.5, -1.5 );
  29. pt15 = ctlpt( e2,  3.6,  3.6 );
  30. pt16 = ctlpt( e2, -0.9, -0.9 );
  31. pt17 = ctlpt( e2, -3.6, -3.6 );
  32. pt18 = ctlpt( e2,  0.9,  0.9 );
  33.  
  34. mov_x   = creparam( cbezier( list( pt0, pt1, pt2, pt4, pt2, pt1, pt0 ) ),
  35.                     0.0, 2.0 );
  36. scl_x   = creparam( cbezier( list( pt1, pt8, pt1 ) ), 2.0, 3.0 );
  37. scl_y   = creparam( cbezier( list( pt1, pt9, pt1 ) ), 2.0, 3.0 );
  38. visible = creparam( cbezier( list( pt11, pt14 ) ), 0.0, 4.5 );
  39. attrib( a, "animation", list( visible, mov_x, scl_x, scl_y ) );
  40. color( a, magenta );
  41.  
  42. free( mov_x );
  43. free( scl_x );
  44.  
  45. mov_x = creparam( cbezier( list( pt0, pt5, pt6, pt7, pt6, pt5, pt0 ) ),
  46.                   0.0, 2.0 );
  47. scl_x = creparam( cbezier( list( pt1, pt8, pt1 ) ), 2.0, 3.0 );
  48. attrib( b, "animation", list( visible, mov_x, scl_x, scl_y ) );
  49. color( b, magenta );
  50.  
  51. ball = list( a, b );
  52.  
  53. free( mov_x );
  54. free( scl_x );
  55. free( scl_y );
  56. free( visible );
  57. free( a );
  58. free( b );
  59.  
  60. a = sphere( vector(  0.99, 0, 0 ), 1.0 );
  61. b = sphere( vector( -0.99, 0, 0 ), 1.0 );
  62.  
  63. mov_x = creparam( cbezier( list( pt0, pt1, pt2, pt1, pt0 ) ), 3.0, 4.5 );
  64. visible = creparam( cbezier( list( pt12, pt13 ) ), 0.0, 4.5 );
  65. attrib( a, "animation", list( visible, mov_x ) );
  66. color( a, magenta );
  67.  
  68. free( mov_x );
  69.  
  70. mov_x = creparam( cbezier( list( pt0, pt5, pt6, pt5, pt0 ) ), 3.0, 4.5 );
  71. attrib( b, "animation", list( visible, mov_x ) );
  72. color( b, magenta );
  73.  
  74. balla = list( a, b );
  75.  
  76. free( mov_x );
  77. free( visible );
  78. free( a );
  79. free( b );
  80.  
  81. a = sphere( vector(  0.99, 2.5, 0 ), 1.0 );
  82. b = sphere( vector( -0.99, 2.5, 0 ), 1.0 );
  83. mov_x = creparam( cbezier( list( pt0, pt1, pt2, pt4, pt2, pt1, pt0 ) ), 0.6, 2.6 );
  84. scl_x = creparam( cbezier( list( pt1, pt8, pt1 ) ), 2.6, 3.6 );
  85. scl_y = creparam( cbezier( list( pt1, pt9, pt1 ) ), 2.6, 3.6 );
  86. visible = creparam( cbezier( list( pt15, pt16 ) ), 0.0, 4.5 );
  87. attrib( a, "animation", list( mov_x, scl_x, scl_y, visible ) );
  88. color( a, blue );
  89.  
  90. free( mov_x );
  91. free( scl_x );
  92.  
  93. mov_x = creparam( cbezier( list( pt0, pt5, pt6, pt7, pt6, pt5, pt0 ) ), 0.6, 2.6 );
  94. scl_x = creparam( cbezier( list( pt1, pt8, pt1 ) ), 2.6, 3.6 );
  95. attrib( b, "animation", list( mov_x, scl_x, scl_y, visible ) );
  96. color( b, blue );
  97.  
  98. ball1 = list( a, b );
  99.  
  100. free( mov_x );
  101. free( scl_x );
  102. free( scl_y );
  103. free( visible );
  104. free( a );
  105. free( b );
  106.  
  107. a = sphere( vector(  0.99, 2.5, 0 ), 1.0 );
  108. b = sphere( vector( -0.99, 2.5, 0 ), 1.0 );
  109. mov_x = creparam( cbezier( list( pt0, pt1, pt2, pt1, pt0 ) ), 0.6, 2.6 );
  110. visible = creparam( cbezier( list( pt17, pt18 ) ), 0.0, 4.5 );
  111. attrib( a, "animation", list( mov_x, visible ) );
  112. color( a, blue );
  113.  
  114. free( mov_x );
  115.  
  116. mov_x = creparam( cbezier( list( pt0, pt5, pt6, pt5, pt0 ) ), 0.6, 2.6 );
  117. attrib( b, "animation", list( mov_x, visible ) );
  118. color( b, blue );
  119.  
  120. ball1a = list( a, b );
  121.  
  122. free( mov_x );
  123. free( visible );
  124. free( a );
  125. free( b );
  126.  
  127.  
  128. a = sphere( vector(  0.99, -2.5, 0 ), 1.0 );
  129. b = sphere( vector( -0.99, -2.5, 0 ), 1.0 );
  130. mov_x = creparam( cbezier( list( pt0, pt1, pt2, pt4, pt2, pt1, pt0 ) ), 0.6, 2.6 );
  131. scl_x = creparam( cbezier( list( pt1, pt8, pt1 ) ), 2.6, 3.6 );
  132. scl_y = creparam( cbezier( list( pt1, pt9, pt1 ) ), 2.6, 3.6 );
  133. attrib( a, "animation", list( mov_x, scl_x, scl_y ) );
  134. color( a, red );
  135.  
  136. free( mov_x );
  137. free( scl_x );
  138.  
  139. mov_x = creparam( cbezier( list( pt0, pt5, pt6, pt7, pt6, pt5, pt0 ) ), 0.6, 2.6 );
  140. scl_x = creparam( cbezier( list( pt1, pt8, pt1 ) ), 2.6, 3.6 );
  141. attrib( b, "animation", list( mov_x, scl_x, scl_y ) );
  142. color( b, red );
  143.  
  144. ball2 = list( a, b );
  145.  
  146. free( mov_x );
  147. free( scl_x );
  148. free( scl_y );
  149. free( a );
  150. free( b );
  151.  
  152.  
  153. a = sphere( vector( 0.99, 5.0, 0 ), 1.0 );
  154. b = sphere( vector( -0.99, 5.0, 0 ), 1.0 );
  155. mov_x = creparam( cbezier( list( pt0, pt1, pt2, pt4, pt2, pt1, pt0 ) ), 1.5, 3.5 );
  156. scl_x = creparam( cbezier( list( pt1, pt8, pt1 ) ), 3.5, 4.5 );
  157. scl_y = creparam( cbezier( list( pt1, pt9, pt1 ) ), 3.5, 4.5 );
  158. attrib( a, "animation", list( mov_x, scl_x, scl_y ) );
  159. color( a, yellow );
  160.  
  161. free( mov_x );
  162. free( scl_x );
  163.  
  164. mov_x = creparam( cbezier( list( pt0, pt5, pt6, pt7, pt6, pt5, pt0 ) ), 1.5, 3.5 );
  165. scl_x = creparam( cbezier( list( pt1, pt8, pt1 ) ), 3.5, 4.5 );
  166. attrib( b, "animation", list( mov_x, scl_x, scl_y ) );
  167. color( b, yellow );
  168.  
  169. ball3 = list( a, b );
  170.  
  171. free( mov_x );
  172. free( scl_x );
  173. free( scl_y );
  174. free( a );
  175. free( b );
  176.  
  177. a = sphere( vector(  0.99, -5.0, 0 ), 1.0 );
  178. b = sphere( vector( -0.99, -5.0, 0 ), 1.0 );
  179. mov_x = creparam( cbezier( list( pt0, pt1, pt2, pt4, pt2, pt1, pt0 ) ), 1.5, 3.5 );
  180. scl_x = creparam( cbezier( list( pt1, pt8, pt1 ) ), 3.5, 4.5 );
  181. scl_y = creparam( cbezier( list( pt1, pt9, pt1 ) ), 3.5, 4.5 );
  182. attrib( a, "animation", list( mov_x, scl_x, scl_y ) );
  183. color( a, green );
  184.  
  185. free( mov_x );
  186. free( scl_x );
  187.  
  188. mov_x = creparam( cbezier( list( pt0, pt5, pt6, pt7, pt6, pt5, pt0 ) ), 1.5, 3.5 );
  189. scl_x = creparam( cbezier( list( pt1, pt8, pt1 ) ), 3.5, 4.5 );
  190. attrib( b, "animation", list( mov_x, scl_x, scl_y ) );
  191. color( b, green );
  192.  
  193. ball4 = list( a, b );
  194.  
  195. free( mov_x );
  196. free( scl_x );
  197. free( scl_y );
  198. free( a );
  199. free( b );
  200.  
  201. demo = list( ball, balla, ball1, ball1a, ball2, ball3, ball4 );
  202. attrib( demo, "refract", 1.4 );
  203. attrib( demo, "specpow", 1.5 );
  204.  
  205. interact( demo );
  206. viewanim( 0, 4.5, 0.05 );
  207.  
  208. save( "animball", demo );
  209.  
  210. free( ball );
  211. free( ball1 );
  212. free( ball2 );
  213. free( ball3 );
  214. free( ball4 );
  215. free( demo );
  216. resolution = save_res;
  217. view_mat = save_mat;
  218.