// Last edited on 2005-05-22 23:04:46 by stolfi // PC model #declare cpu_pedestal_texture = texture { pigment { color rgb < 0.950, 0.950, 0.950 > } finish { ambient 0.25 diffuse 0.75 } } #declare crt_texture = texture { pigment { color rgb < 0.950, 0.950, 0.950 > } finish { ambient 0.25 diffuse 0.75 } } #declare kbd_texture = texture { pigment { color rgb < 0.950, 0.950, 0.950 > } finish { ambient 0.25 diffuse 0.75 } } #declare cpu_tower_texture = texture { pigment { color rgb < 1.000, 0.980, 0.900 > } finish { ambient 0.25 diffuse 0.75 } } #declare computer_wx = 1.000; // Nominal width of a computer slot on a bench. #macro computer_crt(wx,wy,wz) // {wx,wy,wz} are the X,Y,Z dimensions. // The object will have the base at Z=0, screen center on Z axis. #local lo = < -wx/2, -0.25*wy, 0 >; #local hi = < +wx/2, +0.75*wy, wz >; intersection { box { lo, hi } plane { z,0 rotate -17*x translate +wz*z } plane { -z,0 rotate 10*x } plane { x,0 rotate 17*z translate +wx/2*x } plane { -x,0 rotate -17*z translate -wx/2*x } texture { crt_texture } bounded_by { box { lo-0.001, hi+0.001 } } translate -lo.y*y } #end #macro computer(mchk,rev) // {mchk} is the computer type: 1 = pedestal, 2 = tower // {rev} flips the computer left-to-right. // Either way, the object's base is at Z=0, centered in X at origin, // slightly offset towards positive Y #local kbd_dims = < 0.480, 0.160, 0.035 >; #local kbd_dist = 0.040; // Distance from kbd to thing behind it. union { // First, assemble things so that center of display is on Z axis. // Record current nominal X and Y range in {max_x,min_x,max_y,min_y} #if (mchk = 1) // Pedestal type #local cpu_dims = < 0.420, 0.430, 0.160 >; #local crt_dims = < 0.360, 0.380, 0.400 >; #local crt_of_y = 0.020; // Y offset of front of crt: // Put cpu with front center on Z axis: box { < -cpu_dims.x/2, 0, 0 >, < +cpu_dims.x/2, cpu_dims.y, cpu_dims.z > texture { cpu_pedestal_texture } } // Put crt on top of cpu, front-aligned plus Y offset: object { computer_crt(crt_dims.x, crt_dims.y, crt_dims.z) translate crt_of_y*y translate cpu_dims.z*z } // Put keyboard in front of cpu/crt stack: box { < -kbd_dims.x/2, 0, 0 >, < +kbd_dims.x/2, kbd_dims.y, kbd_dims.z > texture { kbd_texture } translate -(kbd_dims.y + kbd_dist)*y } #local max_x = max(cpu_dims.x,crt_dims.x)/2; #local min_x = -max_x; #local max_y = cpu_dims.y; // Even if crt extends beyond that. #local min_y = -(kbd_dims.y + kbd_dist); #end #if (mchk = 2) // Tower type #local cpu_dims = < 0.210, 0.450, 0.650 >; #local crt_dims = < 0.400, 0.450, 0.450 >; #local cpu_crt_sp = 0.150; // X space between units. // Put crt with center on Z axis: object { computer_crt(crt_dims.x, crt_dims.y, crt_dims.z) } // Put cpu at its left, back-aligned: box { < -cpu_dims.x/2, 0, 0 >, < +cpu_dims.x/2, cpu_dims.y, cpu_dims.z > texture { cpu_tower_texture } translate -(cpu_dims.x/2 + cpu_crt_sp + crt_dims.x/2)*x translate (crt_dims.y - cpu_dims.y)*y } // Put keyboard in front of crt: box { < -kbd_dims.x/2, 0, 0 >, < +kbd_dims.x/2, kbd_dims.y, kbd_dims.z > texture { kbd_texture } translate -(kbd_dims.y + kbd_dist)*y } #local max_x = crt_dims.x/2; #local min_x = -(cpu_dims.x + cpu_crt_sp + crt_dims.x/2); #local max_y = crt_dims.y; // cpu is back-aligned. #local min_y = -max(kbd_dims.y + kbd_dist, cpu_dims.y - crt_dims.y); #end // Translate so that the whole thing is centered on the Z-axis: translate -(max_x+min_x)/2*x translate -(max_y+min_y)/2*y #if (rev) scale <-1,1,1> #end } #end