N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## guLoadTextureBlockMipMap

Syntax

    #include "gu.h"

    int guLoadTextureBlockMipMap(Gfx **glistp,
       unsigned char *tbuf,
       Image *imp,
       unsigned char pal,
       unsigned char cms,
       unsigned char cmt,
       unsigned char masks,
       unsigned char maskt,
       unsigned char shifts,
       unsigned char shiftt
       unsigned char cfs,
       unsigned char cft)

Arguments

- glistp is the address of the pointer to the returned display list (the pointer is incremented to point to end of display list)

- tbuf is the pointer to the buffer to hold the MIP map tiles. Make sure it is no bigger than TMEM - tbuf is an RSP segment address

- imp is the pointer to the image structure that contains information about the source image. For example:

      imp->base =
         (unsigned char *)RGBA16grid_32[0];
      imp->fmt = G_IM_FMT_RGBA;
      imp->siz = G_IM_SIZ_16b;

      /* source image 'x' size */
      imp->xsize = 32;

      /* source image 'y' size */
      imp->ysize = 32;

      /* size of a source image row */
      imp->lsize =
         32* sizeof(unsigned short);

      /* offset into storage buffer.
         Needs to be zero */
      imp->addr = 0;

      /* width of rectangular section of
         image(tile) to be extracted for
         MIP mapping */
      imp->w = 32;

      /* height of rectangular section
         of image to be extracted for
         MIP mapping */
      imp->h = 32;

      /* 's' and 't' offsets
         into source image to */
      imp->s = 0;

      /* define rectangular tile */
      imp->t = 0;

- pal is the palette number for color index textures

- cms cmt are the s and t clamp and mirror parameters (see gDPLoadTextureBlock)

- masks maskt are the s and t mask for wrapping (see gDPLoadTextureBlock)

- shifts shiftt are the s and t address shifts for indexing into MIP map tiles (see gDPLoadTextureBlock)

- cfs cft are the clamp flags for filtering along s and t axes. If set, the overhanging portion of filter kernel will pick up same texel as the edge of the texture. If not set, the kernel overhang will wrap to the opposite edge of the texture array

Explanation
It computes a MIP map pyramid from a source texture array and returns a display list for loading and rendering the MIP mapped texture.
This call takes a texture image in system memory and creates a MIP map pyramid in tbuf. Each level in the pyramid is filtered down from the previous level by applying a 3x3 filter kernel. A display list for loading the tiles and setting tile parameters is inserted into the display list pointed to by glistp. On return, the pointer is incremented to the end of the inserted list. The value returned is interpreted in this manner:

- 0 means it was successful.
- 1 means the MIP map was too big to load into TMEM. This is not a fatal error. As many levels as space allows will be loaded.
- 2 means the texel format is not supported. (all ultra64 texel formats except RGBA32 and YUV are supported).

Note
Mipmapping textures with alpha channels that are used for billboard cutouts (trees) will result in the cutout shape changing with the LOD. Texel formats with a 1-bit alpha (such as RGBA16, IA4) are especially prone to this problem.
See Also
gDPLoadTexture

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated April, 1999