#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.
This function, f, is called by the GXLoadTexObj function to get an available texture region. The GXInit function calls the GXSetTexRegionCallback function to set a default region-allocation policy. The programmer can override this default region allocation by implementing their 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, GX Default TMEM Configuration
2006/03/01 Initial version.
CONFIDENTIAL