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
|
|
gDPSetTile
gDPSetTileSize
Format
#include "gbi.h"
gDPSetTile(Gfx *gdl,
unsigned int fmt,
unsigned int siz,
unsigned int line,
unsigned int tmem,
unsigned int tile,
unsigned int palette,
unsigned int cmt,
unsigned int maskt,
unsigned int shiftt,
unsigned int cms,
unsigned int masks,
unsigned int shifts )
gDPSetTileSize(Gfx *gdl,
unsigned int tile,
unsigned int uls, ult,
unsigned int lrs, lrt )
Arguments
- gdl is the pointer to the graphics display list
- fmt is the texture image format (G_IM_FMT_RGBA, G_IM_FMT_YUV, G_IM_FMT_CI, G_IM_FMT_IA, G_IM_FMT_I)
- siz is the texel size (G_IM_SIZ_4b, G_IM_SIZ_8b, G_IM_SIZ_16b, G_IM_SIZ_32b)
- line is the size of one row (s axis) of the texture tile in TMEM words (64 bits)
- tmem is the address (0-511) of the origin of the texture tile in TMEM words (64 bits)
- tile is the index number (0-7) of the tile descriptor for which the parameters are being set
- palette a value that for 4-bit indexed textures indicates which texture lookup table palette (0-15) to use. An 8-bit index into the high half of TMEM is formed by placing the palette number in the 4 MSBs and the color index in the 4 LSBs
- cmt, cms specify the clamp, wrap, and mirror flags for the s and t axis (G_TX_NOMIRROR, G_TX_WRAP, G_TX_MIRROR, G_TX_CLAMP)
- maskt, masks specify the mask for the s and t texture axis (G_TX_NOMASK or a number specifying a power-of-two boundary to wrap on
- shiftt, shifts specify the shift value for s and t coordinates. Both left and right shifts are handled. It is used to scale MIP map
- levels and set the scale of the detail texture tile
- uls, ult specify the upper-left s and t coordinates of the texture tile, which can be used to offset the tile. It is also used as the lower boundary in clamp mode
- lrs, lrt specify the lower-right s and t coordinates of the texture tile. It is used only in clamp mode as the upper boundary for the clamp
What These Macros Do
The gDPSetTile and gDPSetTileSize macros set up multi-tile texture modes like mip-mapping, detail, and sharpen. Each macro also has a static version (gsDPSetTile gsDPSetTileSize).
There are eight tile descriptors, each of which can be thought of as a pointer into TMEM that describes a texture tile (A rectangular texture in TMEM). Multiple tile descriptors may point to the same texture tile in TMEM. Each tile descriptor has a set of parameters that describe the region of texture memory it is pointing to.
To set up a multi-tile mode, n texture tiles are loaded using one of the
gDPLoadTexture macros. Each texture tile is then described by setting a tile descriptor to point to the appropriate location in TMEM followed by the parameters for that tile. A MIP map pyramid of texture tiles, for
example, might be loaded using a gDPLoadTextureBlock macro or several
gDPLoadTextureTile macros. It can be described by a contiguous sequence of tile descriptors with the smallest descriptor number pointing to the finest level (largest map) and the largest one pointing to the coarsest level (smallest map). Indexing into these tiles is controlled by the cycleType
(See gDPSetCycleType), the primTile and maxLevel (See gSPTexture),
the Detail mode (See gDPSetTextureDetail), and whether LOD is turned on or not (See gDPSetTextureLOD).
For mip-mapping, you need to turn LOD on with the RDP in two-cycle mode. Indexing into the texture tiles is then based on the texel/pixel ratio computed by the RDP on a per-pixel basis. Filtering within a MIP map level is controlled by gDPSetTextureFilter. Interpolation between two levels of the MIP map is controlled by setting the color combiner (CC) to the
appropriate mode. (See gDPSetCombineMode). For Detail texture mode, primTile points to a texture tile that is used to provide extra detail under magnification. The extent to which the detail texture is blended in
with the base texture is controlled by the minimum LOD clamp parameter
set through gDPSetPrimColor (See gDPSetColor).
There are many texture image formats, the choice of which is best depends
on the image content and the desired compression. 4/8/16/32 bit texel
sizes are supported. Indexed, 2/4 component textures are supported. I specifies the intensity textures. IA specifies the intensity alpha textures. RGBA specifies the true-color textures. CI specifies the color-indexed textures.
Each line (row) of a texture tile occupies sequential TMEM words (64 bits). The end of the line is padded to a TMEM word boundary.
The cms and cmt set clamp, mirror, and wrap flags for the s and t axes are bit OR'ed together to specify the desired wrap properties. Mirror mode is useful for textures with symmetry. Advantage can be taken of symmetry to reduce texture storage. Clamp mode replicates the edge texel color when sampling outside of the texture map. Clamping is done at the uls, ult and lrs, lrt boundaries. Wraped textures require the
proper mask be set for wrapping. A number n in masks or maskt indicates
(n) LSBs of the s or t texture coordinate are used to sample the
textures. For example, to wrap a 32x32 texture about its boundary use a
mask value of 5. A mask value of zero forces clamping.
The shifts and shiftt arguments are used to shift the incoming texture
coordinates left or right by the appropriate amount. 0-10 are right
shifts. 11-15 are interpreted as left shifts with 11 corresponding to (<< 5),
12: (<< 4) ... 15: (<< 1). These are used to set up mip-mapping,
detail, and sharpen modes. For example, a mip-map pyramid with 6 levels
(32x32 16x16, 8x8, 4x4, 2x2, 1x1) and a detail level (32x16 say) would
have each one of these levels loaded in TMEM with tile descriptor 1
pointing to the 32x32, tile descriptor 2 to the 16x16 and so on. The
shift parameters would be 0 for tile 1, 1 for tile 2, and so on. If Detail
mode is turned on, Tile descriptor 0 (primTile=0) might point to the
32x16 detail level with a shift of 15 (-1) in the s and t axes. This
would map 2x2 detail texels onto one base texel under magnification.
The setTileSize macro is used to set tile parameters that define the origin and extent of the texture tile. uls and ult define the s and t
texture coordinates of the origin of the tile and are useful for shifting
textures across a polygon face. They also define the lower boundary for
clamping. lrs and lrt are used only for clamping and define the upper
boundary.
See Also
gDPLoadTexture
gDPSetTextureLUT
gSPTexture
gDPSetTextureLOD
gDPSetTextureFilter
gDPSetTextureDetail
gDPSetTexturePersp
gDPSync
|
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 January 1998
|
|