struct GsSPRITE {
u_long attribute;
short x, y;
u_short w, h;
u_short tpage;
u_char u, v;
short cx, cy;
u_char r, g, b;
short mx, my;
short scalex, scaley;
long rotate;
};
|
Members
attribute |
Attribute bits as shown below (Bits not defined below are reserved by the system)
6: Brightness adjustment switch
0: ON
1: OFF
24-25: Sprite pattern colour mode
0: 4-bit CLUT
1: 8-bit CLUT
2: 15-bit Direct
27: Rotation & scaling functions
0: ON
1: OFF
28-29: Semi-transparency rate
0: 0.5 x Back + 0.5 x Forward
1: 1.0 x Back + 1.0 x Forward
2: 1.0 x Back - 1.0 x Forward
3: 1.0 x Back + 0.25 x Forward
30: Semi-transparency mode
0: Semi-transparency OFF
1: Semi-transparency ON
31: Sprite display mode
0: Displayed
1: Not displayed |
x, y |
Display position of the upper left-hand point |
w, h |
Width and height of the sprite (Not displayed if w or h
is 0) |
tpage |
Sprite pattern texture page number |
u, v |
Sprite pattern offset within the page |
cx, cy |
Sprite CLUT address |
r, g, b |
Display brightness for r, g, and b (normal brightness is 128) |
mx, my |
Rotation and enlargement central point coordinates |
scalex, scaley |
Scale values in x and y directions |
rotate |
Rotation angle (4096 = 1 degree) |
Explanation
GsSPRITE is a structure used to display a sprite.
This structure makes it possible to manipulate each sprite via its
parameters.
To enter a GsSPRITE in an ordering table, use GsSortSprite()
or GsSortFastSprite().
x, y specify the screen display position.
mx, my specify the point in the sprite pattern used as the display
position in GsSortSprite();
in GsSortFastSprite(),
the point at the upper left-hand corner of the sprite is used as the display
position.
w, h specify the width and height of the sprite in pixels.
tpage specifies the texture page number (0-31) of the sprite
pattern.
u, v specify the offset within the page from the upper left-hand
point of the sprite pattern. The range that may be specified is (0, 0)
- (255, 255).
cx, cy specify the starting position of the CLUT (colour palette)
as a VRAM address (Valid for 4-bit/8-bit mode only).
r, g, b specify the brightness values for red, green, and blue.
The allowed range is 0 to 255. 128 is the brightness of the original pattern;
255 represents a two-fold increase in brightness.
mx, my specify the coordinates for the center of rotation and
scaling. The upper left-hand point of the sprite is the point of origin.
For example, if rotation is around the center of the sprite, mx
and my should be specified as w/2 and h/2, respectively.
scalex, scaley specify enlargement/reduction values in the x
and y directions. These values represent units of 4096 (which is equivalent
to a fixed point value of 1.0). scalex and scaley can be
set up to 8 times the original size.
rotate specifies the amount of rotation around the Z-axis and
is represented as an integer, where 4096 is equivalent to 1 degree.
attribute is 32 bits, and sets various attributes for display.
An explanation of each bit follows. Bits not defined below are reserved
by the system.
a) Brightness adjustment switch (bit 6)
This bit sets whether or not the sprite pattern pixel colours are to
be drawn with brightness adjusted according to the (r,g,b) values.
When this bit is 1, brightness is not adjusted and the (r,g,b) values
are ignored.
b) Sprite pattern colour mode (bit 24-25)
A sprite pattern can use either 4-bit colour mode or 8-bit colour mode,
both of which use the colour table, and 15-bit mode, which directly displays
colours. These bits are used to set one of these colour modes. Please see
above for bit definitions.
c) Rotation & scaling functions (bit 27)
This bit turns on or off the sprite scaling function.
If rotation or scaling of the sprite is not needed, this bit should
be set to OFF for high speed processing. GsSortFastSprite()
ignores this bit and always set the scaling function to OFF.
d) Semi-transparency rate (bit 28-29)
These bits set the method of pixel blending together with bit 30, when
semi-transparency is turned on.
Normal semi-transparent processing is performed when these bits are
set to 0, pixel addition when set to 1, pixel subtraction when set to 2,
and 25% addition when set to 3.
e) Semi-transparency mode (bit 30)
This bit turns semi-transparency on or off.
It must be used with the uppermost bit (STP bit) of the texture colour
field to turn semi-transparency on (texture pattern when in direct mode
and CLUT colour field when in indexed mode). The semi-transparency and
non-transparency of each pixel may also be controlled using this STP bit.
f) Sprite display mode (bit 31)
This bit turns the display mode on and off.
|