}
}
- R_UpdateTexture(surface->lightmaptexture, templight, surface->lightmapinfo->lightmaporigin[0], surface->lightmapinfo->lightmaporigin[1], smax, tmax);
+ R_UpdateTexture(surface->lightmaptexture, templight, surface->lightmapinfo->lightmaporigin[0], surface->lightmapinfo->lightmaporigin[1], 0, smax, tmax, 1);
// update the surface's deluxemap if it has one
if (surface->deluxemaptexture != r_texture_blanknormalmap)
l = (int)(n[2] * 128 + 128);out[0] = bound(0, l, 255);
out[3] = 255;
}
- R_UpdateTexture(surface->deluxemaptexture, templight, surface->lightmapinfo->lightmaporigin[0], surface->lightmapinfo->lightmaporigin[1], smax, tmax);
+ R_UpdateTexture(surface->deluxemaptexture, templight, surface->lightmapinfo->lightmaporigin[0], surface->lightmapinfo->lightmaporigin[1], 0, smax, tmax, 1);
}
}
GL_DepthTest(true);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
- GL_AlphaTest(false);
// R_Mesh_ResetTextureState();
R_SetupShader_DepthOrShadow();
if (ent == r_refdef.scene.worldentity)
{
float origin[3];
VectorCopy(info->relativelightorigin, origin);
- if (!r_svbsp.nodes)
- {
- r_svbsp.maxnodes = max(r_svbsp.maxnodes, 1<<18);
- r_svbsp.nodes = (svbsp_node_t*) Mem_Alloc(r_main_mempool, r_svbsp.maxnodes * sizeof(svbsp_node_t));
- }
+ r_svbsp.maxnodes = max(r_svbsp.maxnodes, 1<<12);
+ r_svbsp.nodes = (svbsp_node_t*) R_FrameData_Alloc(r_svbsp.maxnodes * sizeof(svbsp_node_t));
info->svbsp_active = true;
info->svbsp_insertoccluder = true;
for (;;)
// an upper limit is imposed
if (r_svbsp.maxnodes >= 2<<22)
break;
- Mem_Free(r_svbsp.nodes);
r_svbsp.maxnodes *= 2;
- r_svbsp.nodes = (svbsp_node_t*) Mem_Alloc(tempmempool, r_svbsp.maxnodes * sizeof(svbsp_node_t));
+ r_svbsp.nodes = (svbsp_node_t*) R_FrameData_Alloc(r_svbsp.maxnodes * sizeof(svbsp_node_t));
+ //Mem_Free(r_svbsp.nodes);
+ //r_svbsp.nodes = (svbsp_node_t*) Mem_Alloc(tempmempool, r_svbsp.maxnodes * sizeof(svbsp_node_t));
}
else
break;
}
else
R_Q1BSP_RecursiveGetLightInfo_BSP(info, false);
+ // we're using temporary framedata memory, so this pointer will be invalid soon, clear it
+ r_svbsp.nodes = NULL;
if (developer_extra.integer && use_svbsp)
{
Con_DPrintf("GetLightInfo: svbsp built with %i nodes, polygon stats:\n", r_svbsp.numnodes);
// check the box in modelspace, it was already checked in worldspace
if (!BoxesOverlap(model->normalmins, model->normalmaxs, lightmins, lightmaxs))
return;
+ R_FrameData_SetMark();
if (ent->model->brush.submodel)
GL_PolygonOffset(r_refdef.shadowpolygonfactor + r_polygonoffset_submodel_factor.value, r_refdef.shadowpolygonoffset + r_polygonoffset_submodel_offset.value);
if (model->brush.shadowmesh)
}
if (ent->model->brush.submodel)
GL_PolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);
+ R_FrameData_ReturnToMark();
}
void R_Q1BSP_CompileShadowMap(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist)
// check the box in modelspace, it was already checked in worldspace
if (!BoxesOverlap(model->normalmins, model->normalmaxs, lightmins, lightmaxs))
return;
+ R_FrameData_SetMark();
// identify lit faces within the bounding box
for (modelsurfacelistindex = 0;modelsurfacelistindex < modelnumsurfaces;modelsurfacelistindex++)
{
}
--modelsurfacelistindex;
GL_CullFace(rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE ? GL_NONE : r_refdef.view.cullface_back);
- RSurf_PrepareVerticesForBatch(BATCHNEED_VERTEXPOSITION, batchnumsurfaces, batchsurfacelist);
- R_Mesh_PrepareVertices_Position(rsurface.batchnumvertices, rsurface.batchvertexposition, rsurface.batchvertexpositionbuffer);
+ RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX, batchnumsurfaces, batchsurfacelist);
+ if (rsurface.batchvertex3fbuffer)
+ R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3fbuffer);
+ else
+ R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer);
RSurf_DrawBatch();
}
+ R_FrameData_ReturnToMark();
}
#define BATCHSIZE 1024
int i, j, endsurface;
texture_t *t;
const msurface_t *surface;
+ R_FrameData_SetMark();
// note: in practice this never actually receives batches
R_Shadow_RenderMode_Begin();
R_Shadow_RenderMode_ActiveLight(rtlight);
}
}
R_Shadow_RenderMode_End();
+ R_FrameData_ReturnToMark();
}
extern qboolean r_shadow_usingdeferredprepass;
const msurface_t **texturesurfacelist;
texture_t *tex;
CHECKGLERROR
+ R_FrameData_SetMark();
// this is a double loop because non-visible surface skipping has to be
// fast, and even if this is not the world model (and hence no visibility
// checking) the input surface list and batch buffer are different formats
R_Shadow_RenderLighting(texturenumsurfaces, texturesurfacelist);
}
}
+ R_FrameData_ReturnToMark();
}
//Made by [515]