Skip to content

Commit 2ed8077

Browse files
Add GX_SetTevIndWarp Function (#66)
* Implement GX_SetTevIndWarp * Expose GX_SetTevIndWarp * Document GX_SetTevIndWarp
1 parent f43c818 commit 2ed8077

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

gc/ogc/gx.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,6 +3418,20 @@ void GX_SetTevIndBumpXYZ(u8 tevstage,u8 indstage,u8 mtx_sel);
34183418
*/
34193419
void GX_SetTevIndTile(u8 tevstage,u8 indtexid,u16 tilesize_x,u16 tilesize_y,u16 tilespacing_x,u16 tilespacing_y,u8 indtexfmt,u8 indtexmtx,u8 bias_sel,u8 alpha_sel);
34203420

3421+
/*!
3422+
* \fn void GX_SetTevIndWarp(u8 tevstage, u8 indtexid, u8 bias_flag, u8 replace_tex, u8 mtxid)
3423+
* \brief Used to warp a normal texture lookup using an indirect texture map with 8-bit offsets.
3424+
*
3425+
* \param[in] tevstage \ref tevstage that is being affected
3426+
* \param[in] indtexid \ref indtexstage results to use with this TEV stage
3427+
* \param[in] bias_flag biases the indirect texture map offsets by -128 if the value is GX_TRUE
3428+
* \param[in] replace_tex GX_TRUE makes the indirect texture map offsets replace the input texture coordinates rather than offset them as with GX_FALSE
3429+
* \param[in] mtxid which \ref indtexmtx to use for warping the texture
3430+
* \return none
3431+
*/
3432+
3433+
void GX_SetTevIndWarp(u8 tevstage, u8 indtexid, u8 bias_flag, u8 replace_tex, u8 mtxid);
3434+
34213435
/*!
34223436
* \fn void GX_SetTevIndRepeat(u8 tevstage)
34233437
* \brief Set a given TEV stage to use the same texture coordinates as were computed in the previous stage.

libogc/gx.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4174,6 +4174,21 @@ void GX_SetIndTexCoordScale(u8 indtexid,u8 scale_s,u8 scale_t)
41744174
}
41754175
}
41764176

4177+
void GX_SetTevIndWarp(u8 tevstage, u8 indtexid, u8 bias_flag, u8 replace_tex, u8 mtxid)
4178+
{
4179+
u8 wrap = GX_ITW_OFF;
4180+
u8 bias = GX_ITB_NONE;
4181+
if(replace_tex)
4182+
{
4183+
wrap = GX_ITW_0;
4184+
}
4185+
if(bias_flag)
4186+
{
4187+
bias = GX_ITB_STU;
4188+
}
4189+
GX_SetTevIndirect(tevstage, indtexid, GX_ITF_8, bias, mtxid, wrap, wrap, GX_FALSE, GX_FALSE, GX_ITBA_OFF);
4190+
}
4191+
41774192
void GX_SetTevIndTile(u8 tevstage,u8 indtexid,u16 tilesize_x,u16 tilesize_y,u16 tilespacing_x,u16 tilespacing_y,u8 indtexfmt,u8 indtexmtx,u8 bias_sel,u8 alpha_sel)
41784193
{
41794194
s32 wrap_s,wrap_t;

0 commit comments

Comments
 (0)