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

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