// Last edited on 2003-11-27 01:49:50 by stolfi
// F.bŽórmula zero by Carlos Camolesi 
// Last edited 18/09/03
// -------------------------------------------

#include "colors.inc"
#declare PI = 3.1415928;

background{ color rgb < 1.00, 1.00, 1.00 > } 


light_source {
  < 10.00, 0.00, 0.00 >
  color rgb < 1.00, 1.00, 1.00 >
} 

#declare ctr = < 0.00, 0.00, 0.00 >;
#declare camDir = < 20.00, 0.00, 0.00 >;

camera {
  location   ctr + 1.00*camDir
  right      1.20*x
  up         0.90*y
  sky        z
  look_at    ctr
}

#declare color_blue = 
  texture {
    pigment { color rgb < 0.80, 0.80, 1.00 > }
    finish { diffuse 0.05 specular 0.2 roughness 0.005 ambient 0.05 reflection color rgb < 0.8, 0.8, 1.00 >}
  }


#declare crystal = 
  texture {
    pigment { color rgb < 1.00, 1.00, 1.00 > filter .85}
    finish { diffuse 0.1 specular 0.1 roughness 0.001 ambient 0.1 reflection 0.15}
  }

#declare color_black = 
  texture {
    pigment { color rgb < 0.00, 0.10, 0.10 > }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare color_yellow =
  texture {
    pigment { color rgb < 0.80, 0.75, 0.5> filter 0.5 }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
}


#declare color_red =
  texture {
    pigment { color rgb < 1.00, 0.00, 0.00> filter 1}
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
}



#declare color_green =
  texture {
    pigment { color rgb < 0.00, 1.00, 0.00> }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
}

# declare skin = 
   texture {
    pigment { color rgb < 0.97, 0.90, 0.93> }
    finish { diffuse 1.0 specular 0.8 roughness 0.01 ambient 0.1 }
}

# declare carpA = <0, -20, 0>;
# declare carpB = <0, 20, 0>;

# declare car_pos = (1-clock)*carpA + clock*carpB; 


# declare Rubinho = 
	union {
		difference {
			sphere { <0,0,0>, 1
			texture { color_red }
			}
			plane { z 0.1 }
		}
		difference {
			sphere { <0,0,0>, 1
			texture { skin }
			}
			plane { -z 0.1 }
			translate < 0,0,0.2>
		
		}
		
		cylinder { <0,0,0> 
			   <0,0,0.2> 0.5
			 texture {color_red}
			translate <0,1.0,0>
		}
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_red}
		           translate <0,0,-0.5>
	 	}

		cylinder { <0,0,0>
			   <0,0,-2> 0.2
			   texture {color_red}
		           rotate 45*x
			   translate <0,0,-1>
			   
	 	}

		cylinder { <0,0,0>
			   <0,0,-2> 0.2
			   texture {color_red}
		           rotate -25*x
			   translate <0,0,-1>
			   
	 	}
		
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_red}
		           rotate -25*x
			   translate <0,0,-3>
			   
	 	}
		
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_red}
		           rotate 55*x
			   translate <0,0,-3>
			   
	 	}
		
		
	}

			
# declare logo =
	text {
	ttf "arial.ttf"
	"Rubinho:" 
	 	
	0.2, 0
	texture {color_red}	
	rotate 90*z	
	rotate 90*y
	translate <0,-3,5>
	
	} 

#declare logo2 = 
	text {
	ttf "arial.ttf"
	"Piloto da Formula 1."
		
	
	0.2, 0
	texture {color_red}	
	rotate 90*z	
	rotate 90*y
	translate <0,-5,4>
	
	} 
#declare logo3 =
		text {
	ttf "arial.ttf"
	"Equipe:"
	
	0.2, 0
	texture {color_red}	
	rotate 90*z	
	rotate 90*y
	translate <0,-2,3>
	
	} 
#declare logo4 =
	text {
	ttf "arial.ttf"
	"A escudeira Ferrari."
	
	0.2, 0
	texture {color_red}	
	rotate 90*z	
	rotate 90*y
	translate <0,-5,2>
	
	} 

#declare Zezinho =

	union {
		sphere { <0,0,0>, 0.75
		texture { }
		translate < 0,0,0.2>
		
		}
		
				
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_green}
		           translate <0,0,-0.5>
	 	}

		cylinder { <0,0,0>
			   <0,0,-2> 0.2
			   texture {color_green}
		           rotate 45*x
			   translate <0,0,-1>
			   
	 	}

		cylinder { <0,0,0>
			   <0,0,-2> 0.2
			   texture {color_green}
		           rotate -45*x
			   translate <0,0,-1>
			   
	 	}
		
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_blue}
		           rotate -25*x
			   translate <0,0,-3>
			   
	 	}
		
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_blue}
		           rotate 25*x
			   translate <0,0,-3>
			   
	 	}
}	

			
# declare ze_logo =
	text {
	ttf "arial.ttf"
	"Zezinho:" 
	 	
	0.2, 0
	texture {color_green}	
	rotate 90*z	
	rotate 90*y
	translate <0,-2.5,5>
	
	} 

#declare ze_logo2 = 
	text {
	ttf "arial.ttf"
	"Fa de Rubinho."
		
	
	0.2, 0
	texture {color_green}	
	rotate 90*z	
	rotate 90*y
	translate <0,-3.5,4>
	
	} 
#declare ze_logo3 =
		text {
	ttf "arial.ttf"
	"Porem..."
	
	0.2, 0
	texture {color_green}	
	rotate 90*z	
	rotate 90*y
	translate <0,-2,3>
	
	} 

#declare ze_logo4 =
	text {
	ttf "arial.ttf"
	"Faminto."
	
	0.2, 0
	texture {color_green}	
	rotate 90*z	
	rotate 90*y
	translate <0,-2.5,2>
	
	} 


#declare FOME =
	text {
	ttf "arial.ttf"
	"FOME"
	
	0.2, 0
	texture {color_red}	
	rotate 90*z	
	rotate 90*y
	translate <0,-2.5,4>
	
	} 



#declare ZERO =
	text {
	ttf "arial.ttf"
	"ZERO"
	
	0.2, 0
	texture {color_green}	
	rotate 90*z	
	rotate 90*y
	translate <0,-2.5,3>
	
	} 


			
# declare msg =
	text {
	ttf "arial.ttf"
	"A formula 1 tras muitas alegrias." 
	 	
	0.2, 0
	texture {color_green}	
	rotate 90*z	
	rotate 90*y
	translate <0,-6,5>
	
	} 

#declare msg2 = 
	text {
	ttf "arial.ttf"
	"E agora tambem tras"
		
	
	0.2, 0
	texture {color_green}	
	rotate 90*z	
	rotate 90*y
	translate <0,-5.5,4>
	
	} 
#declare msg3 =
		text {
	ttf "arial.ttf"
	"Comida"
	
	0.2, 0
	texture {color_green}	
	rotate 90*z	
	rotate 90*y
	translate <0,-2,3>
	
	} 

#declare msg4 =
	text {
	ttf "arial.ttf"
	"Ajude, voce tambem..."
	
	0.2, 0
	texture {color_green}	
	rotate 90*z	
	rotate 90*y
	translate <0,-3,2>
	
	} 


# declare Mini_Rubinho_Zezinho = 
	
	union {
	union {
		difference {
			sphere { <0,0,0>, 1
			texture { color_red }
			}
			plane { z 0.1 }
		}
		difference {
			sphere { <0,0,0>, 1
			texture { skin }
			}
			plane { -z 0.1 }
			translate < 0,0,0.2>
		
		}
		
		cylinder { <0,0,0> 
			   <0,0,0.2> 0.5
			 texture {color_red}
			translate <0,1.0,0>
		}
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_red}
		           translate <0,0,-0.5>
	 	}

		cylinder { <0,0,0>
			   <0,0,-2> 0.2
			   texture {color_red}
		           rotate 45*x
			   translate <0,0,-1>
			   
	 	}

		cylinder { <0,0,0>
			   <0,0,-2> 0.2
			   texture {color_red}
		           rotate -25*x
			   translate <0,0,-1>
			   
	 	}
		
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_red}
		           rotate -25*x
			   translate <0,0,-3>
			   
	 	}
		
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_red}
		           rotate 55*x
			   translate <0,0,-3>
			   
	 	}
		
	scale <0,-0.5,0>
	translate<0,5,0>	
	
	}


	union {
		sphere { <0,0,0>, 0.75
		texture { }
		translate < 0,0,0.2>
		
		}
		
				
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_green}
		           translate <0,0,-0.5>
	 	}

		cylinder { <0,0,0>
			   <0,0,-2> 0.2
			   texture {color_green}
		           rotate 45*x
			   translate <0,0,-1>
			   
	 	}

		cylinder { <0,0,0>
			   <0,0,-2> 0.2
			   texture {color_green}
		           rotate -45*x
			   translate <0,0,-1>
			   
	 	}
		
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_blue}
		           rotate -25*x
			   translate <0,0,-3>
			   
	 	}
		
		
		cylinder { <0,0,0>
			   <0,0,-3> 0.2
			   texture {color_blue}
		           rotate 25*x
			   translate <0,0,-3>
			   
	 	}
	scale <0,-0.5,0>
	translate <0,8,0>
}	
	

}

#declare Static_Truck = 
	union {
		box { <-3,-8, 3>
	  	      <0, 0,0 >
		texture {color_red}
	}
		box { <-2,0,2>
		      <0,2,0>
		texture {color_yellow}
	}
		box { <-2,2,1>
		      <0,3,0>
		texture {color_yellow}
	}
	translate <0,-4,0>
}


#declare Truck = 
	union {
		box { <-3,-8, 3>
	  	      <0, 0,0 >
		texture {color_red}
	}
		box { <-2,0,2>
		      <0,2,0>
		texture {color_yellow}
	}
		box { <-2,2,1>
		      <0,3,0>
		texture {color_yellow}
	}
	translate car_pos
}

	
	#declare first_p = <0,0,0>;
	#declare sec_p = <0,10,0>;
	#declare thr_p = <0,0,10>;
	
#declare finish_line = 
	
  prism {

    linear_sweep

    cubic_spline

    0,  // sweep the following shape from here ...

    2,  // ... up through here

    12, // the number of points making up the shape ...

    <3,-5>, <3,5>, <-5,0>, <3, -5>, <3,5>, <-5,0>, // sub-shape #1

    <2,-4>, <2,4>, <-4,0>, <2,-4>, <2,4>, <-4,0>  // sub-shape #2



    pigment { Green }

  }


#declare edge =
   lathe {

    linear_spline

    21,

    <0.5,-10>, <3,-10>, <3,-8>, <2,-7>, <2,-5>,
    <1,-2>, <0.5,0>, <0.5,2>, <2,2>, <2,3>,
    <3,4>, <2,5>, <4,6>, <2,6.5>, <3,7>,	
    <2,9>, <2,10>, <4,11>, <1,11>, <1.5,11.5>,	
    <0,12>
    
    texture { color_yellow  }

    finish {

      ambient .3

      phong .75

    }
	scale 0.5
	rotate 90*x
	
  }


#declare pole =
  prism {

    cubic_spline

    0, // sweep the following shape from here ...

    1, // ... up through here

    10, // the number of points making up the shape ...

    <0, 0>, // point#1 (control point... not on curve)

    < -4,  0>, // point#2  ... THIS POINT ...

    <-2,  3>, // point#3

    < -1, 2>, // point#4

    < 0,  2>, // point#5 ... MUST MATCH THIS POINT

    <1,  2>,  // point#6 (control point... not on curve)

    <2,  3>,  // point#6 (control point... not on curve)

    < 4, 0> // point#6 (control point... not on curve)

    <-4,  0>,  // point#6 (control point... not on curve)

     <0,  0>  // point#6 (control point... not on curve)	

    pigment { Green }
 
    rotate 90*z	
   //translate <0,0,-7>	
  }



//if (clock > 0.7) 
object {
       edge
	translate <0,-3,0>
}

object { 
	edge
translate <0,3,0>
}
//pole
//end