Draws a bitmap that has been rotated about its center. Angle of rotation is passed as 'rot_angle'
| 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) { |
| 300 | // get the view orientation |
| 301 | matrix viewOrient; |
| 302 | g3_GetUnscaledMatrix(&viewOrient); |
| 303 | |
| 304 | matrix rot_matrix; |
| 305 | vm_AnglesToMatrix(&rot_matrix, 0, 0, rot_angle); |
| 306 | |
| 307 | float w = width; |
| 308 | float h = height; |
| 309 | |
| 310 | vector rot_vectors[4]; |
| 311 | rot_vectors[0].x = -w; |
| 312 | rot_vectors[0].y = h; |
| 313 | |
| 314 | rot_vectors[1].x = w; |
| 315 | rot_vectors[1].y = h; |
| 316 | |
| 317 | rot_vectors[2].x = w; |
| 318 | rot_vectors[2].y = -h; |
| 319 | |
| 320 | rot_vectors[3].x = -w; |
| 321 | rot_vectors[3].y = -h; |
| 322 | |
| 323 | g3Point rot_points[8], *pntlist[8]; |
| 324 | int i; |
| 325 | for (i = 0; i < 4; ++i) { |
| 326 | vector offset; |
| 327 | rot_vectors[i].z = 0.0f; |
| 328 | vm_MatrixMulVector(&offset, &rot_vectors[i], &rot_matrix); |
| 329 | |
| 330 | vector cornerPos = *pos + (viewOrient.uvec * offset.y) + (viewOrient.rvec * offset.x); |
| 331 | rot_points[i].p3_codes = 0; |
| 332 | g3_RotatePoint(&rot_points[i], &cornerPos); |
| 333 | |
| 334 | rot_points[i].p3_flags |= PF_UV | PF_RGBA; |
| 335 | rot_points[i].p3_l = 1.0f; |
| 336 | rot_points[i].p3_uvl.u = ((i & 1) ^ ((i & 2) >> 1)) ? 1.0f : 0.0f; |
| 337 | rot_points[i].p3_uvl.v = (i & 2) ? 1.0f : 0.0f; |
| 338 | |
| 339 | pntlist[i] = &rot_points[i]; |
| 340 | } |
| 341 | |
| 342 | // And draw!! |
| 343 | rend_SetTextureType(TT_LINEAR); |
| 344 | |
| 345 | if (color != -1) { |
| 346 | rend_SetLighting(LS_FLAT_GOURAUD); |
| 347 | rend_SetFlatColor(color); |
| 348 | } |
| 349 | |
| 350 | g3_DrawPoly(4, pntlist, bm); |
| 351 | } |
| 352 | |
| 353 | // Draws a bitmap on a specific plane. Also does rotation. Angle of rotation is passed as 'rot_angle' |
| 354 | void g3_DrawPlanarRotatedBitmap(vector *pos, vector *norm, angle rot_angle, float width, float height, int bm) { |
no test coverage detected