gDPLoadTextureBlock_4b [macro]
Loads a texture as a contiguous texture block.
Syntax
#include <ultra64.h>/* gbi.h */
gDPLoadTextureBlock_4b(
Gfx *gdl,
u32 timg,
u32 fmt,
u32 width,
u32 height,
u32 pal,
u32 cms,
u32 cmt,
u32 masks,
u32 maskt,
u32 shifts,
u32 shiftt )
gsDPLoadTextureBlock_4b(
u32 timg,
u32 fmt,
u32 width,
u32 height,
u32 pal,
u32 cms,
u32 cmt,
u32 masks,
u32 maskt,
u32 shifts,
u32 shiftt )
Arguments
- gdl is the display list pointer
- timg is the address of the texture image (64-bit alignment)
- fmt is the texture image format:
G_IM_FMT_CI (CI format)
G_IM_FMT_IA (IA format)
G_IM_FMT_I (I format)
- width is the texture image width
- height is the texture image height
- pal is the location of palette for 4-bit color index texture (4-bit precision, 0~15)
- cms is the s-axis mirror, no-mirror, wrap and clamp flags
G_TX_MIRROR (enable mirror operations)
G_TX_NOMIRROR (disable mirror operations)
G_TX_WRAP (enable wrap operations)
G_TX_CLAMP (enable clamp operations)
- cmt is the t-axis mirror, no-mirror, wrap and clamp flags
G_TX_MIRROR (enable mirror operations)
G_TX_NOMIRROR (disable mirror operations)
G_TX_WRAP (enable wrap operations)
G_TX_CLAMP (enable clamp operations)
- masks is the s-axis mask (4-bit precision, 0~15)
G_TX_NOMASK (do not mask, 0)
numeric value n (mask, 1~15)
- maskt is the t-axis mask (4-bit precision, 0~15)
G_TX_NOMASK (do not mask, 0)
numeric value n (mask, 1~15)
- shifts is the s-coordinate shift value (4-bit precision, 0~15)
G_TX_NOLOD (do not shift, 0)
numeric value n (shift, 1~15)
- shiftt is the t-coordinate shift value (4-bit precision, 0~15)
G_TX_NOLOD (do not shift, 0)
numeric value n (shift, 1~15)
Explanation
Loads a 4-bit texture from DRAM into texture memory (TMEM). The size is implicitly 4 bits, so no size argument in included. Because this macro loads the texture image into a contiguous region in memory, it is the most efficient way to load a texture. DRAM transfers are also most efficient with large blocks.
gDPLoadTextureBlock* is actually comprised of a number of 64-bit GBI commands. Thus, if you need to find out the exact size of the display list, you need to consider how many GBI commands it is comprised of.
Regarding the fmt argument:
- G_IM_FMT_CI
- Each texel is comprised of index information specifying palette data.
- G_IM_FMT_IA
- Each texel is comprised of I (intensity) information and alpha information.
- G_IM_FMT_I
- Each texel is a texture with only I information. Since this is extremely compact, it is useful when only a few colors are being used.
-
You can choose from among 3 different texture image formats. The table shows the valid combinations of format and size. Select the format that best suits the texture compression method and type.
-
|
G_IM_SIZ_(Size) |
4b |
G_IM_FMT_
(Format) |
CI |
X |
IA |
X
(3/1) |
I |
X |
Regarding the cms and cmt arguments:
- Multiple specifications can be made with a bit sum of the following flags:
- G_TX_MIRROR
- Enables mirroring. Mirror textures can be used for textures with axial symmetry, like a tree. Symmetric textures are an effective way to reduce texture volume.
- G_TX_NOMIRROR
- Disables mirroring.
- G_TX_WRAP
- Enables wrapping. A wrapped texture repeats a texel. The wrapping cycle can be specified by a mask.
- G_TX_CLAMP
- Enables clamping. A clamped texture repeats the edge texel color when sampling outside of the texture map. Clamping is performed at the boundary of the texture tile.
Regarding the masks and maskt arguments:
- G_TX_NOMASK (0)
- No mask is used.
- numeric value n (1~15)
- Specifies the wrap position with the value of n. The low-order n bits of the s,t texel coordinates are used for texture sampling.
-
- Texture sampling utilizes the low-order n bits of the s,t texture coordinates. You would set to 5 to wrap a texture with a boundary of 32x32 (25x25). Set to 0 to perform clamping.
Regarding the shifts and shiftt arguments:
- G_TX_NOLOD (0)
- No shifting is performed.
- numeric value n (1~15)
- Shifts the s,t texel coordinate by n bits. This enables the sampling of low-level LOD maps and detail textures.
-
The values specified by shifts and shiftt (the shift parameter values) represent the amount by which the s,t coordinates are shifted to the left or to the right. This is used for the MIP-mapping, detail, and sharp mode settings. The values 0~10 are interpreted as right shifts, and the values 11~15 are interpreted as left shifts (see the table below).
-
Shift parameter value |
Shift amount |
0 |
No shift |
1 |
>> 1 |
2 |
>> 2 |
... |
9 |
>> 9 |
10 |
>> 10 |
11 |
<< 5 |
12 |
<< 4 |
13 |
<< 3 |
14 |
<< 2 |
15 |
<< 1 |
For details about each argument, see Section 13.4, "Tile Attributes," in the N64 Programming Manual. Also, for information about using this macro, see Section 13.5, "Tile Descriptor Loading."
Notes
4-bit textures must be aligned on byte boundaries.
Cautions
There are some restrictions regarding the loading of textures with this macro. To ignore the restrictions, use the gDPLoadTextureBlock_4bS macro. However, that form of the macro requires that every 32 bits in the odd lines of the texture data be pre-swapped. This kind of texture data is created using rgb2c with the -S option. You enter a number after -S to indicate how many texels to swap at a time. That is to say, if the texture you are creating is 32bit, you enter 2 for 16bit, 4 for 8bit, and 8 for 4bit. To learn about the restrictions on loading, see Chapter 13, Appendix A, "LoadBlock Line Limits" and Section 13.8, "Texture Memory," in the N64 Online Programming Manual. Also, note that additional texture macros are defined in gbi.h
See Also
gDPLoadTextureBlock
gDPLoadTextureTile
gDPLoadTextureTile_4b
gDPLoadTLUT_pal16
gDPSetTextureDetail
guLoadTextureBlockMipMap
rgb2c
Revision History
2/1/99 Completely rewritten.
|
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-1999
Nintendo of America Inc. All rights reserved Nintendo and N64 are registered trademarks of Nintendo
Last Updated April, 1999
|