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

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

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

#declare tx_azul =
  texture{
    pigment{ color rgb < 0, 0.25, 0.70 > }
  }

#declare tx_verde =
  texture{
    pigment{ color rgb < 0, 0.7, 0.25 > }
  }

#declare tx_cinza =
  texture{
    pigment{ color rgb < 0.95, 0.95, 0.95 > }
  }

#declare tx_laranja =
  texture{
    pigment{ color rgb < 0.6, 0.4, 0.1 > }
  }

#declare tx_marrom =
  texture{
    pigment{ color rgb < 0.70, 0.3, 0.0 >}
  }

#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 0.1
  }

#declare tx_xadrez2 =
  texture{
    pigment{ checker color rgb < 0.70, 0.82, 0.0 >, color rgb < 0.10, 0.4, 0.90 > }
    finish{ diffuse 0.9 ambient 0.1 }
    scale 0.1
  }

#declare campo =
  box
  {
    <3, 1, 0>, <-3, -1, -0.25>
    texture { tx_azul }
  }

#declare bloco_concreto =
  box
  {
    <0, 0, 0>, <0.2, 0.2, 0.2>
    texture { tx_cinza }
  }

#declare bloco_escada =
  box
  {
    <0, 0, 0>, <0.1, 0.1, 0.1>
    texture { tx_marrom }
  }

#declare banco=
union
{
  box { <0, 0, 0>, <0.18, 0.18, 0.02> texture { tx_laranja } }
  box { <0.0, 0.14, 0>, <0.18, 0.18, 0.18> texture { tx_laranja } }
}

#declare cabeca =
  sphere
  {
    <0.1, 0.1,0.3>, 0.06
    texture{ tx_pele }
  }

#declare corpo =
  cylinder
  {
    <0.1,0.1,0.1>, <0.1,0.1,0.3>, 0.05
  }

#declare saia =
  cone
  {
    <0.1,0.1,0>, 0.1 <0.1,0.1,0.2>,0
  }

#declare pessoa =
union{
  object{ cabeca }
  object{ corpo }
  object{ saia }
}

#macro escada(degraus, largura, pos_cima, pos_lado)
  union
  {
    #declare i = 0;
    #while(i < degraus)
      #declare j = 0;
      #while(j<2)
        object{ bloco_escada scale<2* largura, 1,1> translate<pos_lado*2*0.1, i*0.1, (pos_cima*2+i)*0.1>}
        #declare j = j + 1;
      #end
      #declare i = i + 1;
    #end
  }
#end

#macro torcedor(i, j, tx)
  object{ pessoa translate<j*0.2, i*0.2, 0.2*(i+1)> texture { tx }}
#end

#macro secao(degraus, largura, pos_cima)
  union
  {
    #declare i = 0;
    #while(i < degraus)
      object{ bloco_concreto translate<0, (i+pos_cima)*0.2, 0> scale<largura, 1, i+pos_cima+1> }
      #declare j = 0;
      #while(j < largura)
        object{ banco translate<j*0.2, (pos_cima+i)*0.2, 0.2*(pos_cima+i+1)> }
        #if(rand(roleta) < 0.5)
        torcedor(i+pos_cima, j,
          #if(rand(roleta) < 0.5)
            tx_xadrez
          #else
            tx_xadrez2
          #end
        )
        #end
        #declare j = j + 1;
      #end
      #declare i = i + 1;
    #end
  }
#end

#include "eixos.inc"

#declare roleta = seed(350);

union{
  object{ eixos(3.00) }
  secao(3, 10, 0)
  secao(2, 10, 3)

  escada(10, 4, 0, 10)
}

#include "camlight.inc"
#declare centro_cena = < 0.00, 2.00, 1.00 >;
#declare raio_cena = 6.0;
#declare dir_camera = < 14.00, -7.00, 4.00 >;
#declare dist_camera = 20.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)