// Woodworking project: drawer chest(s) to put under Fercar bench. #version 3.7; global_settings{ max_trace_level 6 assumed_gamma 1.0 } background{ color rgb < 0.75, 0.80, 0.85 > } #declare groundplane = box{ <-2000,-2000,-10>, <+2000,+2000,-0.1> } #declare empty = sphere{ < 0, 0, 0 >, 0.00001 } #include "eixos.inc" #include "write_pieces.inc" #include "show_volume.inc" #include "bench_closet_textures.inc" #fopen pieces "out/pieces.txt" write // Global variables: #declare xplode = 0.0; // 250.0; // Explosion distance. #declare dropen = 300.0; // 400.0; // Max drawer open amount. #declare show_drawers = 1; #declare show_plates = 1; #declare tx_plate = texture{ tx_plate_opaque } #local scn = 4; // Scene to show. #local swh = 1; // What component of the scene to show. #local view = 0; // View to use. // ---------------------------------------------------------------------- // SCENES #if (scn = 0) #include "bench_closet_set.inc" #local thdim = bench_closet_set(show_drawers, show_plates, 0); #local thing = object{ bench_closet_set(show_drawers, show_plates, swh) } #elseif (scn = 1) #include "bench_closet_chest.inc" #local Ndr = 8; #local thdim = bench_closet_chest(Ndr, show_drawers, show_plates, 0); #local thing = object{ bench_closet_chest(Ndr, show_drawers, show_plates, swh) } #elseif (scn = 2) #include "bench_closet_drawer_stack.inc" #local sdim = < 500, 400, 600 >; #local Ndr = 5; #local tpht = 45; #local thdim = bench_closet_drawer_stack(sdim, Ndr, topht, 10, 15, 15, 30, show_plates, 0); #local thing = object{ bench_closet_drawer_stack(sdim, Ndr, topht, 10, 15, 15, 30, show_plates, swh) } #elseif (scn = 3) #include "bench_closet_walls.inc" #local walls_dim = < 485, 575, 655 >; #local side_wth = 10; // Thickness of left and right side walls. #local rear_wth = 35; // Thickness of rear wall. #local bot_wth = 15; // Thickness of bottom wall. #local top_wth = 25; // Thickness of top wall. #local thdim = bench_closet_walls(walls_dim, side_wth, rear_wth, bot_wth, top_wth, 0); #local thing = object{ bench_closet_walls(walls_dim, side_wth, rear_wth, bot_wth, top_wth, swh) } #elseif (scn = 4) #include "bench_closet_drawer.inc" #local dr_sdim = < 460, 500, 200 >; // Dimensions of space where drawer fits, incl face plate. #local dr_rail_dim = < 405.0, 12.7, 45.0 >; // Rail dimensions, closed. #local dr_face_wth = 5; #local dr_side_wth = 10; // Thickness of drawer's side walls. #local dr_rear_wth = 10; // Thickness of drawer's rear wall. #local dr_rear_wdx = 2; // X displacement of rear wall rel to back. #local dr_bot_wth = 10; // Thickness of drawer's bottom wall. #local dr_bot_wdz = 2; // Z displacement of bottom plate rel to drawer bottom. #local dr_ey = 15; #local dr_po = false; // Plate-only. #local dr_frop = 1.0; #local thdim = bench_closet_drawer ( dr_sdim, dr_rail_dim, dr_face_wth, dr_side_wth, dr_rear_wth, dr_rear_wdx, dr_bot_wth, dr_bot_wdz, dr_ey, dr_po, show_plates, dr_frop, 0 ); #local thing = object{ bench_closet_drawer ( dr_sdim, dr_rail_dim, dr_face_wth, dr_side_wth, dr_rear_wth, dr_rear_wdx, dr_bot_wth, dr_bot_wdz, dr_ey, dr_po, show_plates, dr_frop, swh ) } #elseif (scn = 5) #include "bench_closet_handle.inc" #local thdim = bench_closet_handle(0); #local thing = object{ bench_closet_handle(1) translate thdim/2 } #elseif (scn = 6) #include "bench_closet_rail.inc" #local rail_dim = < 405.0, 12.7, 45.0 >; // Dimensions of rail. #local rail_frop = 1.0; #local thdim = bench_closet_rail(rail_dim, rail_frop, 0); #local thing = object{ bench_closet_rail(rail_dim, rail_frop, swh) } #elseif (scn = 7) #include "parafuso.inc" #local thdim = parafuso(50,20,tx_wood,0, 20,60,tx_rail, 15,200,tx_wood, 0); #local thing = object{ parafuso(50,20,tx_wood,0, 20,60,tx_rail, 15,200,tx_wood, swh) } #elseif (scn = 8) #include "bench_closet_drawer_box.inc" #local odim = < 420, 480, 120 >; #local dr_side_wth = 10; // Thickness of drawer's side walls. #local dr_rear_wth = 10; // Thickness of drawer's rear wall. #local dr_rear_wdx = 2; // X displacement of rear wall rel to back edge of side walls. #local dr_bot_wth = 10; // Thickness of drawer's bottom wall. #local dr_bot_wdz = 2; // Z displacement of bottom plate rel to bottom of side walls. #local thdim = bench_closet_drawer_box(odim, dr_side_wth, dr_rear_wth, dr_rear_wdx, dr_bot_wth, dr_bot_wdz, 0); #local thing = object{ bench_closet_drawer_box(odim, dr_side_wth, dr_rear_wth, dr_rear_wdx, dr_bot_wth, dr_bot_wdz, swh) } #else #include "bench_closet_painted_box.inc" #end // ---------------------------------------------------------------------- union{ object{ eixos(1000.0, 2.5) } object{ groundplane texture{ tx_floor } translate -3*xplode*z } object{ thing } } #include "camlight.inc" #if (view = 0) // Full view of object (assumed to have low corner at <0,0,0>): #declare centro_cena = thdim/2 + dropen/2*x; #declare raio_cena = 0.8*vlength(thdim) + dropen/2 + xplode; #declare dir_camera = < 14.00, 12.00, 8.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 1) // Full view from back: #declare centro_cena = thdim/2 + dropen/2*x; #declare raio_cena = 0.8*vlength(thdim) + dropen/2 + xplode; #declare dir_camera = < -14.00, 12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 2) // Top right corner small detail: #declare centro_cena = thdim; #declare raio_cena = 100; #declare dir_camera = < 14.00, 12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 3) // Top right corner larger detail: #declare centro_cena = thdim; #declare raio_cena = 250; #declare dir_camera = < 14.00, 12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #elseif (view = 4) // Center detail: #declare centro_cena = thdim/2; #declare raio_cena = 100; #declare dir_camera = < 14.00, 12.00, 4.00 >; #declare dist_camera = 5*raio_cena; #end #declare intens_luz = 1.10; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)