clocal
GR_COMBINE_FUNCTION_LOCAL_ALPHA
|
alocal
|
GR_COMBINE_FUNCTION_SCALE_OTHER
GR_COMBINE_FUNCTION_BLEND_OTHER
|
f * cother
|
GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL
|
f * cother + clocal
|
GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA
|
f * cother + alocal
|
GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL
|
f * (cother – clocal)
|
GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL
GR_COMBINE_FUNCTION_BLEND
|
f * (cother – clocal) + clocal
º f * cother + (1 – f) * clocal
|
GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA
|
f * (cother – clocal) + alocal
|
GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL
GR_COMBINE_FUNCTION_BLEND_LOCAL
|
f * (– clocal) + clocal
º (1 – f) * clocal
|
GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA
|
f * (– clocal) + alocal
|
Table Color and Lighting.2 The color combine function scale factor.
The second argument to grColorCombine(), factor, specifies a scale factor, called f in the formulas delineated in Table Color and Lighting.1; its value is chosen from among the symbols listed in the left hand column of the table below. The right hand column gives the scale factor that corresponds to each symbolic name. Clocal is specified by the third argument to grColorCombine(), alocal and aother are defined in the grAlphaCombine() function described in the next chapter, and atexture comes from the texture combine unit, described in Chapter Chapter 9. .
Combine factor
|
scale factor (f)
|
GR_COMBINE_FACTOR_NONE
|
unspecified
|
GR_COMBINE_FACTOR_ZERO
|
0
|
GR_COMBINE_FACTOR_LOCAL
|
clocal / 255
|
GR_COMBINE_FACTOR_OTHER_ALPHA
|
aother / 255
|
GR_COMBINE_FACTOR_LOCAL_ALPHA
|
alocal / 255
|
GR_COMBINE_FACTOR_TEXTURE_ALPHA
|
atexture / 255
|
GR_COMBINE_FACTOR_ONE
|
1
|
GR_COMBINE_FACTOR_ONE_MINUS_LOCAL
|
1 – clocal / 255
|
GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA
|
1 – aother / 255
|
GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA
|
1 – alocal / 255
|
GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA
|
1 – atexture / 255
|
The third and fourth arguments to grColorCombine() set values for the clocal and cother variables that appear in the combining functions; the choices are shown in Table Color and Lighting.3. Iterated colors are computed by iterating the colors specified in GrVertex structures passed to drawing functions. The texture color comes from the texture combine unit (see Chapter Chapter 9. ), and the constant color is set by grConstantColorValue() (described earlier in this chapter).
The func formula computes the red, green, and blue color components. The result of the computation is clamped to [0..255] and may be bit-wise inverted, based on the final argument to grColorCombine(), invert. Inverting the bits in a color component c is the same as computing (1.0 – c) for floating point values in the range [0..1] or (255 – c) for 8-bit values in the range [0..255].
Table Color and Lighting.3 Choosing local and other colors for the color combine unit.
The third and fourth arguments to grColorCombine(), local and other, specify the sources for the clocal and cother values that appear in the color combine formulas delineated in Table Color and Lighting.1; their values are chosen from among the symbols in the tables below. Iterated colors are computed by iterating the colors specified in GrVertex structures passed to drawing functions. The texture color comes from the texture combine unit, and the constant color is set by grConstantColorValue().
Local combine source
|
local color (clocal)
|
GR_COMBINE_LOCAL_NONE
|
unspecified color
|
GR_COMBINE_LOCAL_ITERATED
|
iterated vertex color (Gouraud shading)
|
GR_COMBINE_LOCAL_CONSTANT
|
constant color
|
other combine source
|
other color (cother)
|
GR_COMBINE_OTHER_NONE
|
unspecified color
|
GR_COMBINE_OTHER_ITERATED
|
iterated vertex color (Gouraud shading)
|
GR_COMBINE_OTHER_TEXTURE
|
color from texture map
|
GR_COMBINE_OTHER_CONSTANT
|
constant color
|
The color combine unit computes the source color for the remainder of the rendering pipeline. The default color combine mode is
Share with your friends: |