#include <revolution/gx.h>
typedef GXTexRegion *(* GXTexRegionCallback)(const GXTexObj *t_obj, GXTexMapID id);
GXTexRegionCallback GXSetTexRegionCallback( GXTexRegionCallback f );
f |
Pointer to a function which takes GXTexObj and GXTexMapID as arguments and returns a pointer to GXTexRegion. |
This function returns a pointer to the previous callback function.
The function f is called by GXLoadTexObj to obtain an available texture region. GXInit calls GXSetTexRegionCallback to set a default region-assignment policy. A programmer can override this default region assignment by implementing his own callback function. A pointer to the texture object and the texture map ID that are passed to GXLoadTexObj are provided to the callback function.
// example of simple texture region allocator
GXTexRegion *__GXGetTexRegion(const GXTexObj *tex_obj, GXTexMapID id)
{
#pragma unused(id)
static u32 i = 0;
return(__GXTexRegionTab[i++ & 0x0007]);
}
GXSetTexRegionCallback( __GXGetTexRegion ); // GXInit
GXInit
GXLoadTexObj
GXSetTlutRegionCallback
2006/03/01 Initial version.
CONFIDENTIAL