/* ==== How to use this file ==== To add the Starfighter to your scene add the lines: #include "Starfighter2.inc" object {Fighter} with any rotations etc The include file contains a number of user defined variables. These variables need to be #declared before #including the Starfighter2,inc file. EngineOn [true | false] - This variable includes the engine exhaust and glow. The default is on. Angle [num] - This variable determines the angle of the two lower wings. Values between 50 and 120 are accepted. Illegal values are set to 50 if too small and 120 if too large. The default is 120. Insignia [color] - This variable sets the color of the markings on the wings and cockpit. The default is a darkish green. The Insignia.gif file can be replaced with any you choose, just make sure to name it 'insignia.gif'. Enjoy Phil Mackenzie computer@immanuelps.sa.edu.au */ #ifndef (EngineOn) #declare EngineOn = true; #end #ifndef (Angle) #declare Angle = 120; #end #ifndef (Insignia) #declare Insignia = Green/1.5; #end #if (Angle > 120) #declare Angle = 120; #end #if (Angle < 50) #declare Angle = 50; #end // ==== Texture Definitions ==== #declare EngineTex = texture { pigment {Black+(White/2)} finish {metallic reflection 0.3 phong 10 } } #declare WingTex = texture { material_map { gif "insignia.gif" map_type 1 texture { pigment {Black+(Silver/2)} finish {phong 20 reflection 0.3 metallic } } texture { pigment {Insignia} finish {phong 20 reflection 0.2 metallic } } } scale 3 } #declare GunATex = texture { pigment {Silver+(White/10)} finish {metallic phong 1 } normal {bumps 1} scale 0.025 } #declare PylonTex = texture { pigment {Black+(White/2)} finish {metallic phong 10 phong_size 4 } } #declare CockpitUnitTex = texture { material_map { gif "insignia.gif" map_type 1 texture { pigment {Black+(Silver/2)} finish {phong 20 reflection 0.3 metallic } } texture { pigment {Insignia} finish {phong 20 reflection 0.2 metallic } } } rotate z*-45 } #declare CockpitGlassTex = texture { pigment {Black transmit 0.4} finish {phong 1} } #declare CockpitGlassInt = interior { ior 1.5 } #declare FlameTex = texture { pigment { gradient y color_map { [0 Blue transmit 0.3] [0.7 SkyBlue transmit 1] } } finish {ambient 1} scale <1,2,1> } // ==== Object Definitions ==== #declare WingGun = union { lathe { linear_spline 16 <0,0><0.5,0.01><0.5,2><1,2.01> <1.5,10><0.5,11><0.5,12><1.5,13> <1.5,14><0.5,14.01><0.5,14.99><1.5,15> <1.5,16><0.5,16.01><0.5,25><0,25.01> } sphere {<0,-0.5,0>,1} scale <0.08,0.08,0.08> } #declare Level1 = 6; #declare Level2 = 4; #declare Level3 = 2; #declare Level4 = 0; #declare WingUnit = union { //Front patch bicubic_patch { type 1 flatness 0.1 u_steps 3 v_steps 3 <0,Level1,0.1><-0.5,Level1,0.1><-0.5,Level1,-0.1><0,Level1,-0.1> <-0.5,Level2,0.2><-1.5,Level2,0.3><-1.5,Level2,-0.3><-0.5,Level2,-0.2> <-1.5,Level3,0.3><-3.5,Level3,0.4><-3.5,Level3,-0.4><-1.5,Level3,-0.3> <-2.5,Level4,0.3><-5,Level4,0.4><-5,Level4,-0.4><-2.5,Level4,-0.3> } //Rear patch bicubic_patch { type 1 flatness 0.1 u_steps 3 v_steps 3 <0,Level1,0.1><0.5,Level1,0.1><0.5,Level1,-0.1><0,Level1,-0.1> <-0.5,Level2,0.2><-1,Level2,0.3><-1,Level2,-0.3><-0.5,Level2,-0.2> <-1.5,Level3,0.3><-0.5,Level3,0.4><-0.5,Level3,-0.4><-1.5,Level3,-0.3> <-2.5,Level4,0.3><0,Level4,0.4><0,Level4,-0.4><-2.5,Level4,-0.3> } object {WingGun rotate z*90 scale <1,1,4/3> translate <0.5,6,0>} scale <1,1,0.75> } #declare EngineUnit = union { difference { lathe { linear_spline 20 <0,0><0.32,0.01><0.3,0.3><0.2,0.31><0.2,0.39> <0.3,0.4><0.3,0.5><0.2,0.51><0.2,0.59><0.3,0.6> <0.3,1.1><0.2,1.11><0.2,1.19><0.3,1.2><0.3,1.3> <0.2,1.31><0.2,1.39><0.3,1.4><0.2,1.7><0,1.71> } cylinder {<0,-1,0><0,5,0>0.19} } cone {<0,1.8,0>0<0,1.1,0>0.15} #if (EngineOn = true) cone {0,0.2,<0,-2,0>0 texture {FlameTex} no_shadow } light_source {<0,0.25,0> Blue} light_source {<0,0.9,0> Red*10} #end scale <1.5,1.7,1.5> rotate z*90 translate <-0.8,2,0> } #declare Wing = union { difference { object {WingUnit} cylinder {<-5,2,0><5,2,0>0.25} } object {EngineUnit texture {EngineTex}} texture {WingTex} } #declare GunA = union { difference { cone {<0,0,0>0.1<0,-0.2,0>0 scale <1,1,0.25> } plane {y,-0.15} } cylinder {<0.2,-0.15,0><-0.4,-0.15,0>0.01} texture {GunATex} scale 2.5 translate <-6,-0.5,0> } #declare CockpitUnit = union { difference { sphere {0,0.75} sphere {0,0.73} box {<-1,1,-1><0,0,1> rotate z*15} texture {CockpitUnitTex} } intersection { difference { sphere {0,0.75} sphere {0,0.73} } box {<-1,1,-1><0,0,1> rotate z*15} texture {CockpitGlassTex} interior {CockpitGlassInt} } scale <1.5,0.8,0.8> translate <-6,0,0> } #declare Cockpit = union { object {CockpitUnit} #local Count = 0; #while (Count < 4) cylinder {<-5,0.2,0><-3,0,0>0.15 rotate x*Count*90 texture {PylonTex}} #local Count = Count + 1; #end object {GunA rotate x*45} object {GunA rotate x*-45} } #declare Fighter = union { object {Wing} object {Wing rotate x*Angle} object {Wing rotate x*-Angle} object {Cockpit} }