As with all texture mapping, two steps are required: texture coordinate generation and texture map definition. This object defines the texture map. Currently, two texture map coordinate generators for cutting are available: texture_map_cut_planes and texture_map_cut_quadrics.
This object is powerful, yet complex. The user should experiment with its many combinations to become familiar with its capablilites. Boolean texture divides texture space into four regions labeled to show the boolean relationship between two cuts:
0 s 1 0 --------------------- | | | | | | | in/in | out/in | | | | | | | t|-------------------| | | | | | | | out/in | out/out | | | | | | | 1 -------------------- where in/in is inside cut 1 and cut 2, out/in is outside cut 1 and inside cut 2, etc. The boundaries between the regions are also labeled: on/in, on/out, out/on, in/on, on/on.
To create a boolean texture, set each of the regions with its corresponding instance variable. For example, out/in is set with instance variable out_in. The values of the texture map contain both alpha (transparency) and intensity and are normally set using hexadecimal scalars. To set the out/out region to an alpha of .5 and an intensity of 1, send out_out=0x7fff.
NOTE: normally set linear_interpolate_off! and repeat_off! to get acceptable results.
on_on, on_in, on_out, in_on, out_on are the five transition regions of the texture map. These can be used to draw outline between the regions.
thickness defines the width of the transition regions.
resolution is the resolution of the texture map.
/* define resolution of each map */ scalar new: `resolution' =64; /* transition thickness */ scalar new: `thickness' = 0; /* scalar to define texture pixels */ vector new: `solid' = (1,1); /* transparency=1, intensity=1 */ vector new: `clear' = (0,1); /* transparency=0, intensity=1 */ vector new: `edge' = (1,.5); /* transparency=1, intensity=.5 */
/* the 16 possible */
boolean_texture new: case_0 in_in = SOLID out_in = SOLID
in_out = SOLID out_out = SOLID
on_on = SOLID on_in = SOLID on_out = SOLID in_on = SOLID out_on = SOLID ; boolean_texture new: case_1 in_in = CLEAR out_in = SOLID
in_out = SOLID
out_out = SOLID
on_on = EDGE on_in = EDGE on_out = SOLID in_on = EDGE out_on = SOLID ; boolean_texture new: case_2 in_in = SOLID out_in = CLEAR
in_out = SOLID out_out = SOLID
on_on = EDGE on_in = EDGE on_out = SOLID in_on = SOLID out_on = EDGE ; boolean_texture new: case_3 in_in = CLEAR out_in = CLEAR
in_out = SOLID out_out = SOLID
on_on = EDGE on_in = CLEAR on_out = SOLID in_on = EDGE out_on = EDGE ; boolean_texture new: case_4 in_in = SOLID out_in = SOLID
in_out = CLEAR out_out = SOLID
on_on = EDGE on_in = SOLID on_out = EDGE in_on = EDGE out_on = SOLID ;
boolean_texture new: case_5 in_in = CLEAR out_in = SOLID
in_out = CLEAR out_out = SOLID
on_on = EDGE on_in = EDGE on_out = EDGE in_on = CLEAR out_on = SOLID ; boolean_texture new: case_6 in_in = SOLID out_in = CLEAR
in_out = CLEAR out_out = SOLID
on_on = EDGE on_in = EDGE on_out = EDGE in_on = EDGE out_on = EDGE ; boolean_texture new: case_7 in_in = CLEAR out_in = CLEAR
in_out = CLEAR out_out = SOLID
on_on = EDGE on_in = CLEAR on_out = EDGE in_on = CLEAR out_on = EDGE ;
boolean_texture new: case_8 in_in = SOLID out_in = SOLID
in_out = SOLID out_out = CLEAR
on_on = EDGE on_in = SOLID on_out = EDGE in_on = SOLID out_on = EDGE ;
boolean_texture new: case_9 in_in = CLEAR out_in = SOLID
in_out = SOLID out_out = CLEAR
on_on = EDGE on_in = EDGE on_out = EDGE in_on = EDGE out_on = EDGE ;
boolean_texture new: case_10 in_in = SOLID out_in = CLEAR
in_out = SOLID out_out = CLEAR
on_on = EDGE on_in = EDGE on_out = EDGE in_on = SOLID out_on = CLEAR ;
boolean_texture new: case_11 in_in = CLEAR in_out = SOLID out_in = CLEAR out_out = CLEAR on_on = EDGE on_in = CLEAR on_out = EDGE in_on = EDGE out_on = CLEAR ; boolean_texture new: case_12 in_in = SOLID in_out = CLEAR out_in = SOLID out_out = CLEAR on_on = EDGE on_in = SOLID on_out = CLEAR in_on = EDGE out_on = EDGE ;
boolean_texture new: case_13 in_in = CLEAR in_out = CLEAR out_in = SOLID out_out = CLEAR on_on = EDGE on_in = EDGE on_out = CLEAR in_on = CLEAR
out_on = EDGE ;
boolean_texture new: case_14 in_in = SOLID in_out = CLEAR out_in = CLEAR out_out = CLEAR on_on = EDGE on_in = EDGE on_out = CLEAR in_on = EDGE out_on = CLEAR ;
boolean_texture new: case_15 in_in = CLEAR in_out = CLEAR out_in = CLEAR out_out = CLEAR on_on = CLEAR on_in = CLEAR on_out = CLEAR in_on = CLEAR out_on = CLEAR ;
collection new: allcuts members=[boolean_texture instances?] thickness=thickness xsize=resolution ysize=resolution linear_interpolate_off! repeat_off! ;