vkQuake2 doxygen  1.0 dev
vk_light.c
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 Copyright (C) 2018-2019 Krzysztof Kondrak
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 
14 See the GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 
20 */
21 // vk_light.c
22 
23 #include "vk_local.h"
24 
26 
27 #define DLIGHT_CUTOFF 64
28 
29 /*
30 =============================================================================
31 
32 DYNAMIC LIGHTS BLEND RENDERING
33 
34 =============================================================================
35 */
36 
37 void R_RenderDlight (dlight_t *light)
38 {
39  int i, j;
40  float a;
41  float rad;
42 
43  rad = light->intensity * 0.35;
44 
45  struct {
46  vec3_t verts;
47  float color[3];
48  } lightVerts[18];
49 
50  for (i = 0; i < 3; i++)
51  lightVerts[0].verts[i] = light->origin[i] - vpn[i] * rad;
52 
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;
56 
57  for (i = 16; i >= 0; i--)
58  {
59  a = i / 16.0 * M_PI * 2;
60  for (j = 0; j < 3; j++)
61  {
62  lightVerts[i+1].verts[j] = light->origin[j] + vright[j] * cos(a)*rad
63  + vup[j] * sin(a)*rad;
64  lightVerts[i+1].color[j] = 0.f;
65  }
66  }
67 
69 
70  VkBuffer vbo;
71  VkDeviceSize vboOffset;
72  uint32_t uboOffset;
73  VkDescriptorSet uboDescriptorSet;
74  uint8_t *vertData = QVk_GetVertexBuffer(sizeof(lightVerts), &vbo, &vboOffset);
75  uint8_t *uboData = QVk_GetUniformBuffer(sizeof(r_viewproj_matrix), &uboOffset, &uboDescriptorSet);
76  memcpy(vertData, lightVerts, sizeof(lightVerts));
77  memcpy(uboData, r_viewproj_matrix, sizeof(r_viewproj_matrix));
78 
79  vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1, &vbo, &vboOffset);
80  vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawDLightPipeline.layout, 0, 1, &uboDescriptorSet, 1, &uboOffset);
81  vkCmdBindIndexBuffer(vk_activeCmdbuffer, QVk_GetTriangleFanIbo(48), 0, VK_INDEX_TYPE_UINT16);
82  vkCmdDrawIndexed(vk_activeCmdbuffer, 48, 1, 0, 0, 0);
83 }
84 
85 /*
86 =============
87 R_RenderDlights
88 =============
89 */
90 void R_RenderDlights (void)
91 {
92  int i;
93  dlight_t *l;
94 
95  if (!vk_flashblend->value)
96  return;
97 
98  r_dlightframecount = r_framecount + 1; // because the count hasn't
99  // advanced yet for this frame
100  l = r_newrefdef.dlights;
101  for (i=0 ; i<r_newrefdef.num_dlights ; i++, l++)
102  R_RenderDlight (l);
103 }
104 
105 
106 /*
107 =============================================================================
108 
109 DYNAMIC LIGHTS
110 
111 =============================================================================
112 */
113 
114 /*
115 =============
116 R_MarkLights
117 =============
118 */
119 void R_MarkLights (dlight_t *light, int bit, mnode_t *node)
120 {
121  cplane_t *splitplane;
122  float dist;
123  msurface_t *surf;
124  int i;
125 
126  if (node->contents != -1)
127  return;
128 
129  splitplane = node->plane;
130  dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist;
131 
132  if (dist > light->intensity-DLIGHT_CUTOFF)
133  {
134  R_MarkLights (light, bit, node->children[0]);
135  return;
136  }
137  if (dist < -light->intensity+DLIGHT_CUTOFF)
138  {
139  R_MarkLights (light, bit, node->children[1]);
140  return;
141  }
142 
143 // mark the polygons
144  surf = r_worldmodel->surfaces + node->firstsurface;
145  for (i=0 ; i<node->numsurfaces ; i++, surf++)
146  {
147  if (surf->dlightframe != r_dlightframecount)
148  {
149  surf->dlightbits = 0;
151  }
152  surf->dlightbits |= bit;
153  }
154 
155  R_MarkLights (light, bit, node->children[0]);
156  R_MarkLights (light, bit, node->children[1]);
157 }
158 
159 
160 /*
161 =============
162 R_PushDlights
163 =============
164 */
165 void R_PushDlights (void)
166 {
167  int i;
168  dlight_t *l;
169 
170  if (vk_flashblend->value)
171  return;
172 
173  r_dlightframecount = r_framecount + 1; // because the count hasn't
174  // advanced yet for this frame
175  l = r_newrefdef.dlights;
176  for (i=0 ; i<r_newrefdef.num_dlights ; i++, l++)
177  R_MarkLights ( l, 1<<i, r_worldmodel->nodes );
178 }
179 
180 
181 /*
182 =============================================================================
183 
184 LIGHT SAMPLING
185 
186 =============================================================================
187 */
188 
190 cplane_t *lightplane; // used as shadow plane
192 
193 int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
194 {
195  float front, back, frac;
196  int side;
197  cplane_t *plane;
198  vec3_t mid;
199  msurface_t *surf;
200  int s, t, ds, dt;
201  int i;
202  mtexinfo_t *tex;
203  byte *lightmap;
204  int maps;
205  int r;
206 
207  if (node->contents != -1)
208  return -1; // didn't hit anything
209 
210 // calculate mid point
211 
212 // FIXME: optimize for axial
213  plane = node->plane;
214  front = DotProduct (start, plane->normal) - plane->dist;
215  back = DotProduct (end, plane->normal) - plane->dist;
216  side = front < 0;
217 
218  if ( (back < 0) == side)
219  return RecursiveLightPoint (node->children[side], start, end);
220 
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;
225 
226 // go down front side
227  r = RecursiveLightPoint (node->children[side], start, mid);
228  if (r >= 0)
229  return r; // hit something
230 
231  if ( (back < 0) == side )
232  return -1; // didn't hit anuthing
233 
234 // check for impact on this node
235  VectorCopy (mid, lightspot);
236  lightplane = plane;
237 
238  surf = r_worldmodel->surfaces + node->firstsurface;
239  for (i=0 ; i<node->numsurfaces ; i++, surf++)
240  {
241  if (surf->flags&(SURF_DRAWTURB|SURF_DRAWSKY))
242  continue; // no lightmaps
243 
244  tex = surf->texinfo;
245 
246  s = DotProduct (mid, tex->vecs[0]) + tex->vecs[0][3];
247  t = DotProduct (mid, tex->vecs[1]) + tex->vecs[1][3];;
248 
249  if (s < surf->texturemins[0] ||
250  t < surf->texturemins[1])
251  continue;
252 
253  ds = s - surf->texturemins[0];
254  dt = t - surf->texturemins[1];
255 
256  if ( ds > surf->extents[0] || dt > surf->extents[1] )
257  continue;
258 
259  if (!surf->samples)
260  return 0;
261 
262  ds >>= 4;
263  dt >>= 4;
264 
265  lightmap = surf->samples;
267  if (lightmap)
268  {
269  vec3_t scale;
270 
271  lightmap += 3*(dt * ((surf->extents[0]>>4)+1) + ds);
272 
273  for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
274  maps++)
275  {
276  for (i=0 ; i<3 ; i++)
277  scale[i] = vk_modulate->value*r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
278 
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) *
283  ((surf->extents[1]>>4)+1);
284  }
285  }
286 
287  return 1;
288  }
289 
290 // go down back side
291  return RecursiveLightPoint (node->children[!side], mid, end);
292 }
293 
294 /*
295 ===============
296 R_LightPoint
297 ===============
298 */
299 void R_LightPoint (vec3_t p, vec3_t color)
300 {
301  vec3_t end;
302  float r;
303  int lnum;
304  dlight_t *dl;
305  vec3_t dist;
306  float add;
307 
308  if (!r_worldmodel->lightdata)
309  {
310  color[0] = color[1] = color[2] = 1.0;
311  return;
312  }
313 
314  end[0] = p[0];
315  end[1] = p[1];
316  end[2] = p[2] - 2048;
317 
319 
320  if (r == -1)
321  {
322  VectorCopy (vec3_origin, color);
323  }
324  else
325  {
326  VectorCopy (pointcolor, color);
327  }
328 
329  //
330  // add dynamic lights
331  //
332  dl = r_newrefdef.dlights;
333  for (lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++, dl++)
334  {
336  dl->origin,
337  dist);
338  add = dl->intensity - VectorLength(dist);
339  add *= (1.0/256);
340  if (add > 0)
341  {
342  VectorMA (color, add, dl->color, color);
343  }
344  }
345 
346  VectorScale (color, vk_modulate->value, color);
347 }
348 
349 
350 //===================================================================
351 
352 static float s_blocklights[34*34*3];
353 /*
354 ===============
355 R_AddDynamicLights
356 ===============
357 */
359 {
360  int lnum;
361  int sd, td;
362  float fdist, frad, fminlight;
363  vec3_t impact, local;
364  int s, t;
365  int i;
366  int smax, tmax;
367  mtexinfo_t *tex;
368  dlight_t *dl;
369  float *pfBL;
370  float fsacc, ftacc;
371 
372  smax = (surf->extents[0]>>4)+1;
373  tmax = (surf->extents[1]>>4)+1;
374  tex = surf->texinfo;
375 
376  for (lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++)
377  {
378  if ( !(surf->dlightbits & (1<<lnum) ) )
379  continue; // not lit by this light
380 
381  dl = &r_newrefdef.dlights[lnum];
382  frad = dl->intensity;
383  fdist = DotProduct (dl->origin, surf->plane->normal) -
384  surf->plane->dist;
385  frad -= fabs(fdist);
386  // rad is now the highest intensity on the plane
387 
388  fminlight = DLIGHT_CUTOFF; // FIXME: make configurable?
389  if (frad < fminlight)
390  continue;
391  fminlight = frad - fminlight;
392 
393  for (i=0 ; i<3 ; i++)
394  {
395  impact[i] = dl->origin[i] -
396  surf->plane->normal[i]*fdist;
397  }
398 
399  local[0] = DotProduct (impact, tex->vecs[0]) + tex->vecs[0][3] - surf->texturemins[0];
400  local[1] = DotProduct (impact, tex->vecs[1]) + tex->vecs[1][3] - surf->texturemins[1];
401 
402  pfBL = s_blocklights;
403  for (t = 0, ftacc = 0 ; t<tmax ; t++, ftacc += 16)
404  {
405  td = local[1] - ftacc;
406  if ( td < 0 )
407  td = -td;
408 
409  for ( s=0, fsacc = 0 ; s<smax ; s++, fsacc += 16, pfBL += 3)
410  {
411  sd = Q_ftol( local[0] - fsacc );
412 
413  if ( sd < 0 )
414  sd = -sd;
415 
416  if (sd > td)
417  fdist = sd + (td>>1);
418  else
419  fdist = td + (sd>>1);
420 
421  if ( fdist < fminlight )
422  {
423  pfBL[0] += ( frad - fdist ) * dl->color[0];
424  pfBL[1] += ( frad - fdist ) * dl->color[1];
425  pfBL[2] += ( frad - fdist ) * dl->color[2];
426  }
427  }
428  }
429  }
430 }
431 
432 
433 /*
434 ** R_SetCacheState
435 */
437 {
438  int maps;
439 
440  for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
441  maps++)
442  {
443  surf->cached_light[maps] = r_newrefdef.lightstyles[surf->styles[maps]].white;
444  }
445 }
446 
447 /*
448 ===============
449 R_BuildLightMap
450 
451 Combine and scale multiple lightmaps into the floating format in blocklights
452 ===============
453 */
454 void R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
455 {
456  int smax, tmax;
457  int r, g, b, a, max;
458  int i, j, size;
459  byte *lightmap;
460  float scale[4];
461  int nummaps;
462  float *bl;
463  lightstyle_t *style;
464 
466  ri.Sys_Error (ERR_DROP, "R_BuildLightMap called for non-lit surface");
467 
468  smax = (surf->extents[0]>>4)+1;
469  tmax = (surf->extents[1]>>4)+1;
470  size = smax*tmax;
471  if (size > (sizeof(s_blocklights)>>4) )
472  ri.Sys_Error (ERR_DROP, "Bad s_blocklights size");
473 
474 // set to full bright if no light data
475  if (!surf->samples)
476  {
477  int maps;
478 
479  for (i=0 ; i<size*3 ; i++)
480  s_blocklights[i] = 255;
481  for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
482  maps++)
483  {
484  style = &r_newrefdef.lightstyles[surf->styles[maps]];
485  }
486  goto store;
487  }
488 
489  // count the # of maps
490  for ( nummaps = 0 ; nummaps < MAXLIGHTMAPS && surf->styles[nummaps] != 255 ;
491  nummaps++)
492  ;
493 
494  lightmap = surf->samples;
495 
496  // add all the lightmaps
497  if ( nummaps == 1 )
498  {
499  int maps;
500 
501  for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
502  maps++)
503  {
504  bl = s_blocklights;
505 
506  for (i=0 ; i<3 ; i++)
507  scale[i] = vk_modulate->value*r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
508 
509  if ( scale[0] == 1.0F &&
510  scale[1] == 1.0F &&
511  scale[2] == 1.0F )
512  {
513  for (i=0 ; i<size ; i++, bl+=3)
514  {
515  bl[0] = lightmap[i*3+0];
516  bl[1] = lightmap[i*3+1];
517  bl[2] = lightmap[i*3+2];
518  }
519  }
520  else
521  {
522  for (i=0 ; i<size ; i++, bl+=3)
523  {
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];
527  }
528  }
529  lightmap += size*3; // skip to next lightmap
530  }
531  }
532  else
533  {
534  int maps;
535 
536  memset( s_blocklights, 0, sizeof( s_blocklights[0] ) * size * 3 );
537 
538  for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
539  maps++)
540  {
541  bl = s_blocklights;
542 
543  for (i=0 ; i<3 ; i++)
544  scale[i] = vk_modulate->value*r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
545 
546  if ( scale[0] == 1.0F &&
547  scale[1] == 1.0F &&
548  scale[2] == 1.0F )
549  {
550  for (i=0 ; i<size ; i++, bl+=3 )
551  {
552  bl[0] += lightmap[i*3+0];
553  bl[1] += lightmap[i*3+1];
554  bl[2] += lightmap[i*3+2];
555  }
556  }
557  else
558  {
559  for (i=0 ; i<size ; i++, bl+=3)
560  {
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];
564  }
565  }
566  lightmap += size*3; // skip to next lightmap
567  }
568  }
569 
570 // add all the dynamic lights
571  if (surf->dlightframe == r_framecount)
572  R_AddDynamicLights (surf);
573 
574 // put into texture format
575 store:
576  stride -= (smax<<2);
577  bl = s_blocklights;
578 
579  for (i = 0; i < tmax; i++, dest += stride)
580  {
581  for (j = 0; j < smax; j++)
582  {
583 
584  r = Q_ftol(bl[0]);
585  g = Q_ftol(bl[1]);
586  b = Q_ftol(bl[2]);
587 
588  // catch negative lights
589  if (r < 0)
590  r = 0;
591  if (g < 0)
592  g = 0;
593  if (b < 0)
594  b = 0;
595 
596  /*
597  ** determine the brightest of the three color components
598  */
599  if (r > g)
600  max = r;
601  else
602  max = g;
603  if (b > max)
604  max = b;
605 
606  /*
607  ** alpha is ONLY used for the mono lightmap case. For this reason
608  ** we set it to the brightest of the color components so that
609  ** things don't get too dim.
610  */
611  a = max;
612 
613  /*
614  ** rescale all the color components if the intensity of the greatest
615  ** channel exceeds 1.0
616  */
617  if (max > 255)
618  {
619  float t = 255.0F / max;
620 
621  r = r * t;
622  g = g * t;
623  b = b * t;
624  a = a * t;
625  }
626 
627  dest[0] = r;
628  dest[1] = g;
629  dest[2] = b;
630  dest[3] = a;
631 
632  bl += 3;
633  dest += 4;
634  }
635  }
636 }
637 
nummaps
static int nummaps
Definition: menu.c:2393
cplane_s::normal
vec3_t normal
Definition: q_shared.h:415
r_framecount
int r_framecount
Definition: r_main.c:97
msurface_s::plane
mplane_t * plane
Definition: r_model.h:100
msurface_s::styles
byte styles[MAXLIGHTMAPS]
Definition: r_model.h:115
lightplane
cplane_t * lightplane
Definition: vk_light.c:190
entity_s::origin
float origin[3]
Definition: ref.h:57
vk_local.h
lightstyle_t::rgb
float rgb[3]
Definition: ref.h:98
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:163
ri
refimport_t ri
Definition: r_main.c:25
R_SetCacheState
void R_SetCacheState(msurface_t *surf)
Definition: vk_light.c:436
vright
vec3_t vright
Definition: r_main.c:74
mtexinfo_s
Definition: r_model.h:83
VectorScale
void VectorScale(vec3_t in, vec_t scale, vec3_t out)
Definition: q_shared.c:782
QVk_GetTriangleFanIbo
VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount)
Definition: vk_common.c:2198
i
int i
Definition: q_shared.c:305
msurface_s::dlightframe
int dlightframe
Definition: r_model.h:97
RecursiveLightPoint
int RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
Definition: vk_light.c:193
mnode_s
Definition: r_model.h:123
dlight_t::origin
vec3_t origin
Definition: ref.h:84
msurface_s::samples
byte * samples
Definition: r_model.h:116
r_viewproj_matrix
float r_viewproj_matrix[16]
Definition: vk_rmain.c:64
mnode_s::children
struct mnode_s * children[2]
Definition: r_model.h:135
M_PI
#define M_PI
Definition: q_shared.h:142
currententity
entity_t * currententity
Definition: r_bsp.c:28
SURF_WARP
#define SURF_WARP
Definition: qfiles.h:372
mplane_s::normal
vec3_t normal
Definition: r_model.h:59
msurface_s::extents
short extents[2]
Definition: r_model.h:110
msurface_s::cached_light
float cached_light[MAXLIGHTMAPS]
Definition: gl_model.h:123
R_PushDlights
void R_PushDlights(void)
Definition: vk_light.c:165
intensity
cvar_t * intensity
Definition: gl_image.c:31
SURF_TRANS66
#define SURF_TRANS66
Definition: qfiles.h:374
vup
vec3_t vup
Definition: r_main.c:72
j
GLint j
Definition: qgl_win.c:150
QVk_GetVertexBuffer
uint8_t * QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset)
Definition: vk_common.c:2019
r_dlightframecount
int r_dlightframecount
Definition: vk_light.c:25
r
GLdouble GLdouble r
Definition: qgl_win.c:336
mplane_s::dist
float dist
Definition: r_model.h:60
refdef_t::num_dlights
int num_dlights
Definition: ref.h:119
QVk_GetUniformBuffer
uint8_t * QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet)
Definition: vk_common.c:2100
VectorLength
vec_t VectorLength(vec3_t v)
Definition: q_shared.c:762
msurface_s::texinfo
mtexinfo_t * texinfo
Definition: r_model.h:112
t
GLdouble t
Definition: qgl_win.c:328
model_s::nodes
mnode_t * nodes
Definition: r_model.h:215
Q_ftol
long Q_ftol(float f)
vk_activeCmdbuffer
VkCommandBuffer vk_activeCmdbuffer
Definition: vk_common.c:127
refimport_t::Sys_Error
void(* Sys_Error)(int err_level, char *str,...)
Definition: ref.h:194
SURF_DRAWSKY
#define SURF_DRAWSKY
Definition: r_model.h:69
dlight_t::color
vec3_t color
Definition: ref.h:85
R_RenderDlights
void R_RenderDlights(void)
Definition: vk_light.c:90
r_newrefdef
refdef_t r_newrefdef
Definition: r_main.c:38
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:162
SURF_TRANS33
#define SURF_TRANS33
Definition: qfiles.h:373
r_worldmodel
model_t * r_worldmodel
Definition: r_main.c:41
cvar_s::value
float value
Definition: q_shared.h:331
cplane_s::dist
float dist
Definition: q_shared.h:416
model_s::lightdata
byte * lightdata
Definition: r_model.h:231
SURF_DRAWTURB
#define SURF_DRAWTURB
Definition: r_model.h:70
F
#define F(X, Y, Z)
Definition: md4.c:13
DLIGHT_CUTOFF
#define DLIGHT_CUTOFF
Definition: vk_light.c:27
R_AddDynamicLights
void R_AddDynamicLights(msurface_t *surf)
Definition: vk_light.c:358
lightspot
vec3_t lightspot
Definition: vk_light.c:191
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:744
R_BuildLightMap
void R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
Definition: vk_light.c:454
qvkpipeline_t::layout
VkPipelineLayout layout
Definition: qvk.h:154
MAXLIGHTMAPS
#define MAXLIGHTMAPS
Definition: qfiles.h:409
msurface_s::flags
int flags
Definition: r_model.h:101
lightstyle_t
Definition: ref.h:96
s
static fixed16_t s
Definition: r_scan.c:30
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:165
vk_flashblend
cvar_t * vk_flashblend
Definition: vk_rmain.c:97
refdef_t::lightstyles
lightstyle_t * lightstyles
Definition: ref.h:114
mtexinfo_s::vecs
float vecs[2][4]
Definition: r_model.h:85
vec3_origin
vec3_t vec3_origin
Definition: q_shared.c:24
QVk_BindPipeline
void QVk_BindPipeline(qvkpipeline_t *pipeline)
Definition: vk_common.c:2284
mnode_s::contents
int contents
Definition: r_model.h:126
mnode_s::firstsurface
unsigned short firstsurface
Definition: r_model.h:137
dlight_t
Definition: ref.h:82
model_s::surfaces
msurface_t * surfaces
Definition: r_model.h:221
mnode_s::plane
mplane_t * plane
Definition: r_model.h:134
VectorMA
void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
Definition: q_shared.c:719
local
static vec3_t local
Definition: r_part.c:468
pointcolor
vec3_t pointcolor
Definition: vk_light.c:189
stride
GLenum GLsizei stride
Definition: qgl_win.c:114
msurface_s
Definition: r_model.h:93
R_LightPoint
void R_LightPoint(vec3_t p, vec3_t color)
Definition: vk_light.c:299
mtexinfo_s::flags
int flags
Definition: r_model.h:88
R_RenderDlight
void R_RenderDlight(dlight_t *light)
Definition: vk_light.c:37
refdef_t::dlights
dlight_t * dlights
Definition: ref.h:120
msurface_s::texturemins
short texturemins[2]
Definition: r_model.h:109
lightstyle_t::white
float white
Definition: ref.h:99
msurface_s::dlightbits
int dlightbits
Definition: r_model.h:98
cplane_s
Definition: q_shared.h:413
mnode_s::numsurfaces
unsigned short numsurfaces
Definition: r_model.h:138
vk_drawDLightPipeline
qvkpipeline_t vk_drawDLightPipeline
Definition: vk_common.c:155
vpn
vec3_t vpn
Definition: r_main.c:73
max
#define max(a, b)
Definition: vk_local.h:75
dlight_t::intensity
float intensity
Definition: ref.h:86
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:134
R_MarkLights
void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
Definition: vk_light.c:119
vk_modulate
cvar_t * vk_modulate
Definition: vk_rmain.c:102
SURF_SKY
#define SURF_SKY
Definition: qfiles.h:371
s_blocklights
static float s_blocklights[34 *34 *3]
Definition: vk_light.c:352