guAlphaSource() is a higher level interface to the Voodoo Graphics alpha combine unit than grAlphaCombine(), which was presented in Chapter Chapter 6. .
void guAlphaSource( GrAlphaSourceMode_t mode )
The alpha combine unit has two configurable inputs and one output. The output of the alpha combine unit gets fed into the alpha testing and blending units. The selection of the alocal input is important because it is used in the color combine unit.
The following table describes how alocal and output alpha are computed based on the mode.
Table Glide Utilities .2 Alpha combine unit modes.
mode
|
output
|
alocal
|
GR_ALPHASOURCE_CC_ALPHA
|
constant color a¨
|
constant color a¨
|
GR_ALPHASOURCE_ITERATED_ALPHA
|
iterated vertex a
|
iterated vertex a
|
GR_ALPHASOURCE_TEXTURE_ALPHA
|
texture aª
|
none
|
GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA
|
texture a * iterated aª
|
iterated vertex a
|
¨Constant color a is the value passed to grConstantColorValue().
ªIf texture has no alpha component, texture a is 255.
Configuring the Glide texture pipeline consists of setting up a mipmap source and configuring the texture combine function on each TMU. Mipmap sources are established by downloading mipmaps and naming them as the current texel source.
Chapter 9 presented a collection of Glide functions that configure the texture combine units; Chapter 10 talked about managing texture memory and downloading mipmaps. Most of the memory management details were left to the application.
The Glide Utilities Library includes some higher level routines that configure the texture combine unit on a functional level and that provides increased memory management functionality.
guTexCombineFunction() specifies the function used when combining textures on tmu with incoming textures from the neighboring TMU. Texture combining operations allow for interesting effects such as detail and projected texturing as well as the trilinear filtering of LOD blending.
void guTexCombineFunction( GrChipID_t tmu, GrTextureCombineFnc_t function )
The following table describes the available texture combine functions and their effects. clocal represents the color components generated by indexing and filtering from the mipmap stored on tmu, and cother represents the incoming color components from the neighboring TMU. Typically, the texture combine function on the neighboring TMU operates in GR_TEXTURECOMBINE_DECAL (just pass the texel through) mode.
Table Glide Utilities .3 Texture combine functions.
texture combine function
|
result
|
effect
|
GR_TEXTURECOMBINE_ZERO
|
0
|
0x00 per component
|
GR_TEXTURECOMBINE_DECAL
|
clocal
|
decal texture
|
GR_TEXTURECOMBINE_OTHER
|
cother
|
pass through
|
GR_TEXTURECOMBINE_ADD
|
cother + clocal
|
additive texture
|
GR_TEXTURECOMBINE_MULTIPLY
|
cother · clocal
|
modulated texture
|
GR_TEXTURECOMBINE_SUBTRACT
|
cother – clocal
|
subtractive texture
|
GR_TEXTURECOMBINE_DETAIL
|
blend (cother, clocal)
|
composite textures with composite on selected TMU
|
GR_TEXTURECOMBINE_DETAIL_OTHER
|
blend (cother, clocal)
|
composite textures with composite on neighboring TMU
|
GR_TEXTURECOMBINE_TRILINEAR_ODD
|
blend (cother, clocal)
|
LOD blended textures with odd levels on selected TMU
|
GR_TEXTURECOMBINE_TRILINEAR_EVEN
|
blend (cother, clocal)
|
LOD blended textures with even levels on selected TMU
|
GR_TEXTURECOMBINE_ONE
|
255
|
0xFF per component
|
Share with your friends: |