X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=gl_rsurf.c;h=cd0c3c9575176caba2915db98b4292e04c7c7c8f;hb=2b642e8fff6d3514ba222d9d401f29fe630f84c6;hp=1927aa226c8edf8026e2537d3907294bcd6c7b4c;hpb=9a86055855339709591f493513e8192102db2998;p=xonotic%2Fdarkplaces.git diff --git a/gl_rsurf.c b/gl_rsurf.c index 1927aa22..cd0c3c95 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -44,16 +44,30 @@ void R_BuildLightMap (const entity_render_t *ent, msurface_t *surface) int *bl, scale; unsigned char *lightmap, *out, *stain; model_t *model = ent->model; - static int intblocklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*3]; // LordHavoc: *3 for colored lighting - static unsigned char templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4]; - - // update cached lighting info - surface->cached_dlight = 0; + int *intblocklights; + unsigned char *templight; smax = (surface->lightmapinfo->extents[0]>>4)+1; tmax = (surface->lightmapinfo->extents[1]>>4)+1; size = smax*tmax; size3 = size*3; + + if (cl.buildlightmapmemorysize < size*sizeof(int[3])) + { + cl.buildlightmapmemorysize = size*sizeof(int[3]); + if (cl.buildlightmapmemory) + Mem_Free(cl.buildlightmapmemory); + cl.buildlightmapmemory = Mem_Alloc(cls.levelmempool, cl.buildlightmapmemorysize); + } + + // these both point at the same buffer, templight is only used for final + // processing and can replace the intblocklights data as it goes + intblocklights = (int *)cl.buildlightmapmemory; + templight = (unsigned char *)cl.buildlightmapmemory; + + // update cached lighting info + surface->cached_dlight = 0; + lightmap = surface->lightmapinfo->samples; // set to full bright if no light data @@ -509,9 +523,9 @@ void R_Q1BSP_DrawSky(entity_render_t *ent) if (ent->model == NULL) return; if (ent == r_refdef.worldentity) - R_DrawWorldSurfaces(true); + R_DrawWorldSurfaces(true, true, false); else - R_DrawModelSurfaces(ent, true); + R_DrawModelSurfaces(ent, true, true, false); } void R_Q1BSP_Draw(entity_render_t *ent) @@ -520,9 +534,20 @@ void R_Q1BSP_Draw(entity_render_t *ent) if (model == NULL) return; if (ent == r_refdef.worldentity) - R_DrawWorldSurfaces(false); + R_DrawWorldSurfaces(false, true, false); + else + R_DrawModelSurfaces(ent, false, true, false); +} + +void R_Q1BSP_DrawDepth(entity_render_t *ent) +{ + model_t *model = ent->model; + if (model == NULL) + return; + if (ent == r_refdef.worldentity) + R_DrawWorldSurfaces(false, false, true); else - R_DrawModelSurfaces(ent, false); + R_DrawModelSurfaces(ent, false, false, true); } typedef struct r_q1bsp_getlightinfo_s