X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=bootcensus;a=blobdiff_plain;f=src%2Fcensus%2Fpolytmpl.h;h=11ce0faa612e3036667ad1a11a2e7848845aa03c;hp=03724cf20b40494e9af37bbee33bdb92e7afac42;hb=0a37e241149d011e038aceb3faac568b405f8ecd;hpb=a2f065772bcb7766859033d140980720ef824546 diff --git a/src/census/polytmpl.h b/src/census/polytmpl.h index 03724cf..11ce0fa 100644 --- a/src/census/polytmpl.h +++ b/src/census/polytmpl.h @@ -84,14 +84,14 @@ void POLYFILL(struct pvertex *pv, int nverts) int i, winding; int topidx = 0, botidx = 0, sltop = pfill_fb.height, slbot = 0; struct pvertex *left, *right; - uint32_t color; + g3d_pixel color; /* the following variables are used for interpolating horizontally accros scanlines */ #if defined(GOURAUD) || defined(TEXMAP) int mid; int32_t dx, tmp; #else /* flat version, just pack the color now */ - color = PACK_RGB32(pv[0].r, pv[0].g, pv[0].b); + color = G3D_PACK_RGB(pv[0].r, pv[0].g, pv[0].b); #endif #ifdef GOURAUD int32_t r, g, b, dr, dg, db, rslope, gslope, bslope; @@ -216,7 +216,7 @@ void POLYFILL(struct pvertex *pv, int nverts) /* for each scanline ... */ for(i=sltop; i<=slbot; i++) { - uint32_t *pixptr; + g3d_pixel *pixptr; int32_t x; x = left[i].x; @@ -264,7 +264,7 @@ void POLYFILL(struct pvertex *pv, int nverts) int cr, cg, cb; #endif #ifdef BLEND - uint32_t fbcol; + g3d_pixel fbcol; int alpha, inv_alpha; #endif #ifdef GOURAUD @@ -289,18 +289,18 @@ void POLYFILL(struct pvertex *pv, int nverts) { int tx = (u >> (16 - pfill_tex.xshift)) & pfill_tex.xmask; int ty = (v >> (16 - pfill_tex.yshift)) & pfill_tex.ymask; - uint32_t texel = pfill_tex.pixels[(ty << pfill_tex.xshift) + tx]; + g3d_pixel texel = pfill_tex.pixels[(ty << pfill_tex.xshift) + tx]; #ifdef GOURAUD /* This is not correct, should be /255, but it's much faster * to shift by 8 (/256), and won't make a huge difference */ - cr = (cr * UNPACK_R32(texel)) >> 8; - cg = (cg * UNPACK_G32(texel)) >> 8; - cb = (cb * UNPACK_B32(texel)) >> 8; + cr = (cr * G3D_UNPACK_R(texel)) >> 8; + cg = (cg * G3D_UNPACK_G(texel)) >> 8; + cb = (cb * G3D_UNPACK_B(texel)) >> 8; #else - cr = UNPACK_R32(texel); - cg = UNPACK_G32(texel); - cb = UNPACK_B32(texel); + cr = G3D_UNPACK_R(texel); + cg = G3D_UNPACK_G(texel); + cb = G3D_UNPACK_B(texel); #endif } u += uslope; @@ -321,16 +321,16 @@ void POLYFILL(struct pvertex *pv, int nverts) #endif fbcol = *pixptr; inv_alpha = 255 - alpha; - cr = (cr * alpha + UNPACK_R32(fbcol) * inv_alpha) >> 8; - cg = (cg * alpha + UNPACK_G32(fbcol) * inv_alpha) >> 8; - cb = (cb * alpha + UNPACK_B32(fbcol) * inv_alpha) >> 8; + cr = (cr * alpha + G3D_UNPACK_R(fbcol) * inv_alpha) >> 8; + cg = (cg * alpha + G3D_UNPACK_G(fbcol) * inv_alpha) >> 8; + cb = (cb * alpha + G3D_UNPACK_B(fbcol) * inv_alpha) >> 8; if(cr > 255) cr = 255; if(cg > 255) cg = 255; if(cb > 255) cb = 255; #endif /* BLEND */ #if defined(GOURAUD) || defined(TEXMAP) || defined(BLEND) - color = PACK_RGB32(cr, cg, cb); + color = G3D_PACK_RGB(cr, cg, cb); #endif #ifdef DEBUG_OVERDRAW