guSprite2DInit [Function]
Function
guSprite2DInit
Initializes a sprite data structure
Syntax
#include <ultra64.h> /* gu.h */
void guSprite2DInit(
uSprite *SpritePointer,
void *SourceImagePointer,
void *TlutPointer,
int Stride,
int SubImageWidth,
int SubImageHeight,
int SourceImageType,
int SourceImageBitSize,
int SourceImageOffsetS,
int SourceImageOffsetT);
Arguments
- SpritePointer
- Pointer to the resulting uSprite structure
-
- SourceImagePointer
- Pointer to the texture image base
-
- TlutPointer
- Pointer to color index
-
- Stride
- Base image texel width
-
- SubImageWidth
- Displayed image texel width
-
- SubImageHeight
- Displayed image texel height
-
- SourceImageType
- Texture image format
- G_IM_FMT_RGBA (RGBA format)
- G_IM_FMT_YUV (YUV format)
- G_IM_FMT_CI (CI format)
- G_IM_FMT_IA (IA format)
- G_IM_FMT_I (I format)
-
- SourceImageBitSize
- Pixel component size
- G_IM_SIZ_4b (4 bits per texel)
- G_IM_SIZ_8b (8 bits per texel)
- G_IM_SIZ_16b (16 bits per texel)
- G_IM_SIZ_32b (32 bits per texel)
-
- SourceImageOffsetS
- Offset from origin of base image to texel column
-
- SourceImageOffsetT
- Offset from origin of base image to texel row
Returned value
None.
Description
Initializes the Sprite structure according to the specified arguments for use with the sprite microcode.
- Regarding the TlutPointer argument:
- Set to NULL if not using CI images.
-
- Regarding the SourceImageType argument:
- G_IM_FMT_RGBA
- Each texel comprises four elements of information: RGB (red, green, blue) and alpha (opacity).
- G_IM_FMT_YUV
- Each texel comprises a Y (intensity) component and a UV (color difference) component.
- 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.
-
- The texture image format can be selected from among 10 types. Refer to the following table for valid combinations of format and size and select the most suitable format for the texture compression method and type.
-
-
|
G_IM_SIZ_ (Size) |
| 4b |
8b |
16b |
32b |
G_IM_FMT_ (Format) |
RGBA |
-- |
-- |
X (5/5/5/1) |
X (8/8/8/8) |
| YUV |
-- |
-- |
X |
-- |
| CI |
X |
X |
-- |
-- |
| IA |
X (3/1) |
X (4/4) |
X (8/8) |
-- |
| I |
X |
X |
-- |
-- |
- Regarding the SourceImageOffsetS, SourceImageOffsetT arguments:
- These specify the staring position of the rectangular region displaying texels in the base image.
Note
We currently cannot guarantee operation of G_IM_FMT_YUV (YUV format). At the present time, this function is only useful for simply copying each argument into the appropriate location of the specified SpritePointer. Instead of using this function, you can directly initialize the sprite structure.
Comment
The uSprite structure looks like this:
typedef struct {
void *SourceImagePointer;
void *TlutPointer;
short Stride;
short SubImageWidth;
short SubImageHeight;
char SourceImageType;
char SourceImageBitSize;
short SourceImageOffsetS;
short SourceImageOffsetT;
char dummy[4];
} uSprite_t;
typedef union {
uSprite_t s;
long long int force_structure_alignment[3];
} uSprite;
See Also
gSPSprite2DBase, gSPSprite2DDraw, and gSPSprite2DScaleFlip
Revision History
03/01/99 Completely rewritten.