/* * ====================== * R_AddWorldSurface * ====================== */ static void R_AddWorldSurface(msurface_t *surf, int dlightBits) { if (surf->viewCount == tr.viewCount) { return; // already in this view } surf->viewCount = tr.viewCount; // FIXME: bmodel fog? // try to cull before dlighting or adding if (R_CullSurface(surf->data, surf->shader)) { return; } // check for dlighting if (dlightBits) { dlightBits = R_DlightSurface(surf, dlightBits); dlightBits = (dlightBits != 0); } R_AddDrawSurf(surf->data, surf->shader, surf->fogIndex, dlightBits); }
/* * ==================== * R_DlightSurface * * The given surface is going to be drawn, and it touches a leaf * that is touched by one or more dlights, so try to throw out * more dlights if possible. * ==================== */ static int R_DlightSurface(msurface_t *surf, int dlightBits) { if (*surf->data == SF_FACE) { dlightBits = R_DlightFace((srfSurfaceFace_t *)surf->data, dlightBits); } else if (*surf->data == SF_GRID) { dlightBits = R_DlightGrid((srfGridMesh_t *)surf->data, dlightBits); } else if (*surf->data == SF_TRIANGLES) { dlightBits = R_DlightTrisurf((srfTriangles_t *)surf->data, dlightBits); } else { dlightBits = 0; } if (dlightBits) { tr.pc.c_dlightSurfaces++; } return(dlightBits); }