Takes nv vertices and draws the polygon defined by those vertices. Uses bitmap "handle" as a texture
| 663 | // Takes nv vertices and draws the polygon defined by those vertices. Uses bitmap "handle" |
| 664 | // as a texture |
| 665 | void rend_DrawMultitexturePolygon3D(int handle, g3Point **p, int nv, int map_type) { |
| 666 | g3Point *pnt; |
| 667 | int i, fr, fg, fb; |
| 668 | float alpha; |
| 669 | |
| 670 | float one_over_square_res = 1.0 / GameLightmaps[gpu_Overlay_map].square_res; |
| 671 | float xscalar = (float)GameLightmaps[gpu_Overlay_map].width * one_over_square_res; |
| 672 | float yscalar = (float)GameLightmaps[gpu_Overlay_map].height * one_over_square_res; |
| 673 | |
| 674 | ASSERT(nv < 100); |
| 675 | |
| 676 | if (gpu_state.cur_light_state == LS_NONE) { |
| 677 | fr = GR_COLOR_RED(gpu_state.cur_color); |
| 678 | fg = GR_COLOR_GREEN(gpu_state.cur_color); |
| 679 | fb = GR_COLOR_BLUE(gpu_state.cur_color); |
| 680 | } |
| 681 | |
| 682 | alpha = gpu_Alpha_multiplier * gpu_Alpha_factor; |
| 683 | |
| 684 | PosColorUV2Vertex *vData = &vArray2[0]; |
| 685 | |
| 686 | // Specify our coordinates |
| 687 | for (i = 0; i < nv; i++, vData++) { |
| 688 | pnt = p[i]; |
| 689 | ASSERT(pnt->p3_flags & PF_ORIGPOINT); |
| 690 | |
| 691 | if (gpu_state.cur_alpha_type & ATF_VERTEX) |
| 692 | alpha = pnt->p3_a * gpu_Alpha_multiplier * gpu_Alpha_factor; |
| 693 | |
| 694 | // If we have a lighting model, apply the correct lighting! |
| 695 | if (gpu_state.cur_light_state != LS_NONE) { |
| 696 | // Do lighting based on intesity (MONO) or colored (RGB) |
| 697 | if (gpu_state.cur_color_model == CM_MONO) { |
| 698 | vData->color.r = pnt->p3_l; |
| 699 | vData->color.g = pnt->p3_l; |
| 700 | vData->color.b = pnt->p3_l; |
| 701 | vData->color.a = alpha; |
| 702 | } else { |
| 703 | vData->color.r = pnt->p3_r; |
| 704 | vData->color.g = pnt->p3_g; |
| 705 | vData->color.b = pnt->p3_b; |
| 706 | vData->color.a = alpha; |
| 707 | } |
| 708 | } else { |
| 709 | vData->color.r = 1; |
| 710 | vData->color.g = 1; |
| 711 | vData->color.b = 1; |
| 712 | vData->color.a = alpha; |
| 713 | } |
| 714 | |
| 715 | /* |
| 716 | // Texture this polygon! |
| 717 | float texw=1.0/(pnt->p3_z+Z_bias); |
| 718 | vData->uv0.s=pnt->p3_u*texw; |
| 719 | vData->uv0.t=pnt->p3_v*texw; |
| 720 | vData->uv0.r=0; |
| 721 | vData->uv0.w=texw; |
| 722 |
no test coverage detected