This is the static light version
| 2820 | |
| 2821 | // This is the static light version |
| 2822 | void DrawPolygonModel(vector *pos, matrix *orient, int model_num, float *normalized_time, int flags, float r, float g, |
| 2823 | float b, uint32_t f_render_sub, uint8_t use_effect, uint8_t overlay) { |
| 2824 | poly_model *po; |
| 2825 | |
| 2826 | ASSERT(Poly_models[model_num].used); |
| 2827 | ASSERT(!(Poly_models[model_num].flags & PMF_NOT_RESIDENT)); |
| 2828 | |
| 2829 | GetPolymodelPointer(model_num); |
| 2830 | |
| 2831 | Polymodel_use_effect = use_effect; |
| 2832 | Polymodel_light_type = POLYMODEL_LIGHTING_STATIC; |
| 2833 | Polylighting_static_red = r; |
| 2834 | Polylighting_static_green = g; |
| 2835 | Polylighting_static_blue = b; |
| 2836 | |
| 2837 | rend_SetOverlayType(OT_NONE); |
| 2838 | rend_SetLighting(LS_NONE); |
| 2839 | |
| 2840 | po = &Poly_models[model_num]; |
| 2841 | |
| 2842 | g3_StartInstanceMatrix(pos, orient); |
| 2843 | |
| 2844 | if (Polymodel_use_effect && Polymodel_effect.type & PEF_FOGGED_MODEL) { |
| 2845 | Polymodel_fog_plane = Polymodel_effect.fog_plane; |
| 2846 | Polymodel_fog_portal_vert = Polymodel_effect.fog_portal_vert; |
| 2847 | } |
| 2848 | |
| 2849 | if (Polymodel_use_effect && Polymodel_effect.type & (PEF_SPECULAR_MODEL | PEF_SPECULAR_FACES)) |
| 2850 | Polymodel_specular_pos = Polymodel_effect.spec_light_pos; |
| 2851 | |
| 2852 | if (Polymodel_use_effect && (Polymodel_effect.type & PEF_BUMPMAPPED)) |
| 2853 | Polymodel_bump_pos = Polymodel_effect.bump_light_pos; |
| 2854 | |
| 2855 | StartLightInstance(pos, orient); |
| 2856 | |
| 2857 | SetModelAnglesAndPos(po, normalized_time, f_render_sub); |
| 2858 | |
| 2859 | if (f_render_sub == 0xFFFFFFFF || overlay) // draw entire object |
| 2860 | { |
| 2861 | if (po->new_style) { |
| 2862 | RenderPolygonModel(po, f_render_sub); |
| 2863 | } |
| 2864 | } else { |
| 2865 | ASSERT(po->new_style == 1); |
| 2866 | |
| 2867 | rend_SetAlphaType(ATF_CONSTANT + ATF_VERTEX); |
| 2868 | |
| 2869 | int i; |
| 2870 | for (i = 0; i < po->n_models; i++) { |
| 2871 | if ((f_render_sub & (1 << i))) { |
| 2872 | if (i != 0) { |
| 2873 | // if submodel, rotate around its center point, not pivot point |
| 2874 | |
| 2875 | vector ofs = (po->submodel[i].min + po->submodel[i].max) / 2; |
| 2876 | vector save_offset = po->submodel[i].offset; |
| 2877 | vm_MakeZero(&po->submodel[i].offset); |
| 2878 | vm_MakeZero(&po->submodel[i].mod_pos); |
| 2879 | memset(&po->submodel[i].angs, 0, sizeof(angvec)); |
no test coverage detected