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
|
gSPObjRectangleRFormatgSPObjRectangleR(Gfx *gdl, uObjSprite *sp) gsSPObjRectangleR(uObjSprite *sp)Arguments
It is one of the three sprite-drawing macros that are part of the S2DEX microcode. The sprite mentioned here corresponds to OBJECTs in Super NES programming. Sprites have been used for drawing areas smaller than BG, and historically they have been used as "player characters" quite often. By using the following three S2DEX microcode's sprite-drawing macros, you can magnify, reduce, and rotate sprites:
To support a sprite�s rotation, a two-dimensional coordinate conversion matrix is used. By setting the matrix elements, a sprite can be rotated freely. The matrix must be set before drawing a sprite. Also, unlike the matrix for Fast3D or F3DEX, there is no matrix stack, so push or pop operations cannot be performed. Matrix multiplication cannot be done either. Only the load operation is possible. The S2DEX microcode specifications call for using separate GBIs for TMEM loading and sprite drawing. Therefore, before drawing a sprite, you must load the texture used for the sprite by using this texture loading GBI macro:
The uObjSprite data structure holds a sprite�s information. The pointer to the data structure will be given to the sprite drawing macro as a parameter. For detailed information about this and the other data structures used, please see the uObjSprite structure, see the "S2DEX Microcode" section of the N64 Programming Manual. The gSPObjRectangleR macro like gSPObjRectangle is used for drawing non-rotating sprites. Unlike gSPObjRectangle however, gSPObjRectangleR changes drawing screen coordinates by referring to the 2D matrix data structure's X, Y, BaseScaleX, and BaseScaleY elements. It determines the vertex coordinates of a sprite by using the following formula. Upper-left coordinate: ( X + objX / BaseScaleX, Y+objY/BaseScaleY )Lower-right coordinate: ( X + (objX + imageW / scaleW) / BaseScaleX - 1, Y + (objY + imageH / scaleH) / BaseScaleY - 1 )To change the values in X, Y, BaseScaleX, and BaseScaleY, use the gSPObjSubMatrix macro. When X = Y = 0 and BaseScaleX = BaseScaleY = 1.0, the result is the same as using gSPObjRectangle. By changing the values in X, Y, BaseScaleX, and BaseScaleY elements of the 2D matrix, you enable multiple sprites to be moved or their scale changed, as if they were one sprite. For more information about this, please see the "S2DEX Microcode" section of the N64 Programming Manual. For detailed information on S2DEX microcode GBI macros and data structures, please see the "S2DEX Microcode" area of the N64 Programming Manual. See Also S2DEX Microcode guS2DInitBg
|