GXSetTevAlphaOp

Syntax

#include <revolution/gx.h>

void GXSetTevAlphaOp(
    GXTevStageID    stage,
    GXTevOp         op,
    GXTevBias       bias,
    GXTevScale      scale,
    GXBool          clamp,
    GXTevRegID      out_reg );

Arguments

stage Name of the TEV stage. Accepted values are GX_TEVSTAGE0, GX_TEVSTAGE1, GX_TEVSTAGE2, ... , GX_TEVSTAGE15.
op TEV operation. Accepted values are:
Name Equation
GX_TEV_ADD (d + ((1.0 - c)*a + c*b) + bias) * scale;
GX_TEV_SUB (d - ((1.0 - c)*a + c*b) + bias) * scale;
GX_TEV_COMP_R8_GT d + ((a[R] > b[R]) ? c : 0 );
GX_TEV_COMP_R8_EQ d + ((a[R] == b[R]) ? c : 0 );
GX_TEV_COMP_GR16_GT d + ((a[GR] > b[GR]) ? c : 0 );
GX_TEV_COMP_GR16_EQ d + ((a[GR] == b[GR]) ? c : 0 );
GX_TEV_COMP_BGR24_GT d + ((a[BGR] > b[BGR]) ? c : 0 );
GX_TEV_COMP_BGR24_EQ d + ((a[BGR] == b[BGR]) ? c : 0 );
GX_TEV_COMP_A8_GT d + ((a[A] > b[A]) ? c : 0 );
GX_TEV_COMP_A8_EQ d + ((a[A] > b[A]) ? c : 0 );
bias Bias value. Accepted values are:
Name Bias value.
GX_TB_ZERO 0
GX_TB_ADDHALF 0.5 ( 128 )
GX_TB_SUBHALF -0.5 ( -128 )
Note: The bias works properly only when op is set to GX_TEV_ADD or GX_TEV_SUB. Otherwise this argument must be always set to GX_TB_ZERO.
scale Scale value. Accepted values are:
Name Scale value.
GX_CS_SCALE_1 1
GX_CS_SCALE_2 2
GX_CS_SCALE_4 4
GX_CS_DIVIDE_2 1/2
Note: The scale works properly only when op is set to GX_TEV_ADD or GX_TEV_SUB. Otherwise this argument must be always set to GX_CS_SCALE_1.
clamp Clamp results when GX_TRUE. The range becomes 0.0 to 1.0 (0 to 255) after clamping.
out_reg Output register name. Accepted values are: GX_TEVPREV, GX_TEVREG0, GX_TEVREG1, GX_TEVREG2. The last active TEV stage must write GX_TEVPREV.

Return Values

None.

Description

This function sets the op, scale, bias, and clamp for the alpha combiner functions for this stage of the Texture Environment (TEV) unit. In addition, this function also specifies the output register, out_reg, that will contain the result of the alpha combiner function. The alpha combiner function is as follows.

out_reg = (d ( op ) (( 1.0 - c ) * a + c * b ) + bias ) * scale;

The input parameters, a, b, c, and d are set with the GXSetTevAlphaIn function. The inputs a, b, and c are unsigned, 8-bit numbers (where 0 <= a, b, c <= 255). The input d is a signed 10-bit number (where -1024 <= d <= 1023). The result, out_reg, can also be a signed 10-bit result, depending on the clamping state clamp and the current clamping mode.

The GXSetNumTevStages function must be used to make it possible to use sequentially-numbered TEV stages. Output the final active TEV stage's output and register to GX_TEVPREV.

See Also

GXSetTevAlphaIn, GXSetTevColorIn, GXSetTevColorOp, GXSetTevOp

Revision History

2008/05/12 Corrected the old function name, GXSetTevStages, to the new name, GXSetNumTevStages.

2006/03/01 Initial version.


CONFIDENTIAL