float nearclip, farclip, bias;
r_viewport_t viewport;
int flipped;
- float clearcolor[4];
if (r_shadow_rendermode != R_SHADOW_RENDERMODE_SHADOWMAP2D)
{
r_refdef.view.cullface_front = flipped ? r_shadow_cullface_back : r_shadow_cullface_front;
r_refdef.view.cullface_back = flipped ? r_shadow_cullface_front : r_shadow_cullface_back;
- Vector4Set(clearcolor, 1,1,1,1);
if (r_shadow_shadowmap2ddepthbuffer)
GL_ColorMask(1,1,1,1);
else
settings->rng_type = r_shadow_bouncegrid_rng_type.integer;
settings->rng_seed = r_shadow_bouncegrid_rng_seed.integer;
settings->bounceminimumintensity2 = bounceminimumintensity * bounceminimumintensity;
- settings->bounceminimumintensity2 = bounceminimumintensity * bounceminimumintensity;
settings->normalizevectors = r_shadow_bouncegrid_normalizevectors.integer != 0;
settings->subsamples = bound(1, r_shadow_bouncegrid_subsamples.integer, 4);
randomseed_t randomseed;
vec3_t baseshotcolor;
- t->started = 1;
-
normalphotonscaling = 1.0f / max(0.0000001f, r_shadow_bouncegrid_state.settings.energyperphoton);
for (lightindex = 0;lightindex < range2;lightindex++)
{
static void R_Shadow_BounceGrid_Slice_Task(taskqueue_task_t *t)
{
- t->started = 1;
R_Shadow_BounceGrid_Slice((int)t->i[0]);
t->done = 1;
}
TaskQueue_Yield(t);
return;
}
- t->started = 1;
slices = r_shadow_bouncegrid_state.resolution[2] - 2;
for (i = 0; i < slices; i++)
TaskQueue_Setup(r_shadow_bouncegrid_state.slices_tasks + i, NULL, R_Shadow_BounceGrid_Slice_Task, i + 1, 0, NULL, NULL);
{
float *pixels[4];
unsigned int resolution[3];
- t->started = 1;
if (r_shadow_bouncegrid_state.settings.blur)
{
VectorCopy(r_shadow_bouncegrid_state.resolution, resolution);
void R_Shadow_BounceGrid_ClearTex_Task(taskqueue_task_t *t)
{
- t->started = 1;
memset(r_shadow_bouncegrid_state.highpixels, 0, r_shadow_bouncegrid_state.numpixels * sizeof(float[4]));
t->done = 1;
}
static void R_Shadow_BounceGrid_TracePhotons_ShotTask(taskqueue_task_t *t)
{
r_shadow_bouncegrid_photon_t *p = (r_shadow_bouncegrid_photon_t *)t->p[0];
- t->started = 1;
R_Shadow_BounceGrid_TracePhotons_Shot(p, r_shadow_bouncegrid_state.settings.maxbounce, p->start, p->end, p->color, p->bounceminimumintensity2, p->startrefractiveindex);
t->done = 1;
}
static void R_Shadow_BounceGrid_EnqueuePhotons_Task(taskqueue_task_t *t)
{
int i;
- t->started = 1;
for (i = 0; i < r_shadow_bouncegrid_state.numphotons; i++)
TaskQueue_Setup(r_shadow_bouncegrid_state.photons_tasks + i, NULL, R_Shadow_BounceGrid_TracePhotons_ShotTask, 0, 0, r_shadow_bouncegrid_state.photons + i, NULL);
TaskQueue_Setup(&r_shadow_bouncegrid_state.photons_done_task, NULL, TaskQueue_Task_CheckTasksDone, r_shadow_bouncegrid_state.numphotons, 0, r_shadow_bouncegrid_state.photons_tasks, NULL);
{
int i;
int numsurfaces;
- unsigned char *shadowtrispvs, *lighttrispvs, *surfacesides;
+ unsigned char *shadowtrispvs, *surfacesides;
int numlightentities;
int numlightentities_noselfshadow;
int numshadowentities;
shadowentities = rtlight->cached_shadowentities;
shadowentities_noselfshadow = rtlight->cached_shadowentities_noselfshadow;
shadowtrispvs = rtlight->cached_shadowtrispvs;
- lighttrispvs = rtlight->cached_lighttrispvs;
surfacelist = rtlight->cached_surfacelist;
// make this the active rtlight for rendering purposes
{
int i;
int numsurfaces;
- unsigned char *shadowtrispvs, *lighttrispvs;
+ unsigned char *lighttrispvs;
int numlightentities;
int numlightentities_noselfshadow;
- int numshadowentities;
- int numshadowentities_noselfshadow;
entity_render_t **lightentities;
entity_render_t **lightentities_noselfshadow;
entity_render_t **shadowentities;
numlightentities = rtlight->cached_numlightentities;
numlightentities_noselfshadow = rtlight->cached_numlightentities_noselfshadow;
- numshadowentities = rtlight->cached_numshadowentities;
- numshadowentities_noselfshadow = rtlight->cached_numshadowentities_noselfshadow;
numsurfaces = rtlight->cached_numsurfaces;
lightentities = rtlight->cached_lightentities;
lightentities_noselfshadow = rtlight->cached_lightentities_noselfshadow;
shadowentities = rtlight->cached_shadowentities;
shadowentities_noselfshadow = rtlight->cached_shadowentities_noselfshadow;
- shadowtrispvs = rtlight->cached_shadowtrispvs;
lighttrispvs = rtlight->cached_lighttrispvs;
surfacelist = rtlight->cached_surfacelist;
castshadows = rtlight->castshadows;
{
float borderbias;
int size;
- float shadowmapoffsetnoselfshadow = 0;
matrix4x4_t radiustolight = rtlight->matrix_worldtolight;
Matrix4x4_Abs(&radiustolight);
//Con_Printf("distance %f lodlinear %i size %i\n", distance, lodlinear, size);
- if (rtlight->cached_numshadowentities_noselfshadow)
- shadowmapoffsetnoselfshadow = rtlight->shadowmapatlassidesize * 2;
-
// render lighting using the depth texture as shadowmap
// draw lighting in the unmasked areas
if (numsurfaces + numlightentities)