27 #define DLIGHT_CUTOFF 64
50 for (
i = 0;
i < 3;
i++)
51 lightVerts[0].verts[
i] = light->
origin[
i] -
vpn[
i] * rad;
53 lightVerts[0].color[0] = light->
color[0] * 0.2;
54 lightVerts[0].color[1] = light->
color[1] * 0.2;
55 lightVerts[0].color[2] = light->
color[2] * 0.2;
57 for (
i = 16;
i >= 0;
i--)
59 a =
i / 16.0 *
M_PI * 2;
60 for (
j = 0;
j < 3;
j++)
63 +
vup[
j] * sin(a)*rad;
64 lightVerts[
i+1].color[
j] = 0.f;
71 VkDeviceSize vboOffset;
73 VkDescriptorSet uboDescriptorSet;
76 memcpy(vertData, lightVerts,
sizeof(lightVerts));
129 splitplane = node->
plane;
195 float front, back, frac;
218 if ( (back < 0) == side)
221 frac = front / (front-back);
222 mid[0] = start[0] + (end[0] - start[0])*frac;
223 mid[1] = start[1] + (end[1] - start[1])*frac;
224 mid[2] = start[2] + (end[2] - start[2])*frac;
231 if ( (back < 0) == side )
249 if (s < surf->texturemins[0] ||
250 t < surf->texturemins[1])
271 lightmap += 3*(dt * ((surf->
extents[0]>>4)+1) + ds);
276 for (
i=0 ;
i<3 ;
i++)
279 pointcolor[0] += lightmap[0] * scale[0] * (1.0/255);
280 pointcolor[1] += lightmap[1] * scale[1] * (1.0/255);
281 pointcolor[2] += lightmap[2] * scale[2] * (1.0/255);
282 lightmap += 3*((surf->
extents[0]>>4)+1) *
310 color[0] = color[1] = color[2] = 1.0;
316 end[2] = p[2] - 2048;
362 float fdist, frad, fminlight;
372 smax = (surf->
extents[0]>>4)+1;
373 tmax = (surf->
extents[1]>>4)+1;
389 if (frad < fminlight)
391 fminlight = frad - fminlight;
393 for (
i=0 ;
i<3 ;
i++)
403 for (
t = 0, ftacc = 0 ;
t<tmax ;
t++, ftacc += 16)
405 td =
local[1] - ftacc;
409 for (
s=0, fsacc = 0 ;
s<smax ;
s++, fsacc += 16, pfBL += 3)
417 fdist = sd + (td>>1);
419 fdist = td + (sd>>1);
421 if ( fdist < fminlight )
423 pfBL[0] += ( frad - fdist ) * dl->
color[0];
424 pfBL[1] += ( frad - fdist ) * dl->
color[1];
425 pfBL[2] += ( frad - fdist ) * dl->
color[2];
468 smax = (surf->
extents[0]>>4)+1;
469 tmax = (surf->
extents[1]>>4)+1;
479 for (
i=0 ;
i<size*3 ;
i++)
506 for (
i=0 ;
i<3 ;
i++)
509 if ( scale[0] == 1.0
F &&
513 for (
i=0 ;
i<size ;
i++, bl+=3)
515 bl[0] = lightmap[
i*3+0];
516 bl[1] = lightmap[
i*3+1];
517 bl[2] = lightmap[
i*3+2];
522 for (
i=0 ;
i<size ;
i++, bl+=3)
524 bl[0] = lightmap[
i*3+0] * scale[0];
525 bl[1] = lightmap[
i*3+1] * scale[1];
526 bl[2] = lightmap[
i*3+2] * scale[2];
543 for (
i=0 ;
i<3 ;
i++)
546 if ( scale[0] == 1.0
F &&
550 for (
i=0 ;
i<size ;
i++, bl+=3 )
552 bl[0] += lightmap[
i*3+0];
553 bl[1] += lightmap[
i*3+1];
554 bl[2] += lightmap[
i*3+2];
559 for (
i=0 ;
i<size ;
i++, bl+=3)
561 bl[0] += lightmap[
i*3+0] * scale[0];
562 bl[1] += lightmap[
i*3+1] * scale[1];
563 bl[2] += lightmap[
i*3+2] * scale[2];
579 for (
i = 0;
i < tmax;
i++, dest +=
stride)
581 for (
j = 0;
j < smax;
j++)
619 float t = 255.0F /
max;