#include "colors.inc"
#include "shapes.inc"
#include "textures.inc"
#include "metals.inc"
#include "glass.inc"
#include "ynkelonium_texture.pov"
#include "T_BlackMetal.pov"

#include "Hypertrop.pov"

#declare Hull = 
difference {
    union {
	difference {
	    sphere { <0,0,0>, 100
	    }
	    cone {
		<0, -10, 0>, 101, 
		<0, +10, 0>, 101
	    }
	}
	union {
	    torus {
		98.5, 1
	    }
	    cone {
		<0, -1, 0>, 98.5
		<0,  1, 0>, 98.5
	    }
	    translate <0, -10, 0>
	}

	union {
	    torus {
		98.5, 1
	    }
	    cone {
		<0, -1, 0>, 98.5
		<0,  1, 0>, 98.5
	    }
	    translate <0, +10, 0>
	}

    }

    // obere Hangars

    #declare i = 0
    #while (i < 360) 
	superellipsoid {
	    <0.25, 0.25>
	    scale <17, 8.5, 25>
	    translate <0, 41.5, 80>
	    rotate <0, i, 0>
	}
	#declare i = i + 45
    #end

    // Mannschleusen

    #declare i = 0
    #while (i < 360) 
	superellipsoid {
	    <0.25, 0.25>
	    scale <4, 2, 4>
	    translate <0, -40, 92>
	    rotate <0, i, 0>
	}
	#declare i = i + 45
    #end

    // untere Hangars

    #declare i = 0
    #while (i < 360) 
	superellipsoid {
	    <0.25, 0.25>
	    scale <10, 5, 25>
	    translate <0, -64, 65>
	    rotate <0, i, 0>
	}
	#declare i = i + 45
    #end

    object {
	Hypertrop_Neg
	translate <0, -100, 0>
    }

    // Deck 16 und Panoramafenster
    intersection {
	sphere {
	    <0, 0, 0> 98.5
	}
	cone {
	    <0, 79, 0>, 98.5
	    <0, 89, 0>, 98.5
	}
	texture {
	    pigment {
		color White
	    }
	}
    }
	
    #declare i = 0
    #while (i < 360)
	#declare j = 10
	#while (j <= 50)
	    cone {
		<0, 80, 58>, 1
		<0, 80, 62>, 1
		rotate <0, i+j, 0>
	    }
	    #declare j = j + 5
	#end
	#declare i = i + 60
    #end

    texture {
	Ynkelonium_Texture
    }

}


#include "Hangar_Schotts.pov"

#declare Urwa = 
    difference {
	intersection {
	    cone {
		<-6, 0, 22>, 24
		<+6, 0, 22>, 24
		texture { pigment { color White }}
	    }
	    box {
		<-5.99, -11, -2>
		< 5.99,  11, 10>
		texture { pigment { color Blue }}
	    }
	}
	#declare i = 0
	#while (i < 5)
	    prism {
		conic_sweep
		linear_spline
		0.5 1
		5
		<-3, -0.5>, <-0.5, -0.5>, <-0.5, 0.5>, <-3, 0.5>, <-3, -0.5>
		scale <1, 4, 1>
		rotate <-90, 0, 0>
		translate <0, i * 1.5 - 6, 2>
		texture { pigment { color Red }}
	    }
	    prism {
		conic_sweep
		linear_spline
		0.5 1
		5
		<5, -0.5>, <0.5, -0.5>, <0.5, 0.5>, <5, 0.5>, <5, -0.5>
		scale <1, 4, 1>
		rotate <-90, 0, 0>
		translate <0, i * 1.5 - 6, 2>
		texture { pigment { color Green }}
	    }
	    #declare i = i + 1
	#end
    }

#declare Vhs_pol =
	blob {
	    threshold 0.65
	    cylinder {
		<0, -8, 0>, <0, 8, 0>, 2.5, 1
	    }
	    cylinder {
		<0, -3, -1>, <0, 5, 0>, 2.5, 1
	    }
	    cylinder {
		<0, -3, -2>, <0, -3, 0>, 2.5, 1
	    }
	    texture { pigment { color White }}
	}

#declare Vhs = 
    union {
	object {
	    Vhs_pol
	    scale <1, 1, 2>
	    translate <-7.5, 0, 0>
	}
	object {
	    Vhs_pol
	    scale <1, 1, 3>
	    translate <-2.5, 0, 0>
	}
	object {
	    Vhs_pol
	    scale <1, 1, 3>
	    translate <2.5, 0, 0>
	}
	object {
	    Vhs_pol
	    scale <1, 1, 2>
	    translate <7.5, 0, 0>
	}
	box {
	    <-12, -10, 0>, <12, 10, 1>
	    texture { pigment { color 0.2 * White }}
	}

    }
    

#declare Prallfeldprojektor = 
    union {
	superellipsoid {
	    <0.25, 0.25>
	    scale <2, 8, 4>
	    translate <-10, 0, 0>
	    texture { pigment { color Yellow }}
	}
	superellipsoid {
	    <0.25, 0.25>
	    scale <2, 8, 4>
	    translate <10, 0, 0>
	    texture { pigment { color Yellow }}
	}
	superellipsoid {
	    <0.25, 0.25>
	    scale <6, 8, 4>
	    translate <0, 0, 0>
	    texture { pigment { color Yellow }}
	}
	cone {
	    <-10, 6, -2>, 2
	    < 10, 6, -2>, 2
	    texture { T_BlackMetal }
	}
	cone {
	    <-10, 2, -2>, 2
	    < 10, 2, -2>, 2
	    texture { T_BlackMetal }
	}
	cone {
	    <-10, -2, -2>, 2
	    < 10, -2, -2>, 2
	    texture { T_BlackMetal }
	}
	cone {
	    <-10, -6, -2>, 2
	    < 10, -6, -2>, 2
	    texture { T_BlackMetal }
	}
    }

#declare GJ1 =
    union {
	cone {
	    <0, 0, 4>, 4,
	    <0, 6, 4>, 4
	    texture { pigment { color Green }}
	}
	cone {
	    <-4, 2, 1>, 1
	    <+4, 2, 1>, 1
	}
	difference {
	    cone {
		<0, 2, -2>, 2
		<0, 2,  2>, 1
	    }
	    cone {
		<0, 2, -2.01>, 1.95
		<0, 2,  2>, 0.90
	    }
	}
	sphere {
	    <0, 2, -1>, 1.4
	}
	texture { pigment { color 1 * White }}
    }

#declare GJ2 =
    union {
	difference {
	    box {
		<-12, 4, 0.01>, <12, 8, 4>
	    }
	    cone {
		<-10, 4, 0>, 2
		<-10, 4, 4>, 2
	    }
	    cone {
		<+10, 4, 0>, 2
		<+10, 4, 4>, 2
	    }
	    box {
		<-10, 2, 0>, <10, 6, 4>
	    }
	}
	box {
	    <-12, 8, 0.01>, <12, 10, 4>
	    texture { T_BlackMetal}
	}
	texture { pigment { color 1 * Yellow }}
    }

#declare GJ3 =
    union {
	difference {
	    cone {
		<0, 10, 2>, 2
		<0, 20, -3.0>, 3.6
		texture { T_Winebottle_Glass }
	    }
	    cone {
		<0, 10, 2>, 1.7
		<0, 20.1, -3.0>, 3.4
		texture { T_Winebottle_Glass }
	    }
	    cone {
		<-4, 22, -10>, 10
		< 4, 22, -10>, 10
		texture { pigment { color 1 * Blue }}
	    }
	}
	sphere {
	    <0, 0, 0>, 1
	    scale <2, 1, 2>
	    translate <2, 14, -4>
	    texture { pigment { color 1 * Yellow }}
	}
	sphere {
	    <0, 0, 0>, 1
	    scale <2, 1, 2>
	    translate <-2, 14, -4>
	    texture { pigment { color 1 * Yellow }}
	}
	sphere {
	    <0, 0, 0>, 1
	    scale <1, 2, 1>
	    rotate <-26.5, 0, 0>
	    translate <0, 15, -0.5>
	    texture { pigment { color 1 * Yellow }}
	}
    }

#declare Gravojet = 
    union {
//	box {
//	    <-12, 3, 0>, <12, 20, 4>
//	    texture { pigment { color 0.2 * White }}
//	}
	object {
	    GJ1
	    translate <-8, 0, 0>
	}
	object {
	    GJ1
	    translate < 0, 0, 0>
	}
	object {
	    GJ1
	    translate <+8, 0, 0>
	}
	object {
	    GJ2
	}
	object {
	    GJ3
	}
    }

#declare Paratron = 
union {
    superellipsoid {
	<0.5, 0.1>
	scale <6, 3, 0.5>
	texture { pigment { color 1 * Yellow }}
    }
    cone {
	<-3, 0, -2>,2,
	<-3, 0, 2>,2
	texture { T_BlackMetal }
    }
    cone {
	<+3, 0, -2>,2,
	<+3, 0, 2>,2
	texture { T_BlackMetal }
    }
}

#declare Strut_Ext = 1

#include "strut.pov"

#include "Hyperfunk.pov"

#include "../tfk/tfk1.pov"
#include "Impulsgeschuetz.pov"
#include "Traktorstrahler.pov"

#declare star = 
union {
    object {
	Hull
    }
    #declare i = 0
    #while (i < 360) 
	object {
	    Urwa
	    translate <0, 0, -100>
	    rotate <0, i, 0>
	}
    	#declare i = i + 20
    #end

    #declare i = 10
    #while (i < 360) 
	object {
	    Vhs
	    translate <0, 0, -95>
	    rotate <0, i, 0>
	}
    	#declare i = i + 60
    #end

    #declare i = 30
    #while (i < 360) 
	object {
	    Prallfeldprojektor
	    translate <0, 0, -95>
	    rotate <0, i, 0>
	}
    	#declare i = i + 60
    #end

    #declare i = 50
    #while (i < 360) 
	object {
	    Gravojet
	    translate <0, -10, -100>
	    rotate <0, i, 0>
	}
    	#declare i = i + 60
    #end

    #declare i = 0
    #while (i < 360) 
	object {
	    Paratron
	    translate <0, 0, -100>
	    rotate <13.6, 0, 0>
	    rotate <0, i, 0>
	}
	object {
	    Paratron
	    translate <0, 0, -100>
	    rotate <-13.6, 0, 0>
	    rotate <0, i, 0>
	}
    	#declare i = i + 20
    #end

    #declare i = 0
    #while (i < 360) 
	object {
	    Strut
	    translate <0, -96, 34>
	    rotate <0, i, 0>
	}
    	#declare i = i + 60
    #end

    object {
	Hangar_Schotts
    }

    object {
	Hypertrop
	translate <0, -100, 0>
    }

    union {
	difference {
	    cone {
		<0, -90, 25>, 3
		<0, -105, 25>, 3
	    }
	    cone {
		<0, -90, 25>, 2.8
		<0, -105, 25>, 2.8
	    }
	    texture {
		Ynkelonium_Texture
	    }
	}
	cone {
	    <0, -109.5, 25>, 3
	    <0, -109.7, 25>, 3
	    texture {
		Ynkelonium_Texture
	    }
	}
	cone {
	    <0, -105.0, 25+2.9>, 0.1
	    <0, -109.5, 25+2.9>, 0.1
	    texture { pigment { color Yellow }}
	}
	cone {
	    <0, -105.0, 25-2.9>, 0.1
	    <0, -109.5, 25-2.9>, 0.1
	    texture { pigment { color Yellow }}
	}
	cone {
	    <-2.9, -105.0, 25>, 0.1
	    <-2.9, -109.5, 25>, 0.1
	    texture { pigment { color Yellow }}
	}
	cone {
	    <+2.9, -105.0, 25>, 0.1
	    <+2.9, -109.5, 25>, 0.1
	    texture { pigment { color Yellow }}
	}
    }
    object {
	Hyperfunk
	translate <0, 100, 0>
    }
    union {
	sphere {
	    <0, 0, 0>, 1
	    texture { pigment { color Yellow }}
	    scale <1, 2, 0.5>
	    translate <0, 92, 40>
	}
	sphere {
	    <0, 0, 0>, 1
	    texture { pigment { color Yellow }}
	    scale <1, 2, 0.5>
	    translate <0, 92, 40>
	    rotate <0, 120, 0>
	}
	sphere {
	    <0, 0, 0>, 1
	    texture { pigment { color Yellow }}
	    scale <1, 2, 0.5>
	    translate <0, 92, 40>
	    rotate <0, -120, 0>
	}
    }
    //#declare G_y 85
    //#declare G_r 52
    #declare G_y = 80
    #declare G_r = 60

    object {
	TFK1
	translate <0, G_y, G_r>
    }
    object {
	TFK1
	translate <0, G_y, G_r>
	rotate <0, 120, 0>
    }
    object {
	TFK1
	translate <0, G_y, G_r>
	rotate <0, 240, 0>
    }
    object {
	Impulsgeschuetz
	translate <0, G_y, G_r>
	rotate <0, 60, 0>
    }
    object {
	Impulsgeschuetz
	translate <0, G_y, G_r>
	rotate <0, 180, 0>
    }
    object {
	Impulsgeschuetz
	translate <0, G_y, G_r>
	rotate <0, 300, 0>
    }
    #declare i = 0
    #while (i < 360)
	object {
	    Impulsgeschuetz
	    scale <0.4, 0.4, 0.6>
	    translate <0, -50, 86>
	    rotate <0, i, 0>
	}
	#declare i = i + 45
    #end
    light_source {
	<0, 88, 0>
	color White
    }

    // Traktorstrahler

    #declare i = 20
    #while (i < 360) 
	object {
	    Traktorstrahler
	    translate <0, 0, 99.5>
	    rotate <36, i, 0>
	    rotate <0, i, 0>
	}
	#declare i = i + 45
    #end


    translate <0, 110, 0>
}

