50 splitplane = node->
plane;
122 float front, back, frac;
147 if ((back < 0) == side)
150 frac = front / (front - back);
151 mid[0] = start[0] + (end[0] - start[0])*frac;
152 mid[1] = start[1] + (end[1] - start[1])*frac;
153 mid[2] = start[2] + (end[2] - start[2])*frac;
162 if ((back < 0) == side)
179 if (s < surf->texturemins[0] ||
180 t < surf->texturemins[1])
199 lightmap += dt * ((surf->
extents[0] >> 4) + 1) + ds;
204 samp = *lightmap * (1.0 / 255);
207 lightmap += ((surf->
extents[0] >> 4) + 1) *
237 color[0] = color[1] = color[2] = 1.0;
243 end[2] = p[2] - 2048;
283 float front, back, frac;
306 if ((back < 0) == side)
309 frac = front / (front - back);
310 mid[0] = start[0] + (end[0] - start[0])*frac;
311 mid[1] = start[1] + (end[1] - start[1])*frac;
312 mid[2] = start[2] + (end[2] - start[2])*frac;
319 if ((back < 0) == side)
337 if (s < surf->texturemins[0] ||
338 t < surf->texturemins[1])
359 lightmap += 3 * (dt * ((surf->
extents[0] >> 4) + 1) + ds);
364 for (
i = 0;
i < 3;
i++)
367 pointcolor[0] += lightmap[0] * scale[0] * (1.0 / 255);
368 pointcolor[1] += lightmap[1] * scale[1] * (1.0 / 255);
369 pointcolor[2] += lightmap[2] * scale[2] * (1.0 / 255);
370 lightmap += 3 * ((surf->
extents[0] >> 4) + 1) *
399 color[0] = color[1] = color[2] = 1.0;
405 end[2] = p[2] - 2048;
456 float dist, rad, minlight;
466 smax = (surf->
extents[0] >> 4) + 1;
467 tmax = (surf->
extents[1] >> 4) + 1;
495 minlight = rad - minlight;
497 for (
i = 0;
i < 3;
i++)
509 for (
t = 0;
t < tmax;
t++)
514 for (
s = 0;
s < smax;
s++)
520 dist = sd + (td >> 1);
522 dist = td + (sd >> 1);
563 smax = (surf->
extents[0] >> 4) + 1;
564 tmax = (surf->
extents[1] >> 4) + 1;
569 for (
i = 0;
i < size;
i++)
575 for (
i = 0;
i < size;
i++)
586 for (
i = 0;
i < size;
i++)
596 for (
i = 0;
i < size;
i++)
625 float dist, rad, minlight;
633 float cred, cgreen, cblue, brightness;
636 smax = (surf->
extents[0] >> 4) + 1;
637 tmax = (surf->
extents[1] >> 4) + 1;
665 minlight = rad - minlight;
667 for (
i = 0;
i < 3;
i++)
678 cred = dl[lnum].
color[0] * 256.0f;
679 cgreen = dl[lnum].
color[1] * 256.0f;
680 cblue = dl[lnum].
color[2] * 256.0f;
683 for (
t = 0;
t < tmax;
t++)
688 for (
s = 0;
s < smax;
s++)
694 dist = sd + (td >> 1);
696 dist = td + (sd >> 1);
704 brightness = rad - dist;
705 bl[0] += (
int)(brightness * cred);
706 bl[1] += (
int)(brightness * cgreen);
707 bl[2] += (
int)(brightness * cblue);
715 brightness = rad - dist;
716 bl[0] -= (
int)(brightness * cred);
717 bl[1] -= (
int)(brightness * cgreen);
718 bl[2] -= (
int)(brightness * cblue);
719 if (bl[0] < minlight) bl[0] = minlight;
720 if (bl[1] < minlight) bl[1] = minlight;
721 if (bl[2] < minlight) bl[2] = minlight;
743 smax = (surf->
extents[0] >> 4) + 1;
744 tmax = (surf->
extents[1] >> 4) + 1;
745 size = smax*tmax * 3;
750 for (
i = 0;
i < size;
i++){
760 for (
i = 0;
i < size;
i++)
770 for (
i = 0;
i < size;
i += 3)
787 for (
i = 0;
i < size;
i++)