#include "eixos.inc" #macro standard_view(thing, show_axes, show_ground, view) // Sets the {camlight} parameters for the specific {view} // of object {thing} #local thpos = min_extent(thing); #local thdim = max_extent(thing) - thpos; #debug concat("\n!! thpos = ", vstr(3, thpos, " ", 0,1), " thdim = ", vstr(3, thdim, " ", 0,1), "\n") #local thrad = vlength(thdim)/2; #local thctr = thpos + thdim/2; #local scene = union{ object{ thing } #if (show_axes) object{ eixos(1.3*thrad, 0.005*thrad) } #end #if (show_ground) #declare tx_ground = texture{ pigment{ checker color rgb < 0.600, 0.650, 0.750 >, color rgb < 0.800, 0.850, 0.900 > } finish{ diffuse 0.900 ambient 0.100 } scale 300.0 } #local ground = box{ <-2000,-2000,-10>, <+2000,+2000,-0.1> texture{ tx_ground } } object{ ground #if (thpos.z < 0) translate thpos.z*z #end } #end } object{ scene } #if (view = 0) // Full view of object from right front (assumed to have low corner at <0,0,0>): #declare centro_cena = thctr; #declare raio_cena = 1.5*thrad; #declare dir_camera = < 14.00, 12.00, 8.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 1) // Full view from right back: #declare centro_cena = thctr; #declare raio_cena = 1.5*thrad; #declare dir_camera = < -14.00, 12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 2) // Full view from front left: #declare centro_cena = thctr; #declare raio_cena = 1.5*thrad; #declare dir_camera = < 14.00, -12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 3) // Full view from near top: #declare centro_cena = thctr; #declare raio_cena = 1.5*thrad; #declare dir_camera = < 2.00, 3.00, 12.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 4) // Top right corner small detail: #declare centro_cena = thctr + thdim/2; #declare raio_cena = 100; #declare dir_camera = < 14.00, 12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 5) // Top right corner larger detail: #declare centro_cena = thctr + thdim/2; #declare raio_cena = 250; #declare dir_camera = < 14.00, 12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 6) // Top right corner larger detail from back: #declare centro_cena = thctr + thdim/2; #declare raio_cena = 250; #declare dir_camera = < -14.00, 12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 7) // Center front detail: #declare centro_cena = thctr + thdim.x/2*x; #declare raio_cena = 100; #declare dir_camera = < 14.00, 12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #end #end