Go to the source code of this file.
◆ DLIGHT_CUTOFF
◆ R_AddDynamicLights()
Definition at line 358 of file vk_light.c.
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];
Referenced by R_BuildLightMap().
◆ R_BuildLightMap()
Definition at line 454 of file vk_light.c.
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;
Referenced by GL_CreateSurfaceLightmap(), GL_RenderLightmappedPoly(), R_BlendLightmaps(), R_RenderBrushPoly(), Vk_CreateSurfaceLightmap(), and Vk_RenderLightmappedPoly().
◆ R_LightPoint()
Definition at line 299 of file vk_light.c.
310 color[0] = color[1] = color[2] = 1.0;
316 end[2] = p[2] - 2048;
◆ R_MarkLights()
◆ R_PushDlights()
◆ R_RenderDlight()
Definition at line 37 of file vk_light.c.
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));
Referenced by R_RenderDlights().
◆ R_RenderDlights()
◆ R_SetCacheState()
◆ RecursiveLightPoint()
Definition at line 193 of file vk_light.c.
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) *
Referenced by R_LightPoint().
◆ lightplane
◆ lightspot
◆ pointcolor
◆ r_dlightframecount
◆ s_blocklights
float s_blocklights[34 *34 *3] |
|
static |
byte styles[MAXLIGHTMAPS]
#define VectorSubtract(a, b, c)
void VectorScale(vec3_t in, vec_t scale, vec3_t out)
VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount)
int RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
float r_viewproj_matrix[16]
struct mnode_s * children[2]
float cached_light[MAXLIGHTMAPS]
uint8_t * QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset)
uint8_t * QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet)
vec_t VectorLength(vec3_t v)
VkCommandBuffer vk_activeCmdbuffer
void(* Sys_Error)(int err_level, char *str,...)
void R_AddDynamicLights(msurface_t *surf)
lightstyle_t * lightstyles
void QVk_BindPipeline(qvkpipeline_t *pipeline)
unsigned short firstsurface
void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
void R_RenderDlight(dlight_t *light)
unsigned short numsurfaces
qvkpipeline_t vk_drawDLightPipeline
void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
static float s_blocklights[34 *34 *3]