#include "colors.inc"
#include "zerg.pov"
#include "metals.inc"
#include "zerg2.pov"
#include "battleship"
#include "tunnel.pov"
camera{
location <0,0,-10>
look_at <0,2.5,0>
}

//light_source{<0,0,-10>,White}
#declare explosion=
union{
#declare Density1=
  density {
    spherical
    ramp_wave  
    color_map {
      [0.0 color rgb <0.0, 0.0, 0.0>]
      [0.05 color rgb <0.5,0.5,0.0>]
      [0.25 color rgb <1,0,0>]
      [0.3 color rgb <1,1,0>]
      [0.31 color rgb <1,0,0>]
      [0.4 color rgb <1.0, .5, 0.0>]
      [1.0 color rgb <1.0, 1.0, 0>]
    } 
  }

#declare Density2=
  density {
    spherical
    ramp_wave
    color_map {
      [0.0 color rgbt <0.0, 0.0, 0.0,1>]
      [0.2 color rgb <1.0, .5, 0.3>]
      [1.0 color rgb <1.0, 1.0, 0>]
    } 
  }

sphere { 0, 2.5
  pigment { color rgbf<1, 1, 1, 1> }
  finish { ambient 0 diffuse 0 }
  interior { 
    media {
      emission 1
      intervals 5
      samples 1, 50
      confidence 0.9999
      variance 1/1000
      density {
        gradient x
        density_map {
          [0.5 Density1]
          //[0.5 Density2]
        }
     turbulence 2
        //frequency 1.5
          }
    }
  #declare r1=seed(1)
  #declare countf=0
  #declare counte=0
        #while (countf<10)
        #while (counte<10)
                media{
                emission 1
                intervals 5
                samples 1,20
                confidence 0.9999
                variance 1/1000
                density{
                gradient x
                density_map{
                [0.5 Density2]}
                }
                scale .1
                translate <-1-rand(r1),0,0>
                rotate 36*y*counte
                rotate 36*x*countf
            } 
#declare counte=counte+1
#end 
#declare countf=countf+1
#declare counte=0
#end
  
  }

  scale .5
  hollow 
}
}//End explosion union
   
  
  
union{
object{battleship rotate 200*y translate <-3,5,5>}
object{battleship rotate 180*y translate <0,0,20> rotate 20*y translate <-3,5,5>}
object{explosion scale 5 rotate 180*y translate <0,0,20> rotate 20*y translate <-3,5,5>}
light_source{<0,0,0>,Orange shadowless
fade_distance 20
fade_power 4
translate <5,-1,20> rotate 20*y translate <-3,5,5>} 

#declare counte=0
#declare r1=seed(1)
union{
#while (counte<100)
        object{creep_tailless scale .1 translate <(-(counte/5)*rand(r1))-rand(r1),0,0> rotate 360*rand(r1) translate <0,0,(counte)>}
        //object{creep_tailless scale .1 rotate 20*y translate <-3-(rand(r1)*(2-(counte/5))),5-(rand(r1)*(2-(counte/5))),7+(counte)>}
        
        #declare counte=counte+(.5-((counte/100)*.4));
#end
rotate 20*y
translate <-3,5,7>
}        
//translate <-3,3,0>
}//end exploding ship n stuff
//Start Super Swarm
#declare counte=0
#declare r1=seed(1)
union{      
#while (counte<100)
        object{creep_tailless scale .1 rotate 45*y translate <-10*rand(r1),0,0> rotate -90*y*rand(r1) rotate 90*x*((rand(r1)-.5)) translate <rand(r1),0,10-((counte/6)*(counte/100))>}
        object{creep_tailless scale .1 rotate 45*y translate <10*rand(r1),0,0> rotate 90*y*rand(r1) rotate 90*x*((rand(r1)-.5)) translate <rand(r1),0,10-((counte/6)*(counte/100))>}
        
        
        
        #declare counte=counte+.1;
#end
rotate 20*y
translate <-3,5,7>
}        

#declare counte=0
#while (counte<7)
        object{battleship rotate 20*x*rand(r1) rotate -20*z*rand(r1) rotate 180*y translate <-10*rand(r1),5*rand(r1),(20*rand(r1))>}                        
        object{battleship rotate 20*x*rand(r1) rotate -20*z*rand(r1) rotate 180*y translate <10*rand(r1),5*rand(r1),(20*rand(r1))>}                                                 
        object{explosion scale 2.5*rand(r1) rotate 180*y*rand(r1) translate <10-(20*rand(r1)),5*rand(r1),(20*rand(r1))>}
        object{explosion scale 2.5*rand(r1) rotate 180*y*rand(r1) translate <10-(20*rand(r1)),5*rand(r1),(20*rand(r1))>}
                #declare counte=counte+1
#end        
                         
                         
                         
                         
//PASTED STUFFFF





union{
difference{
object{battleship}
#declare counte =0
#while (counte<5)
box{<-.05-(.025*rand(r1)),-1,.05-(.025*rand(r1))> <.05-(.025*rand(r1)),1,-.05-(.025*rand(r1))> rotate (360*rand(r1))*y translate <0,0,-1>}
#declare counte=counte+1
#end
#declare counte =0
#while (counte<5)
box{<-.05-(.025*rand(r1)),-1,.05-(.025*rand(r1))> <.05-(.025*rand(r1)),1,-.05-(.025*rand(r1))> rotate (360*rand(r1))*y translate <-.05,0,.5>}
#declare counte=counte+1
#end
#declare counte =0
#while (counte<5)
box{<-.05-(.025*rand(r1)),-1,.05-(.025*rand(r1))> <.05-(.025*rand(r1)),1,-.05-(.025*rand(r1))> rotate (360*rand(r1))*y translate <.1,0,.35>}
#declare counte=counte+1
#end

rotate 40*x
rotate -20*z
rotate 180*y scale 1 translate <1,1,-5.5>}


object{creep scale .17 rotate 90*y rotate 90*z translate <0,-.5,-1>
rotate 40*x
rotate -20*z
rotate 180*y
translate <1,1,-5.5>
}
/*light_source{<0,.5,-1>,White
rotate 40*x
rotate -20*z
rotate 180*y
translate <1,1.5,-5.5>
fade_distance 1.0
fade_power 4
} */
object{creep scale .17 rotate 90*y rotate -90*z translate <-.05,.7,.5>
rotate 40*x
rotate -20*z
rotate 180*y
translate <1,1,-5.5>
}
object{creep scale .17 rotate 90*y rotate -90*z translate <.1,.2,.35>
rotate 40*x
rotate -20*z
rotate 180*y
translate <1,1,-5.5>
}

translate <1,0,0>
}
union{
object{battleship}
//cylinder{<-.5,0,10.5> <-.5,0,-.1>,.001 pigment{color Red} finish {ambient 1}
scale <1,1,1>
translate <-.05,0,0>
rotate 5*z

rotate 20*x
rotate -20*z
rotate 180*y scale 1 translate <0,0,-7.5>
}

//difference{
object{creep scale .17 rotate 90*y rotate -80*z rotate 40*y rotate -20*x translate <.6,.1,-8>}
/*cylinder{<-.5,0,10.5> <-.5,0,-.1>,.1 pigment{color Red} finish {ambient 1}
scale <1,.01,1>
translate <-.05,0,0>
rotate 5*z
}
}*/
#declare counte=0
blob{
threshold 0.6
#while (counte<100)
        sphere { <(rand(r1)-.5)*rand(r1),(rand(r1)-.5)*rand(r1),(rand(r1)-.5)*rand(r1)>, .05*rand(r1), 1 translate <.6,-.1,-8>}
        #declare counte=counte+1
#end
pigment{color rgbt<1,0,0,.8>}
finish {phong .5}
}        

light_source{<-5,1,-5>,White
fade_distance 6
fade_power 4
}
                                 
                                 

#declare clocke=.75
object{explosion
scale .5
translate <0,.2,-1>
rotate 40*x
rotate -20*z
rotate 180*y
translate <2,1,-5.5>}

#declare clocke=.5
object{explosion
scale .5
translate <-.2,.1,.5>
rotate 40*x
rotate -20*z
rotate 180*y
translate <2,1,-5.5>}

#declare clocke=.85;
object{explosion
scale .75
translate <.1,.1,.35>
rotate 40*x
rotate -20*z
rotate 180*y
translate <2,1,-5.5>}



#declare counte=0 ;

#declare Density2=
  density {
    spherical
    ramp_wave
    color_map {
      [0.0 color rgbt <0.0, 0.0, 0.0,1>]
      [0.2 color rgb <0.0, .2, 1>]
      [1.0 color rgb <1.0, 1.0, 1.0>]
    } 
  }

#declare beam=
 
sphere { 0, 1
  pigment { color rgbf<1, 1, 1, 1> }
  finish { ambient 0 diffuse 0 }
  interior { 
             media{
                emission 1
                intervals 5
                samples 1,10
                confidence 0.9999
                variance 1/1000
                density{
                gradient x
                density_map{
                [0.5 Density2]}
                }
                scale 1
                translate <1,0,0>
            } 
            }
            hollow
            scale <7,.1,.1>
            rotate 90*y
            }
  
    


/*
union{
sphere{0,1
pigment { color rgbt <1, 1, 1, 1> }
    interior
    media
     {
      emitting
      spherical_mapping
      turbulence .5
      linear
      density{
      color_map {
        [ 0 color rgbt <0, .2, 1, 1> ]
        [ 1 color rgbt <1, 1, 1, 0> ]
      }
      samples 10
translate <.95,0,0>
    }
    hollow
scale <7,.1,.1>
//translate <-2.5,0,-2>
rotate 90*y
}


}//End Beam Union*/

#declare counte=0;
#while (counte<36)
object{beam translate <-1,2.5,- rand(r1)*7> rotate counte*10*z+(rand(r1)*2.5) }
#declare counte=counte+.35;
#end
                                 