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

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

#declare tx_preto =
  texture{
    pigment{ color rgb < 0.00, 0.00, 0.00 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare tx_rosa =
  texture{
    pigment{ color rgb < 1, 0.4, 0.8 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare tx_vermelho =
  texture{
    pigment{ color rgb < 1, 0, 0 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare tx_pele =
  texture{
    pigment{ color rgb < 1, 0.72, 0.51 > }
    finish{ diffuse 0.9 ambient 0.1 }
}

#declare tx_verde =
 texture{
   pigment{ color rgb < 0.49, 0.99 , 0 > }
   finish{ diffuse 0.9 ambient 0.1 }
 }

#declare tx_escada =
  texture{
    pigment{ color rgb < .5,.6,.8 > }
    finish{ diffuse 0.9 ambient 0.1 }
 }

#declare tx_branco =
  texture{
    pigment{ color rgb < 1, 1, 1 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare tx_azul =
  texture{
    pigment{ color rgb < 0, 0, 1 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare tx_amarelo =
  texture{
    pigment{ color rgb <1,1,0 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare membro =
        cylinder {
        <0,0,1>,<0,0,2>,0.2
        texture { tx_pele }
        }

#declare braco_dir =
        cylinder {
        <0,0.65,4.4>,<0,1.15,5.36>,0.2
        texture { tx_pele }
        }

#declare braco_esq =
        cylinder {
        <0,-0.65,4.4>,<0,-1.15,5.36>,0.2
        texture { tx_pele }
        }

#declare pescoso =
        cylinder {
        <0,0,4.5>,<0,0,4.7>,0.25
        texture { tx_pele }
        }

#declare cabeca =
        sphere {
        <0,0,5.15>,0.5
        texture { tx_pele }
        }

#macro roupa(tipo)
        union{
                #if(tipo=1)
                union{
                        cylinder {
                                <0,0,3>,<0,0,4.5>,0.65
                                texture { tx_branco }
                        }
                        cone {
                                <0,0,2>,1
                                <0,0,3>,0.65
                                texture { tx_preto }
                        }
                }
                #else
                union{
                        cylinder {
                                <0,0,3>,<0,0,4.5>,0.65
                                texture { tx_preto }
                        }
                        cone {
                                <0,0,2>,1
                                <0,0,3>,0.65
                                texture { tx_vermelho }
                        }
                }
                #end
        }
#end

#macro torcedor(tipo)
        union{
                object { cabeca }
                object { pescoso }
                object { roupa(tipo) }
                object { membro translate <0,0.25,0> }
                object { membro translate <0,-0.25,0> }
                object { braco_dir }
                object { braco_esq }
                scale 0.2
                }
#end

#declare roleta = seed(155454);
#macro cadeira()
        union{
                box{<-3.8,-4.9,0.5><-4.1,-4.6,0.51> texture {tx_branco}}
                box{ <-4.1,-4.9,0.5 > , <-4.15,-4.6 ,0.9 > texture {tx_branco}}
                #if(rand(roleta)<0.25)
                        object { torcedor(1) translate <-3.95,-4.75,0.4> }
                #else
                        #if(rand(roleta)<0.5)
                                object { torcedor(2) translate <-3.95,-4.75,0.4> }
                        #end
                #end
        }
#end

#macro Arquibancada(largura,altura,cor)
        union{
                #declare k =largura;
                #declare j=0;
                #while (j<=altura)
                        box {<-3.7-0.5*j , -5 , 0 >,< -4.2-0.5*j , -5+k*0.5 , 0.5+0.5*j> }
                        #declare i = 0;
                        #while (i<largura)
                                #if(j!=altura)
                                        object {cadeira() translate < -0.5*j ,i*0.5 ,0.5*j > }
                                #end
                                #declare i = i + 1;
                        #end
                        #declare j = j+1;
                #end
                texture { cor }
        }
#end

#macro Escada(largura,altura,cor)
        union{
                #declare k =largura;
                #declare j=0;
                #while (j<=altura)
                        box {<-3.7-0.2*j , -5 , 0 >,< -3.9-0.2*j , -5+k*0.2 , 0.5+0.2*j> }
                        #declare j = j+1;
                #end

                texture { cor }
        }
#end

#declare campo =
        box {
        <-3.5,-5,-0.1>,<3.5,5,0>
        texture { tx_verde }
        }

#include "eixos.inc"

union {
        object { campo }

        object { Arquibancada(6,6,tx_azul)}
        object { Escada(2.6,15,tx_amarelo) translate <0,3,0> }
        object { Arquibancada(6,6,tx_azul) translate <0,3.5,0>}
        object { Escada(2.6,15,tx_amarelo) translate <0,6.5,0> }
        object { Arquibancada(6,6,tx_azul) translate <0,7,0>}

        object { Arquibancada(18,8,tx_azul) rotate 180*z }
        object { Escada(5,20,tx_amarelo) translate <0,9,0> rotate 180*z }

        object { Arquibancada(12,6,tx_azul) translate <-1.5,2.5,0> rotate -90*z }
        object { Escada(5,15,tx_amarelo) translate <-1.5,1.5,0> rotate -90*z }

        object{ Arquibancada(6,6,tx_azul) translate <-1.5,1.5,0> rotate 90*z }
        object { Escada(5,15,tx_amarelo) translate <-1.5,4.5,0> rotate 90*z }
        object{ Arquibancada(6,6,tx_azul) translate <-1.5,5.5,0> rotate 90*z }

}

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 0.00 >;
#declare raio_cena = 20.0;
#declare dir_camera = <10,+10,13>;
#declare dist_camera = 10.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)