// Bernardo do Amaral Teodosio - 167494 - MC937 A // LAB 04 // ====================================================================== // 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_fosca_2 = texture{ pigment{ color rgb < 0.40, 0.40, 0.40 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_3 = texture{ pigment{ color rgb < 1.00, 1.00, 0.00 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_black = texture{ pigment{ color rgb < 0.20, 0.20, 0.20 > } finish{ diffuse 0.9 ambient 0.1 } } #declare 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_fosca_4 = texture{ pigment{ color rgb < 0.5, 0.9, 0.5 > } 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 } #declare tx_xadrez_2 = texture{ pigment{ checker color rgb < 0.00, 0.02, 0.00 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 1 } // ====================================================================== // DESCRIÇÃO DA CENA // Partes da cena: #include "eixos.inc" // LAB 3 - instruções #macro createChamber(chamberCenter) #declare chamberSize = rand(generator); #if (chamberSize < 0.3) #declare chamberSize = 0.3; #end #if (chamberSize > 0.6) #declare chamberSize = 0.6; #end object { box { chamberCenter, texture{ tx_fosca_black } } } #end #declare TUNNEL_WIDTH = 0.05; #macro createCylinder(chamberOneCenter, chamberTwoCenter) object { cylinder { chamberOneCenter, chamberTwoCenter, TUNNEL_WIDTH texture{ tx_coke_2 }} } #end #macro createEntranceTunnel(entranceChamberCenter) object { cylinder { entranceChamberCenter, , TUNNEL_WIDTH texture{ tx_fosca_4 }} } #end #macro network(chambersCount, tunnelsCount) union { #declare generator = seed(5); #declare chambersCenter = array[chambersCount]; // create chambers #for(forCounter, 1, chambersCount, 1) #declare MULTIPLIER = 8; #declare xCenter = rand(generator) * MULTIPLIER; #declare yCenter = rand(generator) * MULTIPLIER; #declare zCenter = rand(generator) * MULTIPLIER; #declare chambersCenter[forCounter - 1] = ; // object { sphere { chambersCenter[forCounter - 1], 0.25 texture{ tx_coke_2 }} } object { createChamber(chambersCenter[forCounter - 1]) } #end // create tunnels #for(forCounter, 1, tunnelsCount) #declare chamberOne = int(rand(generator) * chambersCount); #declare chamberTwo = int(rand(generator) * chambersCount); #if (chamberOne != chamberTwo) object { createCylinder(chambersCenter[chamberOne], chambersCenter[chamberTwo]) } #else #declare forCounter = forCounter - 1; #end #end #declare entranceChamber = int(rand(generator) * chambersCount); object { createEntranceTunnel(chambersCenter[entranceChamber]) } } #end #macro createCircleFirstVersion() union { #for(i, -pi, pi, 0.01) sphere { <0, cos(i), sin(i)>, 0.25 texture{ tx_coke_2 }} #end } #end // CRIA O CIRCULO USANDO O COUNT DE QUANTAS ESFERAS QUER #macro createCircle(sphereRadius, sphereCount) union { #for(i, -pi, pi, 2*pi/sphereCount) sphere { <0, cos(i), sin(i)>, sphereRadius texture{ tx_coke_2 }} #end } #end // Cria o quadrado (o do circulo foi mais dahr) #macro createSquare(sphereRadius) union { #for(i, 0, 1, 0.01) #declare multiplier = 5; #declare value = i*multiplier; #if (i >= 0 & i < 0.25) sphere { <0, value, 0>, sphereRadius texture{ tx_coke_2 }} #end #if (i >= 0.25 & i < 0.50) sphere { <0, 0.25*multiplier, value - 0.25*multiplier>, sphereRadius texture{ tx_coke_2 }} #end #if (i >= 0.50 & i < 0.75) sphere { <0, value - 0.50*multiplier, 0.25*multiplier>, sphereRadius texture{ tx_coke_2 }} #end #if (i >= 0.75 & i <= 1) sphere { <0, 0, value - 0.75*multiplier>, sphereRadius texture{ tx_coke_2 }} #end #end } #end #macro createCurve(sphereRadius) #declare cursor = sphere{ < 0.00, 0.00, 0.00 >, sphereRadius texture{ tx_coke_2 } } union { #for(i, 0, 1, 0.001) #declare MULTIPLIER = 10; #declare value = i*MULTIPLIER; // part 1 (see notebook for parts) #if (i >= 0 & i < 1/8) #declare tt0 = 0/8; #declare tt1 = 1/8; #declare vv0 = 0; #declare vv1 = 1; #declare targetValue = vv0 + ((i - tt0)/(tt1 - tt0)) * (vv1 - vv0); object { cursor translate <0, 0, targetValue> } #end #if (i >= 1/8 & i < 2/8) #declare tt0 = 1/8; #declare tt1 = 2/8; #declare vv0 = pi/2; #declare vv1 = pi; #declare alphaAngle = vv0 + ((i - tt0)/(tt1 - tt0)) * (vv1 - vv0); object { cursor translate <0, 1 + cos(alphaAngle), 1 + sin(alphaAngle)>} #end #if (i >= 2/8 & i < 3/8) #declare tt0 = 2/8; #declare tt1 = 3/8; #declare vv0 = 1; #declare vv1 = 2; #declare targetValue = vv0 + ((i - tt0)/(tt1 - tt0)) * (vv1 - vv0); object { cursor translate <0, targetValue, 2> } #end #if (i >= 3/8 & i < 4/8) #declare tt0 = 3/8; #declare tt1 = 4/8; #declare vv0 = 3*pi/2; #declare vv1 = 5*pi/2; #declare alphaAngle = vv0 + ((i - tt0)/(tt1 - tt0)) * (vv1 - vv0); object { cursor translate <0, 2 + cos(alphaAngle), 3 + sin(alphaAngle)>} #end #if (i >= 4/8 & i < 5/8) #declare tt0 = 4/8; #declare tt1 = 5/8; #declare vv0 = 3; #declare vv1 = 0; #declare targetValue = vv0 + ((i - tt0)/(tt1 - tt0)) * (vv1 - vv0); object { cursor translate <0, targetValue - 1, 4> } #end #if (i >= 5/8 & i < 6/8) #declare tt0 = 5/8; #declare tt1 = 6/8; #declare vv0 = pi/2; #declare vv1 = pi; #declare alphaAngle = vv0 + ((i - tt0)/(tt1 - tt0)) * (vv1 - vv0); object { cursor translate <0, 0 + cos(alphaAngle) - 1, 3 + sin(alphaAngle)>} #end #if (i >= 6/8 & i < 7/8) #declare tt0 = 6/8; #declare tt1 = 7/8; #declare vv0 = 3; #declare vv1 = 0; #declare targetValue = vv0 + ((i - tt0)/(tt1 - tt0)) * (vv1 - vv0); object { cursor translate <0, 0 - 2, targetValue> } #end #if (i >= 7/8 & i < 8/8) #declare tt0 = 7/8; #declare tt1 = 8/8; #declare vv0 = pi; #declare vv1 = 2*pi; #declare alphaAngle = vv0 + ((i - tt0)/(tt1 - tt0)) * (vv1 - vv0); object { cursor translate <0, 0 + cos(alphaAngle) - 1, sin(alphaAngle)>} #end #end } #end union { // object{ eixos(3.00) } // object { createCircle(0.1, 200) } // object { createSquare(0.1) } object { createCurve(0.1) } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 6.0; #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)