MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / RenderSubmodelFace

Function RenderSubmodelFace

model/newstyle.cpp:173–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171int Lightmap_debug_model = -1;
172
173inline void RenderSubmodelFace(poly_model *pm, bsp_info *sm, int facenum) {
174
175 g3Point *pointlist[100];
176 int bm_handle;
177 int smooth = 0;
178 polyface *fp = &sm->faces[facenum];
179 int modelnum = sm - pm->submodel;
180 texture *texp = nullptr;
181 int t;
182 int custom = 0;
183 g3Codes face_cc;
184 int triface = 0;
185
186 face_cc.cc_and = 0xff;
187 face_cc.cc_or = 0;
188
189 triangulated_faces[facenum] = 0;
190
191 if (sm->flags & SOF_CUSTOM)
192 custom = 1;
193
194 // Setup texturing
195 if (fp->texnum != -1)
196 texp = &GameTextures[pm->textures[fp->texnum]];
197
198 if (texp && custom && Polymodel_use_effect && (Polymodel_effect.type & PEF_CUSTOM_TEXTURE))
199 texp = &GameTextures[Polymodel_effect.custom_texture];
200
201 // Set radiosity lightmaps if needed
202 if (Polymodel_light_type == POLYMODEL_LIGHTING_LIGHTMAP) {
203 rend_SetOverlayMap(
204 LightmapInfo[Polylighting_lightmap_object->lightmap_faces[modelnum][facenum].lmi_handle].lm_handle);
205 }
206
207 // Do bump mapping
208 if ((Polymodel_effect.type & PEF_BUMPMAPPED) && texp && texp->bumpmap != -1 &&
209 Polymodel_light_type == POLYMODEL_LIGHTING_GOURAUD) {
210 rend_SetOverlayType(OT_NONE);
211 rend_SetBumpmapReadyState(1, texp->bumpmap);
212 if ((GameTextures[fp->texnum].flags & TF_SMOOTH_SPECULAR))
213 smooth = 1;
214 }
215
216 float uchange = 0, vchange = 0;
217
218 // Figure out if there is any texture sliding
219 if (texp && texp->slide_u != 0) {
220 int int_time = Gametime / texp->slide_u;
221 float norm_time = Gametime - (int_time * texp->slide_u);
222 norm_time /= texp->slide_u;
223
224 uchange = norm_time;
225 }
226
227 if (texp && texp->slide_v != 0) {
228 int int_time = Gametime / texp->slide_v;
229 float norm_time = Gametime - (int_time * texp->slide_v);
230 norm_time /= texp->slide_v;

Callers 2

Calls 15

vm_NormalizeVectorFastFunction · 0.85
GetTextureBitmapFunction · 0.85
GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_COLOR_BLUEFunction · 0.85
g3_SetTriangulationTestFunction · 0.85
g3_DrawPolyFunction · 0.85
DrawSubmodelFaceOutlineFunction · 0.85
rend_SetOverlayMapFunction · 0.50
rend_SetOverlayTypeFunction · 0.50
rend_SetTextureTypeFunction · 0.50

Tested by

no test coverage detected