#macro front_wall_car_gate( tag, g_dim, g_pass, show_new, g_open ) // A car gate. // {tag} tag for part identification. // {g_dim} dimensions of gate. The Y dim includes the frame, the X dim does not. // {g_pass} if true, the right wing is a narrower person gate. // {g_open} if true, show gate half-open. // {show_new} if true, uses the highlighting texture. // Origin is at left bottom corner of the nominal box {g_dim}. // Note that the frame will extend outside that box in X (but not in Y). #local g_frame_sx = 80; // X width of frame. #local g_frame_sy = 100; // Y width of frame. #local g_hinge_sy = 45; // Y gap between frame and grille. #local g_wings_sy = g_dim.y - 2*(g_frame_sy + g_hinge_sy); // Total Y width of wings (mobile parts). // Opening angle: #local g_open_deg = 60*g_open; // Texture: #if (show_new) #local w_tx = tx_grille_new #else #local w_tx = tx_grille #end #if (g_pass) #local g_gap_sy = 0; // Y gap between wings. #local w1_sy = 770; // Y width of right (person) wing. #local w0_sy = g_wings_sy - g_gap_sy - w1_sy; // Y width of left wing. #local w0_rot = -g_open_deg; #local w1_rot = +g_open_deg; #else #local g_gap_sy = 15; // Y gap between wings. #local w0_sy = (g_wings_sy - g_gap_sy)/2; // Y width of left wing. #local w1_sy = w0_sy; // Y width of Y wing. #local w0_rot = -g_open_deg; #local w1_rot = -g_open_deg; #end // The left wing of the gate: #local w0_tag = concat(tag, ".w0") #local w0_dim = < g_dim.x, w0_sy, g_dim.z >; #local w0_hinge_dy = g_frame_sy + g_hinge_sy/2; // Y coord of left hinge #local w0 = object{ front_wall_grille( w0_tag, w0_dim ) texture { w_tx } } // The right wing the gate: #local w1_tag = concat(tag, ".w1") #local w1_dim = < g_dim.x, w1_sy, g_dim.z >; #local w1_hinge_dy = g_dim.y - (g_frame_sy + g_hinge_sy/2); // Y coord of right hinge. #local w1 = object{ front_wall_grille( w1_tag, w1_dim ) texture{ w_tx } } // The fixed part of the gate: #local g_frame = sphere{ g_dim/2, 20 texture{ tx_bug } } // !!! Define !!! #local gate = union{ object{ g_frame } object{ w0 translate + w0_dim.x/2*x + g_hinge_sy/2*y rotate w0_rot*z translate - w0_dim.x/2*x + w0_hinge_dy*y } object{ w1 translate + w1_dim.x*x - (w1_dim.y + g_hinge_sy/2)*y rotate -w1_rot*z translate - w1_dim.x*x + w1_hinge_dy*y } } gate #end