// -------------------------------------------------------------------------- // http://louisbel.free.fr - e-mail : louisbel @ free.fr // janvier 2005 - copyright louis bellotto // // radiosity test // -------------------------------------------------------------------------- #version unofficial MegaPov 1.1; // -------------------------------------------------------------------------- // --- INCLUDES ------------------------------------------------------------- // -------------------------------------------------------------------------- #include "colors.inc" #include "rad_def.inc" #include "myMacros.inc" #declare displayAxis = false; #declare verbose=false; #declare useRadiosity = true; #declare ambientValue = (useRadiosity?0.00:0.40); #declare diffuseValue = (useRadiosity?0.80:0.60); #declare vue = 1; // 1:camera 1, 2:camera 2 // -------------------------------------------------------------------------- // --- SCENE ---------------------------------------------------------------- // -------------------------------------------------------------------------- global_settings { assumed_gamma 1.80 max_trace_level 10 #if(useRadiosity) radiosity { Rad_Settings(Radiosity_Final, off, off) } #end } #switch(vue) #case 1 #declare cameraLocation = p2r(30, 35, 70,false); #declare cameraLookAt = <2, 2, 1>; #break #case(2) #declare cameraLocation = p2r(30, 2, 70,false); #declare cameraLookAt = <2, 8, 1>; #break #end #declare cameraAngle = 36; camera { angle cameraAngle location cameraLocation look_at cameraLookAt } #if(!useRadiosity) light_source { <400, 320, 400> color White } #end sky_sphere { pigment { color White*1.25 } } plane { y,0 pigment { color White } finish { ambient ambientValue diffuse diffuseValue } } #if(displayAxis) drawAxis (12, 0.1) #end // -------------------------------------------------------------------------- // --- DIMENSION & CALCULS -------------------------------------------------- // -------------------------------------------------------------------------- #declare boxSide = 28.00; #declare boxEcart = 1.00; #declare boxHeight = 2.00; #declare tubeRayon = 0.75; #declare tubeArrondi = 4.00; #declare tubeHeight = 2.00; #declare petitRayon = 2*((tubeRayon*1.10)-tubeRayon); #declare jeu = 0.08; #declare supportXMax = +boxSide*0.50+boxEcart; #declare supportXMin = +boxSide*0.50-2*tubeRayon-boxEcart; #declare supportXMed = (supportXMin+supportXMax)*0.50; #if(verbose) #debug "\nSupport :" #debug concat("\n max = ",str(supportXMax,5,3)," min = ",str(supportXMin,5,3)," milieu = ",str(supportXMed,6,3)) #end #declare supportHauteur = boxHeight+tubeHeight+1.25; #declare visXMax = (supportXMax+(supportXMed+tubeRayon))*0.50; #declare visXMin = ((supportXMed-tubeRayon)+supportXMin)*0.50; #if(verbose) #debug "\nVis :" #debug concat("\n max = ",str(visXMax,5,3)," min = ",str(visXMin,5,3)) #debug "\n\n\n\n" #end #declare visRayon = 0.30; #declare visFente = 0.10; #declare rayonBoule = 6.00; // -------------------------------------------------------------------------- // --- TEXTURES ------------------------------------------------------------- // -------------------------------------------------------------------------- #declare objectColor = color Gold*1.75; #declare textureSupport = texture { pigment { color White } finish { ambient ambientValue diffuse diffuseValue } } #declare textureVis = texture { pigment { color White*0.50 } finish { ambient ambientValue diffuse diffuseValue } } #declare textureTubes = texture { pigment { color objectColor } finish { ambient ambientValue diffuse diffuseValue } } #declare textureBoule = texture { pigment { color objectColor } finish { ambient ambientValue diffuse diffuseValue reflection 0.15 brilliance 1.50 } } // -------------------------------------------------------------------------- // --- SUPPORTS ------------------------------------------------------------- // -------------------------------------------------------------------------- #declare support = union { union { box { <supportXMin, 0, -0.50> <supportXMax, boxHeight+tubeHeight-jeu, +0.50>} box { <supportXMin, boxHeight+tubeHeight+jeu, -0.50> <supportXMax, supportHauteur, +0.50> } translate -8*z } union { box { <supportXMin, 0, -0.50> <supportXMax, boxHeight+tubeHeight-jeu, +0.50> } box { <supportXMin, boxHeight+tubeHeight+jeu, -0.50> <supportXMax, supportHauteur, +0.50> } translate +8*z } } #declare supports = union { object { support } object { support rotate 90*y } object { support rotate 180*y } object { support rotate 270*y } } union { box { <-boxSide*0.50-boxEcart, 0.00, -boxSide*0.50-boxEcart> <+boxSide*0.50+boxEcart, boxHeight, +boxSide*0.50+boxEcart> } object { supports } texture { textureSupport } } // -------------------------------------------------------------------------- // --- VIS ------------------------------------------------------------------ // -------------------------------------------------------------------------- #declare vis = difference { cylinder { <0, supportHauteur+0.01, 0.00> <0, boxHeight, 0.00> visRayon} box { <2*visRayon, supportHauteur+0.1, -visFente*0.50> <-2*visRayon, supportHauteur-0.25, +visFente*0.50> } } #declare alea=seed(37); #declare index=0; #while (index<4) union { object { vis rotate 180*rand(alea)*y translate <visXMax, 0, +8> rotate 90*index*y } object { vis rotate 180*rand(alea)*y translate <visXMin, 0, +8> rotate 90*index*y } object { vis rotate 180*rand(alea)*y translate <visXMax, 0, -8> rotate 90*index*y } object { vis rotate 180*rand(alea)*y translate <visXMin, 0, -8> rotate 90*index*y } texture { textureVis } } #set index=index+1; #end // -------------------------------------------------------------------------- // --- TUBES ---------------------------------------------------------------- // -------------------------------------------------------------------------- #declare arrondi = union { difference { torus { tubeArrondi tubeRayon*1.10 } plane { x, 0 } plane { z, 0 } } torus { tubeRayon petitRayon rotate 90*z translate tubeArrondi*z sturm } torus { tubeRayon petitRayon rotate 90*x translate tubeArrondi*x sturm } translate <boxSide*0.50-tubeArrondi-tubeRayon, 0, boxSide*0.50-tubeArrondi-tubeRayon> } #declare arrondis = union { object { arrondi } object { arrondi rotate 90*y } object { arrondi rotate 180*y } object { arrondi rotate 270*y } } #declare tube = cylinder { <boxSide*0.50-tubeRayon, 0, -(boxSide*0.50-tubeArrondi-tubeRayon)> <boxSide*0.50-tubeRayon, 0, +(boxSide*0.50-tubeArrondi-tubeRayon)> tubeRayon } #declare tubes = union { object { tube } object { tube rotate 90*y } object { tube rotate 180*y } object { tube rotate 270*y } } union { object { arrondis } object { tubes } translate (boxHeight+tubeHeight)*y texture { textureTubes } } // -------------------------------------------------------------------------- // --- BOULE ---------------------------------------------------------------- // -------------------------------------------------------------------------- sphere { <0, rayonBoule, 0> rayonBoule translate boxHeight*y texture { textureBoule } }