home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / animate / ufo / ufo1.inc < prev    next >
Encoding:
Text File  |  1994-12-31  |  4.2 KB  |  142 lines

  1. // Definitions for a single UFO.  File by Alexander Enzmann
  2. define UFO_Body_Size <5, 5, 5>
  3.  
  4. define UFO_Bounding_Scale <51, 41, 51>
  5.  
  6. // Define the length of the barrel of the guns.
  7. define Gun_Length 10
  8.  
  9. define Gun_Assembly_Location1 <0, -20, 0>
  10. define Gun_Assembly_Location2 <0,  20, 0>
  11.  
  12. // Define the locations of the two turrets on the gun.
  13. define Gun_Location1 <-10, 0, 0>
  14. define Gun_Location2 < 10, 0, 0>
  15.  
  16. // Define the location of the end of the barrel
  17. define Barrel_Tip <0, 10, 0>
  18.  
  19. // Vary the length and width of the blast flame for a good blasting effect.
  20. define Blast_Length 10
  21. define Blast_Width 2.5
  22.  
  23. // Define the size of the chamber of the gun.
  24. define Gun_Body_Size 3
  25.  
  26. // Define the size of the rod connecting the two barrels
  27. define Gun_Rod_Connector_Size 2
  28. define Transverse_Rod_Length 14
  29. define Mounting_Rod_Length 20
  30.  
  31. // Define the size of the blast flame coming out of the barrel
  32. define Gun_Blast_Scale <2, 0.4, 0.4>
  33. define Gun_Blast_Offset <0, 11, 0>
  34.  
  35. // Very useful shape - used in this case to model the blast flame right
  36. //  as a shot is fired.
  37. define Piriform
  38. object {
  39.    polynomial 4*(x^4 - x^3) + y^2 + z^2
  40.    bounding_box <0, -1, -1>, <1, 1, 1>
  41.    shading_flags 32
  42.    }
  43.  
  44. // Define a finite cylinder - this is useful for making rods of various
  45. // lengths and widths using simple scaling.  This rod has length 1 and
  46. // width 1.  The axis of the rod is along the Y-Axis.
  47. define Rod
  48. object {
  49.    object { cylinder <0, 0, 0>, <0, 1, 0>, 1 }
  50.    + object { disc <0, 0, 0>, <0, -1, 0>, 1 }
  51.    + object { disc <0, 1, 0>, <0, 1, 0>, 1 }
  52.    }
  53.  
  54. define Ground_Texture
  55. texture {
  56.    special matte {
  57.       color color_map([0.0, 0.8, <0.8, 0.4, 0.2>, <1, 0.2, 0.4>]
  58.               [0.8, 1.0, <1, 0.2, 0.4>, <0.8, 0.4, 0.2>])[marble_fn]
  59.       }
  60.    scale <50, 50, 50>
  61.    }
  62.  
  63. define Gun_Blast_Texture
  64. texture { surface { color <1, 0.7, 0.3> ambient 1 diffuse 0 } }
  65.  
  66. // Define a gun barrel
  67. define Gun_Barrel
  68. object {
  69.    object { cylinder <0, 0, 0>, <0, 10, 0>, 1 }
  70.    + object { cylinder <0, 0, 0>, <0, 10, 0>, 0.6 }
  71.    + object { disc <0, 0, 0>, <0, -1, 0>, 0.6, 1 }
  72.    + object { disc <0, 10, 0>, <0, 1, 0>, 0.6, 1 }
  73.    }
  74.  
  75. define Gun_Body
  76. object { sphere <0, 0, 0>, Gun_Body_Size }
  77.  
  78. // Define the color of the gun blast
  79. define Gun_Blast
  80. Piriform {
  81.    rotate <0, 0, -90>
  82.    scale <Blast_Width, Blast_Length, Blast_Width>
  83.    translate <0, Blast_Length, 0>
  84.    Gun_Blast_Texture
  85.    translate Barrel_Tip
  86.    }
  87.  
  88. // The connecting frame for the guns is composed of two cylinders at
  89. //  right angles, joined by a sphere.
  90. define Gun_Connecting_Frame
  91. object {
  92.    // Transverse rod connecting the bodies of the two barrels }
  93.    Rod {
  94.       translate <0, -0.5, 0>
  95.       scale <1, Transverse_Rod_Length, 1>
  96.       rotate <0, 0, 90>
  97.       }
  98.     // Central connector from transverse rod to mounting rod }
  99.     + object { sphere <0, 0, 0>, Gun_Rod_Connector_Size }
  100.     Gun_Texture
  101.     }
  102.  
  103. define Gun
  104. object {
  105.      Gun_Body { Gun_Texture }
  106.    + Gun_Barrel { Gun_Texture }
  107.    // + Gun_Blast { Gun_Blast_Texture }
  108.    }
  109.  
  110. // Define the entire gun pod.  Two barrels, a cylinder connecting them,
  111. // a sphere at the center of the cylinder for rotary control, and a cylinder
  112. // extending up for a control rod.
  113. define Gun_Barrels
  114. object {
  115.    // Place the two barrels of the gun }
  116.      Gun { translate Gun_Location1 }
  117.    + Gun { translate Gun_Location2 }
  118.    // Transverse rod connecting the bodies of the two barrels
  119.    + Rod {
  120.       translate <0, -0.5, 0>
  121.       scale <1, Transverse_Rod_Length, 1>
  122.       rotate <0, 0, 90>
  123.       Gun_Texture
  124.       }
  125.    // Central connector from transverse rod to mounting rod
  126.    + object { sphere <0, 0, 0>, Gun_Rod_Connector_Size Gun_Texture }
  127.    }
  128.  
  129. // Make UFO
  130. define UFO_Body
  131. object {
  132.    // The main body of the UFO is made of scaled spheres.
  133.      object { sphere <0, 0, 0>, 1 scale <10, 1, 10>
  134.           scale UFO_Body_Size Body_Tex1 }
  135.    + object { sphere <0, 0, 0>, 1 scale <5, 2, 5>
  136.           scale UFO_Body_Size Body_Tex2 }
  137.    + object { sphere <0, 0, 0>, 1 scale <3, 3, 3>
  138.           scale UFO_Body_Size Gun_Texture }
  139.    // Mounting rod for the gun barrels.
  140.    + Rod { scale <1, Mounting_Rod_Length, 1> Gun_Texture }
  141.    }
  142.