Changes the object rendering mode in the RSP
#include <ultra64.h> /* gs2dex.h */
gSPObjRenderMode(Gfx *gdl, u32 mode)
gsSPObjRenderMode( u32 mode)
- the pointer to the display list.
- the object rendering mode:
- G_OBJRM_NOTXCLAMP (Do not perform clamping)
- G_OBJRM_BILERP (Correct when bilinear interpolation is performed)
- G_OBJRM_SHRINKSIZE_1 (Trim 0.5 texel off drawn image)
- G_OBJRM_SHRINKSIZE_2 (Trim 1.0 texel off drawn image)
- G_OBJRM_WIDEN (Enlarge drawn image by 3/8 texel)
Changes the object rendering mode in the RSP. Normally, the object rendering mode is set according to the screen mode. The RDP has various rendering modes for drawing sprites or backgrounds (BG). For information about these object rendering modes, refer to the "4.4 Object render mode settings" in the Readme file of the latest version of the S2DEX microcode.
Multiple modes can be specified for mode with a bit sum of the following flags. However, note that G_OBJRM_SHRINKSIZE_1 and G_OBJRM_SHRINKSIZE2 cannot be specified at the same time.
- Specifies that no clamping be performed in the RSP. When a texture is fixed to a sprite, the following relationships hold for the texture size (imageW, imageH), scale values (scaleW, scaleH) and sprite size (objW, objH)
- objW = imageW / scaleW;
- objH = imageH / scaleH;
- When the texture is fixed to the sprite, the region of the texture from texture coordinates (0, 0) to (imageW-1, imageH-1) is drawn on the sprite. However, due to calculation errors, a little texture outside of this range may be displayed at the periphery of the sprite. To prevent this, the RSP performs clamping outside of the range where the texture is to be drawn. For information about clamping, see Section 13 "Texture Mapping" in the N64 Programming Manual.
- Corrects for the 0.5 slippage of the texture that occurs when bilinear interpolation is performed. When clamping is turned on, the RSP uses the bilinear interpolation feature and supports subpixel-unit movements of the internal images. This enables a sprite to be moved in 1/4-pixel units.
- Draws texture image for which the perimeter has been pared down by 0.5 texel. When a number of bilinearly interpolated sprites are to be aligned and handled as one large bilinearly interpolated sprite, the continuity of the image at the boundaries becomes a problem. To ensure image continuity, you must overlap the textures of the individual sprites by one line each. This makes the 0.5 texel at the periphery (the colored portion in the figure below) unnecessary because the neighboring sprite takes care of this part. Although each texture image is reduced in size by 0.5 texel, the upper-left screen coordinate does not change, and the drawing result will be as shown in the figure below.
- This mode works the same as G_OBJRM_SHRINKSIZE_1, but doubles the scale of image reduction (pares 1 texel around the periphery). It is used when the texels of adjacent sprites are overlapped by two lines each to maintain continuity when subpixel processing is performed.
- Enlarges the drawn image by 3/8 pixel in the positive S and T directions. This mode is used to prevent blank space from opening up at the seams when a large rotating object is displayed from texture memory (TMEM) by combining sprites. This mode is effective when combining and drawing opaque sprites. It is unnecessary for translucent sprites because the seams are filled by processing by the blender (BL).
When drawing sprites, use the following RDP rendering modes:
- * When antialiasing is off:
- <Opaque sprites>
- * When antialiasing is on:
- <Opaque sprites>
When two sprites overlap, the edge of the bottom sprite may affect the edge of the top sprite. Since this cannot be avoided, use G_RM_XLU_SPRITE if this bothers you.
02/01/99 Entirely revised.