// Last edited on DATE TIME by USER
// Processed by remove-cam-lights

background{ color rgb < 0.75, 0.80, 0.85 > }

#declare tx_branco =
  texture{
    pigment{ color rgb < 1, 1, 1 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_vermelho =
  texture{
    pigment{ color rgb < 0.80, 0.10, 0.10 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_pink =
  texture{
    pigment{ color rgb < 0.98, 0.05, 0.75 > }
    finish{ diffuse 0.8 ambient 0.2 specular 0.5 roughness 0.005 }
  }

#declare tx_orange =
  texture{
    pigment{ color rgb < 0.98, 0.20, 0.20 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.05 }
  }

#declare tx_verde =
  texture{
    pigment{ color rgb < 0.20, 0.90, 0.10 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_plastico =
  texture{
    pigment{ color rgb < 0.10, 0.80, 1.00 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

#declare tx_fosca =
  texture{
    pigment{ color rgb < 1.00, 0.80, 0.10 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare tx_espelho =
  texture{
    pigment{ color rgb < 1.00, 0.85, 0.30 > }
    finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 }
  }

#declare tx_vidro =
  texture{
    pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 }
    finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 }
  }

#declare tx_xadrez =
  texture{
    pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > }
    finish{ diffuse 0.9 ambient 0.1 }
    scale 2.0
  }

#include "eixos.inc"
#include "retalho-simples.inc"

#macro emenda_retalho_ver(PP, r0, s0, r1, s1)

                #for(i,0,3,1)
                        #declare PP[r0][s0][3][i] = (PP[r0][s0][2][i] + PP[r1][s1][1][i])/2;
                        #declare PP[r1][s1][0][i] = (PP[r0][s0][2][i] + PP[r1][s1][1][i])/2;
                #end

#end

#macro emenda_retalho_hor(PP, r0, s0, r1, s1)

                #for(i,0,3,1)
                        #declare PP[r0][s0][i][3] = (PP[r0][s0][1][2] + PP[r1][s1][i][1])/2;
                        #declare PP[r1][s1][i][0] = (PP[r0][s0][1][2] + PP[r1][s1][i][1])/2;

                #end

#end

#declare NH=3;
#declare NV=2;

#macro carroceria(PP,NH,NV)
        #declare T=array[4][4];
        union{
                #for(NVi,0,NV-1,1)
                        #for(NHi,0,NH-1,1)
                                #for(i,0,3,1)
                                        #for(j,0,3,1)
                                                #declare T[i][j]=PP[NVi][NHi][i][j];
                                        #end
                                #end

                                object{ retalho(T, 0.000, tx_vermelho, tx_plastico)}
                        #end

                #end
        }

#end

#declare P=array[NV][NH][4][4];

#declare P[0][0][0][3]=<0,3,0>;
#declare P[0][0][0][2]=<1,3,2>;
#declare P[0][0][0][1]=<2,3,3>;
#declare P[0][0][0][0]=<6,3,0>;

#declare P[0][0][1][3]=<0,2,0>;
#declare P[0][0][1][2]=<1,2,3>;
#declare P[0][0][1][1]=<3,2,3>;
#declare P[0][0][1][0]=<6,2,1>;

#declare P[0][0][2][3]=<0,1,3>;
#declare P[0][0][2][2]=<1,1,4>;
#declare P[0][0][2][1]=<4,1,4>;
#declare P[0][0][2][0]=<6,1,1>;

#declare P[0][0][3][3]=<0,0,3>;
#declare P[0][0][3][2]=<1,0,3>;
#declare P[0][0][3][1]=<3,0,3>;
#declare P[0][0][3][0]=<5,0,1>;

#declare P[0][1][0][3]=<-3,3,0>;
#declare P[0][1][0][2]=<-2,3,0>;
#declare P[0][1][0][1]=<-1,3,0>;
#declare P[0][1][0][0]=< 0,3,0>;

#declare P[0][1][1][3]=<-3,2,6>;
#declare P[0][1][1][2]=<-2,2,6>;
#declare P[0][1][1][1]=<-1,2,6>;
#declare P[0][1][1][0]=< 0,2,3>;

#declare P[0][1][2][3]=<-3,1,7>;
#declare P[0][1][2][2]=<-2,1,6>;
#declare P[0][1][2][1]=<-1,1,5>;
#declare P[0][1][2][0]=< 0,1,3>;

#declare P[0][1][3][3]=<-3,0,7>;
#declare P[0][1][3][2]=<-2,0,6>;
#declare P[0][1][3][1]=<-1,0,5>;
#declare P[0][1][3][0]=< 0,0,3>;

#declare P[0][2][0][3]=<-6,3,0>;
#declare P[0][2][0][2]=<-5,3,0>;
#declare P[0][2][0][1]=<-4,3,0>;
#declare P[0][2][0][0]=<-3,3,0>;

#declare P[0][2][1][3]=<-6,3,2>;
#declare P[0][2][1][2]=<-5,3,2>;
#declare P[0][2][1][1]=<-4,3,2>;
#declare P[0][2][1][0]=<-3,2,2>;

#declare P[0][2][2][3]=<-6,3,7>;
#declare P[0][2][2][2]=<-5,3,7>;
#declare P[0][2][2][1]=<-4,3,7>;
#declare P[0][2][2][0]=<-3,2,7>;

#declare P[0][2][3][3]=<-6,0,7>;
#declare P[0][2][3][2]=<-5,0,7>;
#declare P[0][2][3][1]=<-4,0,7>;
#declare P[0][2][3][0]=<-3,0,7>;

#declare P[1][0][0][3]=<0,-3,0>;
#declare P[1][0][0][2]=<1,-3,2>;
#declare P[1][0][0][1]=<2,-3,3>;
#declare P[1][0][0][0]=<6,-3,0>;

#declare P[1][0][1][3]=<0,-2,0>;
#declare P[1][0][1][2]=<1,-2,3>;
#declare P[1][0][1][1]=<3,-2,3>;
#declare P[1][0][1][0]=<6,-2,1>;

#declare P[1][0][2][3]=<0,-1,3>;
#declare P[1][0][2][2]=<1,-1,4>;
#declare P[1][0][2][1]=<4,-1,4>;
#declare P[1][0][2][0]=<6,-1,1>;

#declare P[1][0][3][3]=<0,0,3>;
#declare P[1][0][3][2]=<1,0,3>;
#declare P[1][0][3][1]=<3,0,3>;
#declare P[1][0][3][0]=<5,0,1>;

#declare P[1][1][0][3]=<-3,-3,0>;
#declare P[1][1][0][2]=<-2,-3,0>;
#declare P[1][1][0][1]=<-1,-3,0>;
#declare P[1][1][0][0]=< 0,-3,0>;

#declare P[1][1][1][3]=<-3,-2,6>;
#declare P[1][1][1][2]=<-2,-2,6>;
#declare P[1][1][1][1]=<-1,-2,6>;
#declare P[1][1][1][0]=< 0,-2,3>;

#declare P[1][1][2][3]=<-3,-1,7>;
#declare P[1][1][2][2]=<-2,-1,6>;
#declare P[1][1][2][1]=<-1,-1,5>;
#declare P[1][1][2][0]=< 0,-1,3>;

#declare P[1][1][3][3]=<-3,0,7>;
#declare P[1][1][3][2]=<-2,0,6>;
#declare P[1][1][3][1]=<-1,0,5>;
#declare P[1][1][3][0]=< 0,0,3>;

#declare P[1][2][0][3]=<-6,-3,0>;
#declare P[1][2][0][2]=<-5,-3,0>;
#declare P[1][2][0][1]=<-4,-3,0>;
#declare P[1][2][0][0]=<-3,-3,0>;

#declare P[1][2][1][3]=<-6,-3,2>;
#declare P[1][2][1][2]=<-5,-3,2>;
#declare P[1][2][1][1]=<-4,-3,2>;
#declare P[1][2][1][0]=<-3,-2,2>;

#declare P[1][2][2][3]=<-6,-3,7>;
#declare P[1][2][2][2]=<-5,-3,7>;
#declare P[1][2][2][1]=<-4,-3,7>;
#declare P[1][2][2][0]=<-3,-2,7>;

#declare P[1][2][3][3]=<-6,0,7>;
#declare P[1][2][3][2]=<-5,0,7>;
#declare P[1][2][3][1]=<-4,0,7>;
#declare P[1][2][3][0]=<-3,0,7>;

emenda_retalho_hor(P,0,0,0,1)
emenda_retalho_hor(P,0,1,0,2)

emenda_retalho_ver(P,0,0,1,0)
emenda_retalho_ver(P,0,1,1,1)

object{ carroceria(P,3,2)}

#include "eixos.inc"
#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 3.00>;
#declare raio_cena = 10.0;
#declare dir_camera = < 14.00, 7.00, 4.00 >;
#declare dist_camera = 50*raio_cena;
#declare intens_luz = 1.20;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)