// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #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_black = texture{ pigment{ color rgb < 0.00, 0.00, 0.00 > } finish{ diffuse 1.0 ambient 0.0 } } #declare tx_gray = texture{ pigment{ color rgb < 0.20, 0.20, 0.20 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_white = texture{ pigment{ color rgb < 1.00, 1.00, 1.00 > } finish{ diffuse 0.9 ambient 0.1 } } #local tx_coke = texture{ pigment{ color rgb < 1, 0, 0 > } finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 } } #declare tx_coke_2 = texture{ pigment{ color rgb < 0.9, 0.00, 0.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #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 } // ====================================================================== // DESCRI��O DA CENA #declare raio = 2.000; // Partes da cena: #declare bolinha = sphere{ < 0,0,0 >, 0.50 } #declare bolota = sphere{ < 0,0,0 >, 1.50 } #declare bola = sphere{ < 0.00, 0.00, 0.00 >, raio texture{ tx_plastico } } #declare pino = cylinder{ < -2.00, +2.00, -1.00 >, < +2.00, -2.00, +1.00 >, 0.75 texture{ tx_fosca } } #declare furo = cylinder{ < -1.00, -2.00, -2.00 >, < +1.00, +2.00, +2.00 >, 0.75*raio texture{ tx_fosca } } #declare chao = box{ <-20,-20,-1>, <+20,+20,0> } #declare ovniBody = cylinder{ < 0.00, 0.00, 0.00 >, < 0.00, 2.00, 0.00 >, 0.5 texture{ tx_xadrez } } #declare ovniHead = cone{ < 0, 0, 0 >, 0.5, < 0, 1, 0 >, 0 texture{ tx_xadrez } } #declare ovniBox = box{ <0, 0, 0>, <1, 1, 1> texture {tx_fosca} } #declare ovniHole = cylinder { <0, 0, 0>, <0, 2, 0>, 0.25 texture { tx_coke } } // ///////////// #include "eixos.inc" // Aqui est� a cena, finalmente: #declare ovni = union { object { bolinha translate <0, -4.5, 0>texture{ tx_coke } } object { bolinha translate <0, -3.5, 0> texture{ tx_fosca } } object { bolinha translate <0, -2.5, 0> texture{ tx_coke } } object { bolinha translate <0, -1.5, 0> texture{ tx_fosca } } object { bolinha translate <0, -0.5, 0> texture{ tx_coke } } object { ovniBody } object { ovniHead translate <0, 2, 0> } difference { object { ovniBox translate <-0.5, +3.0, -0.5> } object { ovniHole translate <0, 2.5, 0> } } } #macro soldier(fullTexture) #local soldierHead = sphere{ <0, 0, 0>, 0.25 translate <0, 0, 1> } #local soldierBody = box { <0, 0, 0>, <0.2, 0.2, 1> translate <-0.1, -0.1, 0.2> } #local soldierBase = box { <0, 0, 0>, <0.5, 0.5, 0.2> translate <-0.25, -0.25, 0> } union { object { soldierHead texture { fullTexture } } object { soldierBody texture { fullTexture } } object { soldierBase texture { fullTexture } } } #end #macro ship(fullTexture) #local shipMiddle = sphere{ <0, 0, 0>, 0.4 translate <0, 0, 0> } #local shipHead = sphere{ <0, 0, 0>, 0.3 translate <0, 0.7, 0> } #local shipTail = sphere{ <0, 0, 0>, 0.4 translate <0, -0.8, 0> } union { object { shipMiddle texture { fullTexture } } object { shipHead texture { fullTexture } } object { shipTail texture { fullTexture } } } #end #macro generateArmy(soldierRows, soldierColumns) union { #local soldierRowsCounter = 0; #while (soldierRowsCounter < soldierRows) #local soldierColumnsCounter = 0; #while (soldierColumnsCounter < soldierColumns) #local kk = (soldierColumnsCounter) * (soldierRowsCounter + 1); #if (sin(15*kk*kk) > -0.2) object { soldier(tx_fosca) translate <2 * soldierRowsCounter, 1.2 * soldierColumnsCounter, 0> } #end #local soldierColumnsCounter = soldierColumnsCounter + 1; #end #local soldierRowsCounter = soldierRowsCounter + 1; #end } #end #macro generateShipArmy(shipRows, shipColumns) union { #local shipRowsCounter = 0; #while (shipRowsCounter < shipRows) #local shipColumnsCounter = 0; #while (shipColumnsCounter < shipColumns) #local kk = (shipColumnsCounter + 1) * (shipRowsCounter + 5); #if (sin(15*kk*kk) > 0) object { ship(tx_coke_2) translate <3 * shipRowsCounter, 2.5 * shipColumnsCounter, 0> scale <0.5, 0.5, 0.5> } #end #local shipColumnsCounter = shipColumnsCounter + 1; #end #local shipRowsCounter = shipRowsCounter + 1; #end } #end union{ // object{ eixos(3.00) } #declare m = 10; #declare n = 7; object { generateArmy(m, n) translate <0, -4, 0> } object { generateShipArmy(m+1, n+2) translate <0, 7, 4> } } #include "camlight.inc" // #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare centro_cena = < 2 * m, 1.9 * n, 1.00 >/2; // #declare raio_cena = 6.0; #declare raio_cena = 1.5 * sqrt(m * m + n * n); #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz) // macro nave alienígena // macro nave terrestre // tem que ter parâmetro pra mudar algum detalhe da nave (cor, tamanho, direção, etc.) // #debug concat("coisas = ", str(coisas,0,6), "\n")