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

Function RenderRoomUnsorted

Descent3/render.cpp:2239–2366  ·  view source on GitHub ↗

Renders the faces in a room without worrying about sorting. Used in the game when Z-buffering is active

Source from the content-addressed store, hash-verified

2237
2238// Renders the faces in a room without worrying about sorting. Used in the game when Z-buffering is active
2239void RenderRoomUnsorted(room *rp) {
2240 int fn;
2241 int rcount = 0;
2242 ASSERT(rp->num_faces <= MAX_FACES_PER_ROOM);
2243
2244 // Rotate points in this room if need be
2245 if (rp->wpb_index == -1) {
2246 rp->wpb_index = Global_buffer_index;
2247
2248// Katmai enhanced rotate only in a release build, because not
2249// everyone has the intel compiler!
2250#if (defined(RELEASE) && defined(KATMAI))
2251 if (Katmai) {
2252 RotateRoomPoints(rp, rp->verts4);
2253 } else
2254#endif
2255 {
2256 RotateRoomPoints(rp, rp->verts);
2257 }
2258
2259 Global_buffer_index += rp->num_verts;
2260 }
2261
2262 // Sort portal faces if this is a fogged room
2263 if (rp->flags & RF_FOG) {
2264 SetupRoomFog(rp, &Viewer_eye, &Viewer_orient, Viewer_roomnum);
2265 }
2266
2267 // Check for visible (non-backfacing) faces, & render
2268 for (fn = 0; fn < rp->num_faces; fn++) {
2269 face *fp = &rp->faces[fn];
2270 int fogged_portal = 0;
2271
2272 if (!(fp->flags & FF_VISIBLE) || (fp->flags & FF_NOT_FACING)) {
2273 if (GameTextures[fp->tmap].flags & TF_SMOOTH_SPECULAR) {
2274 if (!Render_mirror_for_room && Detail_settings.Specular_lighting &&
2275 (GameTextures[fp->tmap].flags & TF_SPECULAR) &&
2276 ((fp->special_handle != BAD_SPECIAL_FACE_INDEX) || (rp->flags & RF_EXTERNAL))) {
2277 fp->flags |= FF_SPEC_INVISIBLE;
2278 UpdateSpecularFace(rp, fp);
2279 }
2280 }
2281 fp->flags &= ~(FF_NOT_FACING | FF_VISIBLE);
2282 continue; // this guy shouldn't be rendered
2283 }
2284
2285 // Clear visibility flags
2286 if (Render_mirror_for_room == false) {
2287 fp->flags &= ~(FF_VISIBLE | FF_NOT_FACING);
2288 } else {
2289 if (rp == &Rooms[Mirror_room]) {
2290 if (rp->faces[fn].tmap == rp->faces[rp->mirror_face].tmap)
2291 continue; // Don't render the mirror face if rendering the mirror
2292 }
2293 }
2294
2295 if (!FaceIsRenderable(rp, fp))
2296 continue; // skip this face

Callers 2

RenderMirroredRoomFunction · 0.85
RenderRoomFunction · 0.85

Calls 15

RotateRoomPointsFunction · 0.85
SetupRoomFogFunction · 0.85
UpdateSpecularFaceFunction · 0.85
FaceIsRenderableFunction · 0.85
RenderFaceFunction · 0.85
SortStatesFunction · 0.85
RenderLightmapFaceFunction · 0.85
GetFaceAlphaFunction · 0.70
rend_SetAlphaTypeFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetColorModelFunction · 0.50
rend_SetOverlayTypeFunction · 0.50

Tested by

no test coverage detected