Table of Contents Glide Programming Guide


ffog[w] is computed by interpolating between entries in a fog table indexed with w



Download 6.22 Mb.
Page47/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   43   44   45   46   47   48   49   50   ...   106
GLIDEPGM
ffog[w] is computed by interpolating between entries in a fog table indexed with w

GR_FOG_ADD2

cout = (1-f )cin

f can be either the high order byte of iterated alpha or computed from the fog table

GR_FOG_MULT2

cout = f cfog

f can be either the high order byte of iterated alpha or computed from the fog table

The fogging factor f is determined by mode. If mode is GR_FOG_WITH_ITERATED_ALPHA, then f is equal to the integer bits of iterated alpha. If mode is GR_FOG_WITH_TABLE, then f is computed by interpolating between fog table entries, where the fog table is indexed with a floating point representation of the pixel’s w component. Fog is applied after color combining and before alpha blending.


The global fog color (cfog) is set by calling grFogColorValue(). The argument, value, is an RGBA color and is specified in the format defined in the cFormat parameter to grSstWinOpen() (see Chapter Chapter 3. ).
void grFogColorValue( GrColor_t value )

1Fogging With Iterated Alpha


To fog with iterated alpha, the fog mode must be set to GR_FOG_WITH_ITERATED_ALPHA. In this mode the high order eight bits of the value produced by the alpha iterator are used as the fog blending factor f. The fog equation becomes
cout = ai cfog + (1-ai)cin
Example Special Effects.1 presents a code segment that adds iterated alpha fog to a scene.
Example Special Effects.1 Fogging with iterated alpha.
The following code segment demonstrates fogging with iterated alpha. No setup is required beyond specifying a fog color and fog mode.
/* fog is white… color is ARGB format */
grFogColorValue( 0xFFFFFF);
grFogMode(GR_FOG_WITH_ITERATED_ALPHA);

/* vertices have alpha values that grow as the object gets more indistinct */


draw_objects();


Download 6.22 Mb.

Share with your friends:
1   ...   43   44   45   46   47   48   49   50   ...   106




The database is protected by copyright ©ininet.org 2024
send message

    Main page