// Last edited on 2014-07-02 14:08:44 by stolfilocal #local n = 3; // Number of lines #local font = "tt-fonts/arialbd.ttf" #local logo45_line = array[n]; // The texts in each line. #local logo45_invert = array[n]; // Whether the text should be positive or excavated. #local logo45_tx = array[n]; // Texture to use for the words. #local logo45_ty = array[n]; // Texture to use for the background, if inverted. #local logo45_invert[0] = 0; #local logo45_line[0] = text{ ttf font concat("COMPUTA", chr(130), chr(204), "O") 1 0 } #local logo45_tx[0] = texture{ tx_green } #local logo45_ty[0] = texture{ tx_orange } #local logo45_invert[1] = 1; #local logo45_line[1] = text{ ttf font "45" 1 0 } #local logo45_tx[1] = texture{ tx_red } #local logo45_ty[1] = texture{ tx_yolk } #local logo45_invert[2] = 0; #local logo45_line[2] = text{ ttf font "ANOS" 1 0 translate -0.1*x } #local logo45_tx[2] = texture{ tx_green } #local logo45_ty[2] = texture{ tx_blue } #local szX = 6.0; #local thk = 3.0; #local szY = 0; #declare logo45 = union{ #local i = n - 1; #while (i >= 0) // Grab the bare text of line {i}: #local word = logo45_line[i] // Invert it if needed: #if (logo45_invert[i] = 1) #local wlo = min_extent(word); #local whi = max_extent(word); #local margX = 0.05; // X margin of block. #local margY = 0.05; // Y margin of block #local trZ = 0.95*(whi.z - wlo.z); // Z displacement of text. #local line = difference{ box{ wlo - < margX, margY, 0 >, whi + < margX, margY, 0 > texture{ logo45_ty[i] } } object{ word translate trZ*z texture{ logo45_tx[i] } } } #else #local line = object{ word texture{ logo45_tx[i] } } #end // Get the {line}'s dimensions: #local lo = min_extent(line); #local hi = max_extent(line); // Compute the X and Y scale factor to fit the common width {szX}: #local scaleXY = szX/(hi.x - lo.x); // Compute the Z scale factor to fit the common depth {szX}: #local scaleZ = thk/(hi.z - lo.z); // Dimensions after scaling: #local dY = scaleXY*(hi.y - lo.y); // Height of line. #local mY = 0.01*dY; // Spacing above and below line. // Stack it: object{ line translate -lo scale < scaleXY, scaleXY, scaleZ > translate (szY + mY)*y } #local szY = szY + dY + 2*mY; #local i = i - 1; #end } #declare logo45_sz = < szX, szY, thk >;