# G3*_PolygonAttr

## Syntax

      #include <nitro/gx/g3imm.h>
      #include <nitro/gx/g3b.h>
      #include <nitro/gx/g3c.h>

      void G3_PolygonAttr(
          int light,
          GXPolygonMode polyMode,
          GXCull cullMode,
          int polygonID,
          int alpha,
          int misc
      );

      // Below are APIs for creating the display list (command list):
      void G3B_PolygonAttr(GXDLInfo* info, ...);
      void G3C_PolygonAttr(GXDLInfo* info, ...);
      void G3BS_PolygonAttr(GXDLInfo* info, ...);
      void G3CS_PolygonAttr(GXDLInfo* info, ...);

## Arguments

`info` | Command List Information.
`light` | 4-bit mask to specify the light to illuminate
`polyMode` | Specifies polygon mode
`cullMode` | Specifies the screen to cull
`polygonID` | Specifies the polygon ID
`alpha` | Specifies the α value
`misc` | Bit field to specify other polygon attributes

## Return Values

None.

## Description

This function sets the polygon attribute values.
`light` is the 4-bit flag that specifies, in order from the lower bit of the lower 4 bits, whether Light 0, Light 1, Light 2, and Light 3 are ON/OFF. The polygon mode is specified as a `GXPolygonMode` value by the polyMode argument. The polygon culling method is specified as a `GXCull` value by the cullMode argument. `polygonID` is the argument that specifies the polygon ID between 0 - 63. Used when rendering translucent polygons, shadow polygons, and edge marking. `alpha` is the argument that specifies the α value for a polygon between 0 - 31. A setting of 31 specifies an opaque polygon; a setting of 0 specifies a wireframe (configure it to be hidden using the `G3X_AlphaTest` function); and settings between 1 and 30 specify translucent polygons. `misc` is a bit field that consists of the remaining attribute flags, and passes the logical sum of `GXPolygonAttrMisc`-type values.

`GX_POLYGONMODE_MODULATE` | Modulation mode
`GX_POLYGONMODE_DECAL` | Decal mode
`GX_POLYGONMODE_TOON` | Toon shading/highlight shading mode
`GX_POLYGONMODE_SHADOW` | Shadow polygon mode

`GX_CULL_ALL` | Do not show on either plane
`GX_CULL_FRONT` | Do not show front plane
`GX_CULL_BACK` | Do not show back plane
`GX_CULL_NONE` | Show both planes

`GX_POLYGON_ATTR_MISC_NONE` | Indicates that nothing is visible.
`GX_POLYGON_ATTR_MISC_XLU_DEPTH_UPDATE` | Update the depth buffer when rendering translucent polygons.
`GX_POLYGON_ATTR_MISC_FAR_CLIPPING` | Clip if the polygon intersects the FAR plane (delete if intersects when not specified).
`GX_POLYGON_ATTR_MISC_DISP_1DOT` | Show 1-dot polygons. Also see the `G3X_SetDisp1DotDepth` function.
`GX_POLYGON_ATTR_MISC_DEPTHTEST_DECAL` | Renders when the depth value of the fragment matches the depth value in the depth buffer. When not specified, renders when smaller than the depth value.
`GX_POLYGON_ATTR_MISC_FOG` | The rendering engine performs fog blending.

The following indicate type definitions for `GXPolygonMode`, `GXCull`, and `GXPolygonAttrMisc` types.

    typedef enum
    {
        GX_POLYGONMODE_MODULATE = 0,
        GX_POLYGONMODE_DECAL = 1,
        GX_POLYGONMODE_TOON = 2,
        GX_POLYGONMODE_SHADOW = 3
    }
    GXPolygonMode;

    typedef enum
    {
        GX_CULL_ALL = 0,
        GX_CULL_FRONT = 1,
        GX_CULL_BACK = 2,
        GX_CULL_NONE = 3
    }
    GXCull;

    typedef enum
    {
        GX_POLYGON_ATTR_MISC_NONE = 0,
        GX_POLYGON_ATTR_MISC_XLU_DEPTH_UPDATE = 1 << REG_G3_POLYGON_ATTR_XL_SHIFT,
        GX_POLYGON_ATTR_MISC_FAR_CLIPPING = 1 << REG_G3_POLYGON_ATTR_FC_SHIFT,
        GX_POLYGON_ATTR_MISC_DISP_1DOT = 1 << REG_G3_POLYGON_ATTR_D1_SHIFT,
        GX_POLYGON_ATTR_MISC_DEPTHTEST_DECAL = 1 << REG_G3_POLYGON_ATTR_DT_SHIFT,
        GX_POLYGON_ATTR_MISC_FOG = 1 << REG_G3_POLYGON_ATTR_FE_SHIFT
    }
    GXPolygonAttrMisc;

## See Also

## Revision History

2004/01/19 Initial version.

CONFIDENTIAL