draws a bitmap with the specified 3d width & height If offsets are not -1, then the blitter draws not from the upper left hand corner of the bitmap, but from size*offsetx,size*offsety See Jason for explaination
| 247 | // corner of the bitmap, but from size*offsetx,size*offsety |
| 248 | // See Jason for explaination |
| 249 | void g3_DrawBitmap(vector *pos, float width, float height, int bm, int color) { |
| 250 | // get the view orientation |
| 251 | matrix viewOrient; |
| 252 | g3_GetUnscaledMatrix(&viewOrient); |
| 253 | |
| 254 | // break down the color into components |
| 255 | float r, g, b; |
| 256 | if (color != -1) { |
| 257 | float scale = 1.0f / 255.0f; |
| 258 | r = GR_COLOR_RED(color) * scale; |
| 259 | g = GR_COLOR_GREEN(color) * scale; |
| 260 | b = GR_COLOR_BLUE(color) * scale; |
| 261 | } |
| 262 | |
| 263 | // calculate the four corners |
| 264 | g3Point corners[4], *pts[4]; |
| 265 | int i; |
| 266 | for (i = 0; i < 4; ++i) { |
| 267 | pts[i] = &corners[i]; |
| 268 | |
| 269 | // calculate the offset for this corner |
| 270 | float cornerScaleU = ((i & 1) ^ ((i & 2) >> 1)) ? 1.0f : -1.0f; |
| 271 | float cornerScaleV = (i & 2) ? 1.0f : -1.0f; |
| 272 | |
| 273 | // find the point (parallel to the view frame) |
| 274 | vector cornerPos = *pos + (viewOrient.uvec * (height * -cornerScaleV)) + (viewOrient.rvec * (width * cornerScaleU)); |
| 275 | corners[i].p3_codes = 0; |
| 276 | g3_RotatePoint(pts[i], &cornerPos); |
| 277 | |
| 278 | // setup the flags, UVs and colors |
| 279 | corners[i].p3_flags |= PF_UV; |
| 280 | corners[i].p3_uvl.u = (cornerScaleU * 0.5f) + 0.5f; |
| 281 | corners[i].p3_uvl.v = (cornerScaleV * 0.5f) + 0.5f; |
| 282 | if (color == -1) { |
| 283 | corners[i].p3_flags |= PF_L; |
| 284 | corners[i].p3_uvl.l = 1.0f; |
| 285 | } else { |
| 286 | corners[i].p3_flags |= PF_RGBA; |
| 287 | corners[i].p3_uvl.r = r; |
| 288 | corners[i].p3_uvl.g = g; |
| 289 | corners[i].p3_uvl.b = b; |
| 290 | } |
| 291 | corners[i].p3_uvl.a = 1.0f; |
| 292 | } |
| 293 | |
| 294 | rend_SetTextureType(TT_LINEAR); |
| 295 | rend_DrawPolygon3D(bm, pts, 4); |
| 296 | } |
| 297 | |
| 298 | // Draws a bitmap that has been rotated about its center. Angle of rotation is passed as 'rot_angle' |
| 299 | void g3_DrawRotatedBitmap(vector *pos, angle rot_angle, float width, float height, int bm, int color) { |
no test coverage detected