# G3X_SetFog

## C Specification

      #include <nitro/gx/g3x.h>

      void G3X_SetFog(
          BOOL enable,
          GXFogBlend fogMode,
          GXFogSlope fogSlope,
          int fogOffset
      );

## Arguments

enable | Sets whether fog is enabled
fogMode | Sets whether fog will be applied to color in addition to the a-value
fogSlope | Sets the gradient for applying fog
fogOffset | Sets the depth value where fog calculations start

## Return Values

None.

## Description

This function sets Fog to enable/disable and how fog is applied. The larger the last number in the `GXFogSlope` format symbol indicates more flexibility in how the fog is applied. That is to say, if this value is `x`, the depth value is applied from `fogOffset` to `fogOffset` + `x` and the fog gradually becomes denser (the index in the referenced fog table grows larger).

`GX_FOGBLEND_COLOR_ALPHA` | `Fog blending applied to the pixel's color value and α-value`
`GX_FOGBLEND_ALPHA` | `Fog blending applied only to the pixel's α-value`

`GX_FOGSLOPE_0x8000` | Fog becomes denser according to the depth value with a width of 0x8000
`GX_FOGSLOPE_0x4000` | Fog becomes denser according to the depth value with a width of 0x4000
`GX_FOGSLOPE_0x2000` | Fog becomes denser according to the depth value with a width of 0x2000
`GX_FOGSLOPE_0x1000` | Fog becomes denser according to the depth value with a width of 0x1000
`GX_FOGSLOPE_0x0800` | Fog becomes denser according to the depth value with a width of 0x0800
`GX_FOGSLOPE_0x0400` | Fog becomes denser according to the depth value with a width of 0x0400
`GX_FOGSLOPE_0x0200` | Fog becomes denser according to the depth value with a width of 0x0200
`GX_FOGSLOPE_0x0100` | Fog becomes denser according to the depth value with a width of 0x0100
`GX_FOGSLOPE_0x0080` | Fog becomes denser according to the depth value with a width of 0x0080
`GX_FOGSLOPE_0x0040` | Fog becomes denser according to the depth value with a width of 0x0040
`GX_FOGSLOPE_0x0020` | Fog becomes denser according to the depth value with a width of 0x0020

Below are the matrix format type definitions used in the argument.

    typedef enum
    {
        GX_FOGBLEND_COLOR_ALPHA = 0,
        GX_FOGBLEND_ALPHA = 1
    }
    GXFogBlend;

    typedef enum
    {
        GX_FOGSLOPE_0x8000 = 0,
        GX_FOGSLOPE_0x4000 = 1,
        GX_FOGSLOPE_0x2000 = 2,
        GX_FOGSLOPE_0x1000 = 3,
        GX_FOGSLOPE_0x0800 = 4,
        GX_FOGSLOPE_0x0400 = 5,
        GX_FOGSLOPE_0x0200 = 6,
        GX_FOGSLOPE_0x0100 = 7,
        GX_FOGSLOPE_0x0080 = 8,
        GX_FOGSLOPE_0x0040 = 9,
        GX_FOGSLOPE_0x0020 = 10
    }
    GXFogSlope;

## See Also

`G3X_SetFogColor`, `G3X_SetFogTable`

## Revision History

01/19/2004 Initial version.

CONFIDENTIAL