Table of Contents Glide Programming Guide


Glide Textures and Texels



Download 6.22 Mb.
Page57/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   53   54   55   56   57   58   59   60   ...   106
GLIDEPGM

3Glide Textures and Texels


Textures are square or rectangular arrays of data; an individual value within a texture is called a texel and has an (s, t) address. The s and t texel coordinates are in the range [–32768..32767] and must be divided by w before storing them in a GrVertex structure as oow (one over w), sow (s over w) and tow (t over w). The large range for s and t allow a texture to be repeated many times across a polygon. A large number of fraction bits allow for precise s and t representation and iteration even when divided by a large w value.
Each TMU in the system maintains its own oow, sow, and tow variables. The GrVertex structure reflects this architecture by keeping oow, sow, and tow in an array, tmuvtx, that is indexed by the TMU number. Normally, they will all be the same. However, projected textures have a different w value than non-projected textures. Projected textures iterate q/w where w is the homogeneous distance from the eye and q is the homogeneous distance from the projected source.

typedef struct {


float oow;
float sow; /* s/w texture coordinate */
float tow; /* t/w texture coordinate */
} GrTmuVertex;
typedef struct {
float x, y, z; /* x, y, z of screen space. z is ignored */
float ooz;
float oow; /* 1/w (used for w buffering) */
float r, g, b, a; /* red, green, blue, and alpha ([0..255.0]) */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
} GrVertex;
By default, Glide assumes that all w coordinates (oow) in the GrVertex structure are identical, and that all s and t coordinates (sow and tow) are also identical. These assumptions significantly reduce the amount of time spent computing gradients for s, t, and w, and transferring data to the graphics hardware. If these assumptions are false, however, the application must alert Glide that specific values in the GrVertex structure are different and that gradients need to be computed for these values. The grHints() routine is provided for this purpose.
void grHints( GrHints_t hintType, FxU32 hintMask )


Download 6.22 Mb.

Share with your friends:
1   ...   53   54   55   56   57   58   59   60   ...   106




The database is protected by copyright ©ininet.org 2024
send message

    Main page