-
- if (!ent->model)
- return;
-
- if (r_dynamic.integer)
- R_MarkLights(ent);
-
- if (!r_vertexsurfaces.integer)
- {
- for (i = 0, surf = ent->model->surfaces + ent->model->firstmodelsurface;i < ent->model->nummodelsurfaces;i++, surf++)
- {
- if (surf->visframe == r_framecount && surf->lightmaptexture != NULL)
- {
- if (surf->cached_dlight
- || surf->cached_ambient != r_ambient.value
- || surf->cached_lightscalebit != lightscalebit)
- R_BuildLightMap(ent, surf, false); // base lighting changed
- else if (r_dynamic.integer)
- {
- if (surf->styles[0] != 255 && (d_lightstylevalue[surf->styles[0]] != surf->cached_light[0]
- || (surf->styles[1] != 255 && (d_lightstylevalue[surf->styles[1]] != surf->cached_light[1]
- || (surf->styles[2] != 255 && (d_lightstylevalue[surf->styles[2]] != surf->cached_light[2]
- || (surf->styles[3] != 255 && (d_lightstylevalue[surf->styles[3]] != surf->cached_light[3]))))))))
- R_BuildLightMap(ent, surf, false); // base lighting changed
- else if (surf->dlightframe == r_framecount && r_dlightmap.integer)
- R_BuildLightMap(ent, surf, true); // only dlights
- }
- }
- }
- }
-}
-
-void R_SurfaceWorldNode (entity_render_t *ent)
-{
- int i;
- msurface_t *surf;
- model_t *model;
- model = ent->model;
- // FIXME: R_NotCulledBox is absolute, should be done relative
- for (i = 0, surf = model->surfaces + model->firstmodelsurface;i < model->nummodelsurfaces;i++, surf++)
- if (surf->pvsframe == r_pvsframecount && (!r_cullsurface.integer || R_NotCulledBox (surf->poly_mins, surf->poly_maxs)))
- surf->visframe = r_framecount;