rd->cullradius = 2048.0f;
rd->cullradius2 = rd->cullradius * rd->cullradius;
rd->lightsubtract = 1.0f / rd->cullradius2;
- rd->ent = cd->ent;
+ //rd->ent = cd->ent;
r_numdlights++;
c_dlights++; // count every dlight in use
}
void R_LightModel(int numverts, float colorr, float colorg, float colorb, int worldcoords)
{
int i, j, nearlights = 0;
- float color[3], basecolor[3], v[3], t, *av, *avn, *avc, a, number, f, dist2, mscale;
+ float color[3], basecolor[3], v[3], t, *av, *avn, *avc, a, f, dist2, mscale, dot;
struct
{
vec3_t origin;
{
if (!(modeldlightbits[i >> 5] & (1 << (i & 31))))
continue;
+ /*
if (currentrenderentity == r_dlight[i].ent)
{
f = (1.0f / LIGHTOFFSET) - nl->lightsubtract;
}
else
{
+ */
// transform the light into the model's coordinate system
if (worldcoords)
VectorCopy(r_dlight[i].origin, nl->origin);
nl->offset = LIGHTOFFSET;
nl++;
nearlights++;
- }
+ //}
}
}
else
{
VectorSubtract(nl->origin, av, v);
// directional shading
- a = DotProduct(avn,v);
- if (a > 0)
+ dot = DotProduct(avn,v);
+ if (dot > 0)
{
// the vertex normal faces the light
#if SLOWMATH
t = 1.0f / sqrt(dist2);
#else
- number = DotProduct(v, v);
- *((int *)&t) = 0x5f3759df - ((* (int *) &number) >> 1);
- t = t * (1.5f - (number * 0.5f * t * t));
+ *((int *)&t) = 0x5f3759df - ((* (int *) &dist2) >> 1);
+ t = t * (1.5f - (dist2 * 0.5f * t * t));
#endif
- // a * t is dotproduct with a normalized v.
+
+ // dot * t is dotproduct with a normalized v.
// (the result would be -1 to +1, but we already
// eliminated the <= 0 case, so it is 0 to 1)
// the hardness variables are for backlighting/shinyness
// these have been hardwired at * 0.5 + 0.5 to match
// the quake map lighting utility's equations
- f *= a * t * 0.5f + 0.5f;// * hardness + hardnessoffset;
+ f *= dot * t * 0.5f + 0.5f;// * hardness + hardnessoffset;
VectorMA(color, f, nl->light, color);
}
}