GXSetTevColorOp

C Specification

#include <revolution/gx.h>
void GXSetTevColorOp(
GXTevStageID    stage,
GXTevOp         op,
GXTevBias       bias,
GXTevScale      scale,
GXBool          clamp,
GXTevRegID      out_reg );

Arguments

stage The TEV stage name.
Accepted values are: GX_TEVSTAGE0, GX_TEVSTAGE1, GX_TEVSTAGE2 through 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_RGB8_GT R: d[R] + ((a[R] > b[R]) ? c[R] :0 );
G: d[G] + ((a[G] > b[G]) ? c[G] :0 );
B: d[B] + ((a[B] > b[B]) ? c[B] : 0 );
GX_TEV_COMP_RGB8_EQ R: d[R] + ((a[R] == b[R]) ? c[R] :0 );
G: d[G] + ((a[G] == b[G]) ? c[G] :0 );
B: d[B] + ((a[B] == b[B]) ? c[B] : 0 );
add_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 that the bias works 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
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 clamping operation for the color combiner function for this stage of the Texture Environment (TEV) unit. This function also specifies the output register, out_reg, that will contain the result of the color combiner function. The color combiner function is:

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

The input parameters a, b, c, and d are selected using the GXSetTevColorIn function. The a, b, and c inputs are unsigned 8b inputs (0 <= a,b,c <= 255). The dinput is a signed 10b input (-1024 <= d <= 1023). The result, out_reg, can also be a signed 10-bit result, depending on the clamp enable and the current clamping mode,

The TEV output registers are shared among all the TEV stages. The TEV output registers can also be used as constant color inputs, so the application should be careful to allocate input and ouput registers so no collision occurs when implementing a particular equation. The application must output to GX_TEVPREV in the last active TEV stage.

The function GXSetTevOp provides a simpler way to set the parameters of GXSetTevColorIn and GXSetTevColorOp based on predefined equation names. You should not mix usage of GXSetTevOp and GXSetTevColorIn/GXSetTevColorOp. GXSetTevOp makes some assumptions about the output register usage, namely that GX_TEVPREV is always the output register and is used to pass the result of the previous TEV stage to the next TEV stage.

See Also

Revision History

03/01/2006 Initial version.