![]() |
![]() |
Data Structures and Attributes
Bitmap Structure
Following is the actual structure of a single bitmap:
typedef struct bitmap {
s16 width; /* Size across to draw in texels */
/* Done if width = 0 */
s16 width_img; /* Actual size across in texels */
s16 s; /* Horizontal offset into bitmap */
/* if (s > width_img), then load only! */
s16 t; /* Vertical offset into base */
void *buf; /* Pointer to bitmap data */
/* Don’t re-load if new buf */
/* is the same as the old one */
/* Skip if NULL */
s16 actualHeight; /* True Height of this bitmap piece */
s16 LUToffset; /* LUT base index (for 4-bit CI Texs) */
} Bitmap;
typedef struct sprite { s16 x,y; /* Target position */ s16 width, /* Target size (before scaling */ height; f32 scalex, /* Texel to Pixel scale factor */ scaley; s16 expx, expy; /* Explosion spacing */ u16 attr; /* Attribute Flags */ s16 zdepth; /* Z Depth */ u8 red, /* Primitive Color */ green, blue, alpha; u16 startTLUT; /* Lookup Table Entry Starting index */ s16 nTLUT; /* Total number of LUT Entries */ s16 *LUT; /* Pointer to Lookup Table */ s16 istart; /* Starting bitmap index */ s16 istep; /* Bitmaps index step (see SP_INCY) */ /* if 0, then variable width bitmaps */ s16 nbitmaps; /* Total number of bitmaps */ s16 ndisplist; /* Total number of display-list words */ s16 bmheight; /* Bitmap Texel height (Used) */ s16 bmHreal; /* Bitmap Texel height (Real) */ u8 bmfmt; /* Bitmap Format */ u8 bmsiz; /* Bitmap Texel Size */ Bitmap *bitmap; /* Pointer to first bitmap */ Gfx *rsp_dl; /* Pointer to RSP display list */ Gfx *rsp_dl_next; /* Pointer to next RSP DL entry */ } Sprite;
Attributes
Sprite attributes permit sprites to be used in a variety of different ways. The following detailed description of each attribute indicates how setting or clearing that attribute affects the appearance of the drawn sprite. Note also that these attributes are as independent as possible, thus greatly expanding the available variety and uses for sprites.
SP_TRANSPARENT
This attribute permits the Alpha blending of the sprite texture with the background.
SP_CUTOUT
Use alpha compare hardware to not draw pixels with an alpha less than the blend color alpha (automatically set to 1).
SP_HIDDEN
This attribute makes spDraw() on the sprite return without generating a display list.
SP_Z
This attribute specifies that z-buffering should be on while drawing the sprite.
SP_SCALE
This attribute specifies that the sprite should be scaled in both X and Y by the amount indicated in scalex and scaley.
SP_FASTCOPY
This attribute indicates that the sprite should be drawn in COPY mode. This produces the fastest possible drawing speed for background clears.
SP_TEXSHIFT
This attribute indicates that textures are to be shifted exactly 1/2 texel in both s and t before drawing it. This creates a better antialiased edge along transparent texture boundaries when in cutout mode.
SP_FRACPOS
This attribute indicates that the frac_s and frac_t fields of the sprite structure are to be used to fine-position the texture into the drawn pixels..
SP_TEXSHUF
This attribute indicates that the tile textures have their odd lines pre-shuffled to work around a LoadTextureBlock(3P) problem. (Please see Section 13.1, "Texture Mapping," for details on this problem.)
SP_EXTERN
This attribute indicates that existing drawing modes are to be used rather than the sprite routines explicitly setting them.
Copyright © 1999 Nintendo of America Inc. All Rights Reserved Nintendo and N64 are registered trademarks of Nintendo Last Updated January, 1999 |