26 #define DLIGHT_CUTOFF 64
55 qglBegin (GL_TRIANGLE_FAN);
56 qglColor3f (light->
color[0]*0.2, light->
color[1]*0.2, light->
color[2]*0.2);
61 for (
i=16 ;
i>=0 ;
i--)
88 qglDisable (GL_TEXTURE_2D);
89 qglShadeModel (GL_SMOOTH);
91 qglBlendFunc (GL_ONE, GL_ONE);
98 qglDisable (GL_BLEND);
99 qglEnable (GL_TEXTURE_2D);
100 qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
128 splitplane = node->
plane;
194 float front, back, frac;
217 if ( (back < 0) == side)
220 frac = front / (front-back);
221 mid[0] = start[0] + (end[0] - start[0])*frac;
222 mid[1] = start[1] + (end[1] - start[1])*frac;
223 mid[2] = start[2] + (end[2] - start[2])*frac;
230 if ( (back < 0) == side )
248 if (s < surf->texturemins[0] ||
249 t < surf->texturemins[1])
270 lightmap += 3*(dt * ((surf->
extents[0]>>4)+1) + ds);
275 for (
i=0 ;
i<3 ;
i++)
278 pointcolor[0] += lightmap[0] * scale[0] * (1.0/255);
279 pointcolor[1] += lightmap[1] * scale[1] * (1.0/255);
280 pointcolor[2] += lightmap[2] * scale[2] * (1.0/255);
281 lightmap += 3*((surf->
extents[0]>>4)+1) *
310 color[0] = color[1] = color[2] = 1.0;
316 end[2] = p[2] - 2048;
363 float fdist, frad, fminlight;
373 smax = (surf->
extents[0]>>4)+1;
374 tmax = (surf->
extents[1]>>4)+1;
390 if (frad < fminlight)
392 fminlight = frad - fminlight;
394 for (
i=0 ;
i<3 ;
i++)
404 for (
t = 0, ftacc = 0 ;
t<tmax ;
t++, ftacc += 16)
406 td = local[1] - ftacc;
410 for ( s=0, fsacc = 0 ; s<smax ; s++, fsacc += 16, pfBL += 3)
412 sd =
Q_ftol( local[0] - fsacc );
418 fdist = sd + (td>>1);
420 fdist = td + (sd>>1);
422 if ( fdist < fminlight )
424 pfBL[0] += ( frad - fdist ) * dl->
color[0];
425 pfBL[1] += ( frad - fdist ) * dl->
color[1];
426 pfBL[2] += ( frad - fdist ) * dl->
color[2];
470 smax = (surf->
extents[0]>>4)+1;
471 tmax = (surf->
extents[1]>>4)+1;
481 for (
i=0 ;
i<size*3 ;
i++)
508 for (
i=0 ;
i<3 ;
i++)
511 if ( scale[0] == 1.0
F &&
515 for (
i=0 ;
i<size ;
i++, bl+=3)
517 bl[0] = lightmap[
i*3+0];
518 bl[1] = lightmap[
i*3+1];
519 bl[2] = lightmap[
i*3+2];
524 for (
i=0 ;
i<size ;
i++, bl+=3)
526 bl[0] = lightmap[
i*3+0] * scale[0];
527 bl[1] = lightmap[
i*3+1] * scale[1];
528 bl[2] = lightmap[
i*3+2] * scale[2];
545 for (
i=0 ;
i<3 ;
i++)
548 if ( scale[0] == 1.0
F &&
552 for (
i=0 ;
i<size ;
i++, bl+=3 )
554 bl[0] += lightmap[
i*3+0];
555 bl[1] += lightmap[
i*3+1];
556 bl[2] += lightmap[
i*3+2];
561 for (
i=0 ;
i<size ;
i++, bl+=3)
563 bl[0] += lightmap[
i*3+0] * scale[0];
564 bl[1] += lightmap[
i*3+1] * scale[1];
565 bl[2] += lightmap[
i*3+2] * scale[2];
583 if ( monolightmap ==
'0' )
587 for (
j=0 ;
j<smax ;
j++)
625 float t = 255.0F / max;
647 for (
j=0 ;
j<smax ;
j++)
685 float t = 255.0F / max;
697 switch ( monolightmap )
706 a = 255 - ((
r+g+b)/3);