vkQuake2 doxygen  1.0 dev
vk_local.h File Reference
#include <windows.h>
#include <stdio.h>
#include <vulkan/vulkan.h>
#include <math.h>
#include "../client/ref.h"
#include "qvk.h"
#include "vk_model.h"

Go to the source code of this file.

Classes

struct  viddef_t
 
struct  image_s
 
struct  vkconfig_t
 
struct  vkstate_t
 

Macros

#define VK_USE_PLATFORM_WIN32_KHR
 
#define REF_VERSION   "Vulkan (vkQuake2 v"VKQUAKE2_VERSION")"
 
#define VKQUAKE2_VERSION   "1.4.3"
 
#define VK_VERIFY(x)   (void)(x)
 
#define PITCH   0
 
#define YAW   1
 
#define ROLL   2
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define MAX_VKTEXTURES   1024
 
#define MAX_LBM_HEIGHT   480
 
#define BACKFACE_EPSILON   0.01
 
#define MAX_LIGHTMAPS   128
 
#define DYNLIGHTMAP_OFFSET   MAX_LIGHTMAPS
 

Typedefs

typedef struct image_s image_t
 

Enumerations

enum  imagetype_t {
  it_skin, it_sprite, it_wall, it_pic,
  it_sky, it_skin, it_sprite, it_wall,
  it_pic, it_sky, it_skin, it_sprite,
  it_wall, it_pic, it_sky
}
 
enum  rserr_t {
  rserr_ok, rserr_invalid_fullscreen, rserr_invalid_mode, rserr_unknown,
  rserr_ok, rserr_invalid_fullscreen, rserr_invalid_mode, rserr_unknown,
  rserr_ok, rserr_invalid_fullscreen, rserr_invalid_mode, rserr_unknown
}
 

Functions

void R_LightPoint (vec3_t p, vec3_t color)
 
void R_PushDlights (void)
 
qboolean R_Init (void *hinstance, void *hWnd)
 
void R_Shutdown (void)
 
void R_RenderView (refdef_t *fd)
 
void Vk_ScreenShot_f (void)
 
void R_DrawAliasModel (entity_t *e)
 
void R_DrawBrushModel (entity_t *e)
 
void R_DrawSpriteModel (entity_t *e)
 
void R_DrawBeam (entity_t *e)
 
void R_DrawWorld (void)
 
void R_RenderDlights (void)
 
void R_DrawAlphaSurfaces (void)
 
void R_RenderBrushPoly (msurface_t *fa, float *modelMatrix, float alpha)
 
void R_InitParticleTexture (void)
 
void Draw_InitLocal (void)
 
void Vk_SubdivideSurface (msurface_t *fa)
 
qboolean R_CullBox (vec3_t mins, vec3_t maxs)
 
void R_RotateForEntity (entity_t *e, float *mvMatrix)
 
void R_MarkLeaves (void)
 
void EmitWaterPolys (msurface_t *fa, image_t *texture, float *modelMatrix, float *color)
 
void R_AddSkySurface (msurface_t *fa)
 
void R_ClearSkyBox (void)
 
void R_DrawSkyBox (void)
 
void R_MarkLights (dlight_t *light, int bit, mnode_t *node)
 
void COM_StripExtension (char *in, char *out)
 
void Draw_GetPicSize (int *w, int *h, char *name)
 
void Draw_Pic (int x, int y, char *name)
 
void Draw_StretchPic (int x, int y, int w, int h, char *name)
 
void Draw_Char (int x, int y, int c)
 
void Draw_TileClear (int x, int y, int w, int h, char *name)
 
void Draw_Fill (int x, int y, int w, int h, int c)
 
void Draw_FadeScreen (void)
 
void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data)
 
void R_BeginFrame (float camera_separation)
 
void R_EndFrame (void)
 
void R_SetPalette (const unsigned char *palette)
 
int Draw_GetPalette (void)
 
void Vk_ResampleTexture (unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight)
 
struct image_sR_RegisterSkin (char *name)
 
void LoadPCX (char *filename, byte **pic, byte **palette, int *width, int *height)
 
image_tVk_LoadPic (char *name, byte *pic, int width, int height, imagetype_t type, int bits, qvksampler_t *samplerType)
 
image_tVk_FindImage (char *name, imagetype_t type, qvksampler_t *samplerType)
 
void Vk_TextureMode (char *string)
 
void Vk_LmapTextureMode (char *string)
 
void Vk_ImageList_f (void)
 
void Vk_InitImages (void)
 
void Vk_ShutdownImages (void)
 
void Vk_FreeUnusedImages (void)
 
void Vk_DrawParticles (int n, const particle_t particles[], const unsigned colortable[768])
 
void Mat_Identity (float *matrix)
 
void Mat_Mul (float *m1, float *m2, float *res)
 
void Mat_Translate (float *matrix, float x, float y, float z)
 
void Mat_Rotate (float *matrix, float deg, float x, float y, float z)
 
void Mat_Scale (float *matrix, float x, float y, float z)
 
void Mat_Perspective (float *matrix, float *correction_matrix, float fovy, float aspect, float zNear, float zFar)
 
void Mat_Ortho (float *matrix, float left, float right, float bottom, float top, float zNear, float zFar)
 
void Vkimp_BeginFrame (float camera_separation)
 
void Vkimp_EndFrame (void)
 
int Vkimp_Init (void *hinstance, void *hWnd)
 
void Vkimp_Shutdown (void)
 
int Vkimp_SetMode (int *pwidth, int *pheight, int mode, qboolean fullscreen)
 
void Vkimp_AppActivate (qboolean active)
 
void Vkimp_EnableLogging (qboolean enable)
 
void Vkimp_LogNewFrame (void)
 
void Vkimp_GetSurfaceExtensions (char **extensions, uint32_t *extCount)
 
VkResult Vkimp_CreateSurface (void)
 

Variables

viddef_t vid
 
image_t vktextures [MAX_VKTEXTURES]
 
int numvktextures
 
image_tr_notexture
 
image_tr_particletexture
 
entity_tcurrententity
 
model_tcurrentmodel
 
int r_visframecount
 
int r_framecount
 
cplane_t frustum [4]
 
int c_brush_polys
 
int c_alias_polys
 
vec3_t vup
 
vec3_t vpn
 
vec3_t vright
 
vec3_t r_origin
 
refdef_t r_newrefdef
 
int r_viewcluster
 
int r_viewcluster2
 
int r_oldviewcluster
 
int r_oldviewcluster2
 
cvar_tr_norefresh
 
cvar_tr_lefthand
 
cvar_tr_drawentities
 
cvar_tr_drawworld
 
cvar_tr_speeds
 
cvar_tr_fullbright
 
cvar_tr_novis
 
cvar_tr_nocull
 
cvar_tr_lerpmodels
 
cvar_tr_lightlevel
 
cvar_tvk_validation
 
cvar_tvk_mode
 
cvar_tvk_bitdepth
 
cvar_tvk_log
 
cvar_tvk_picmip
 
cvar_tvk_skymip
 
cvar_tvk_round_down
 
cvar_tvk_flashblend
 
cvar_tvk_finish
 
cvar_tvk_clear
 
cvar_tvk_lockpvs
 
cvar_tvk_polyblend
 
cvar_tvk_modulate
 
cvar_tvk_shadows
 
cvar_tvk_particle_size
 
cvar_tvk_particle_att_a
 
cvar_tvk_particle_att_b
 
cvar_tvk_particle_att_c
 
cvar_tvk_particle_min_size
 
cvar_tvk_particle_max_size
 
cvar_tvk_point_particles
 
cvar_tvk_dynamic
 
cvar_tvk_showtris
 
cvar_tvk_lightmap
 
cvar_tvk_texturemode
 
cvar_tvk_lmaptexturemode
 
cvar_tvk_aniso
 
cvar_tvk_sampleshading
 
cvar_tvk_vsync
 
cvar_tvk_device_idx
 
cvar_tvid_fullscreen
 
cvar_tvid_gamma
 
cvar_tintensity
 
int c_visible_lightmaps
 
int c_visible_textures
 
float r_viewproj_matrix [16]
 
model_tr_worldmodel
 
unsigned d_8to24table [256]
 
int registration_sequence
 
qvksampler_t vk_current_sampler
 
qvksampler_t vk_current_lmap_sampler
 
vkconfig_t vk_config
 
vkstate_t vk_state
 
refimport_t ri
 

Macro Definition Documentation

◆ BACKFACE_EPSILON

#define BACKFACE_EPSILON   0.01

Definition at line 140 of file vk_local.h.

◆ DYNLIGHTMAP_OFFSET

#define DYNLIGHTMAP_OFFSET   MAX_LIGHTMAPS

Definition at line 328 of file vk_local.h.

◆ max

#define max (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition at line 75 of file vk_local.h.

◆ MAX_LBM_HEIGHT

#define MAX_LBM_HEIGHT   480

Definition at line 138 of file vk_local.h.

◆ MAX_LIGHTMAPS

#define MAX_LIGHTMAPS   128

Definition at line 327 of file vk_local.h.

◆ MAX_VKTEXTURES

#define MAX_VKTEXTURES   1024

Definition at line 122 of file vk_local.h.

◆ min

#define min (   a,
 
)    (((a) < (b)) ? (a) : (b))

Definition at line 72 of file vk_local.h.

◆ PITCH

#define PITCH   0

Definition at line 63 of file vk_local.h.

◆ REF_VERSION

#define REF_VERSION   "Vulkan (vkQuake2 v"VKQUAKE2_VERSION")"

Definition at line 46 of file vk_local.h.

◆ ROLL

#define ROLL   2

Definition at line 69 of file vk_local.h.

◆ VK_USE_PLATFORM_WIN32_KHR

#define VK_USE_PLATFORM_WIN32_KHR

Definition at line 26 of file vk_local.h.

◆ VK_VERIFY

#define VK_VERIFY (   x)    (void)(x)

Definition at line 59 of file vk_local.h.

◆ VKQUAKE2_VERSION

#define VKQUAKE2_VERSION   "1.4.3"

Definition at line 47 of file vk_local.h.

◆ YAW

#define YAW   1

Definition at line 66 of file vk_local.h.

Typedef Documentation

◆ image_t

typedef struct image_s image_t

Enumeration Type Documentation

◆ imagetype_t

Enumerator
it_skin 
it_sprite 
it_wall 
it_pic 
it_sky 
it_skin 
it_sprite 
it_wall 
it_pic 
it_sky 
it_skin 
it_sprite 
it_wall 
it_pic 
it_sky 

Definition at line 99 of file vk_local.h.

100 {
101  it_skin,
102  it_sprite,
103  it_wall,
104  it_pic,
105  it_sky
106 } imagetype_t;

◆ rserr_t

enum rserr_t
Enumerator
rserr_ok 
rserr_invalid_fullscreen 
rserr_invalid_mode 
rserr_unknown 
rserr_ok 
rserr_invalid_fullscreen 
rserr_invalid_mode 
rserr_unknown 
rserr_ok 
rserr_invalid_fullscreen 
rserr_invalid_mode 
rserr_unknown 

Definition at line 126 of file vk_local.h.

127 {
128  rserr_ok,
129 
132 
134 } rserr_t;

Function Documentation

◆ COM_StripExtension()

void COM_StripExtension ( char *  in,
char *  out 
)

Definition at line 826 of file q_shared.c.

827 {
828  while (*in && *in != '.')
829  *out++ = *in++;
830  *out = 0;
831 }

Referenced by CL_CheckOrDownloadFile(), and CL_Download_f().

◆ Draw_Char()

void Draw_Char ( int  x,
int  y,
int  c 
)

Definition at line 242 of file r_draw.c.

243 {
244  byte *dest;
245  byte *source;
246  byte *src;
247  int drawline;
248  int row, col, f, i, v, skip = 0;
249  int fstep, tbyte, sv;
250 
251  num &= 255;
252 
253  if (num == 32 || num == 32 + 128)
254  return;
255 
256  if (y <= -8)
257  return; // totally off screen
258 
259  // if ( ( y + 8 ) >= vid.height )
260  if ((y + 8) > vid.height) // PGM - status text was missing in sw...
261  return;
262 
263  cvar_t *scale = ri.Cvar_Get("hudscale", "1", 0);
264 
265 #ifdef PARANOID
266  if (y > vid.height - 8 || x < 0 || x > vid.width - 8)
267  ri.Sys_Error(ERR_FATAL, "Con_DrawCharacter: (%i, %i)", x, y);
268  if (num < 0 || num > 255)
269  ri.Sys_Error(ERR_FATAL, "Con_DrawCharacter: char %i", num);
270 #endif
271 
272  row = num >> 4;
273  col = num & 15;
274  source = draw_chars->pixels[0] + (row << 10) + (col << 3);
275 
276  if (y < 0)
277  { // clipped
278  skip = y;
279  drawline = 8 * scale->value + y;
280  source -= 128 * y;
281  y = 0;
282  }
283  else
284  drawline = 8 * scale->value;
285 
286  dest = vid.buffer + y*vid.rowbytes + x;
287  fstep = 0x8000 / scale->value;
288 
289  for (v = 0; v < drawline; v++, dest += vid.rowbytes)
290  {
291  sv = (skip + v) / scale->value;
292  src = source + sv * draw_chars->width;
293  f = 0;
294 
295  for (i = 0; i < 8 * scale->value; i += 4)
296  {
297  if ((tbyte = src[f >> 15]) != TRANSPARENT_COLOR)
298  dest[i] = tbyte;
299  f += fstep;
300 
301  if ((tbyte = src[f >> 15]) != TRANSPARENT_COLOR)
302  dest[i + 1] = tbyte;
303  f += fstep;
304 
305  if ((tbyte = src[f >> 15]) != TRANSPARENT_COLOR)
306  dest[i + 2] = tbyte;
307  f += fstep;
308 
309  if ((tbyte = src[f >> 15]) != TRANSPARENT_COLOR)
310  dest[i + 3] = tbyte;
311  f += fstep;
312  }
313  }
314 }

◆ Draw_FadeScreen()

void Draw_FadeScreen ( void  )

Definition at line 620 of file r_draw.c.

621 {
622  int x, y;
623  byte *pbuf;
624  int t;
625 
626  for (y = 0; y < vid.height; y++)
627  {
628  pbuf = (byte *)(vid.buffer + vid.rowbytes*y);
629  t = (y & 1) << 1;
630 
631  for (x = 0; x < vid.width; x++)
632  {
633  if ((x & 3) != t)
634  pbuf[x] = 0;
635  }
636  }
637 }

◆ Draw_Fill()

void Draw_Fill ( int  x,
int  y,
int  w,
int  h,
int  c 
)

Definition at line 586 of file r_draw.c.

587 {
588  byte *dest;
589  int u, v;
590 
591  if (x + w > vid.width)
592  w = vid.width - x;
593  if (y + h > vid.height)
594  h = vid.height - y;
595  if (x < 0)
596  {
597  w += x;
598  x = 0;
599  }
600  if (y < 0)
601  {
602  h += y;
603  y = 0;
604  }
605  if (w < 0 || h < 0)
606  return;
607  dest = vid.buffer + y*vid.rowbytes + x;
608  for (v = 0; v < h; v++, dest += vid.rowbytes)
609  for (u = 0; u < w; u++)
610  dest[u] = c;
611 }

◆ Draw_GetPalette()

int Draw_GetPalette ( void  )

Definition at line 1423 of file r_main.c.

1424 {
1425  byte *out;
1426  int i;
1427  int r, g, b;
1428 
1429  // get the palette and colormap
1430  LoadPCX("pics/colormap.pcx", &vid.colormap, &thepalette, NULL, NULL);
1431  if (!vid.colormap)
1432  ri.Sys_Error(ERR_FATAL, "Couldn't load pics/colormap.pcx");
1433  vid.alphamap = vid.colormap + 64 * 256;
1434  out = (byte *)d_8to24table;
1435  for (i=0 ; i<256 ; i++, out+=4)
1436  {
1437  r = thepalette[i*3+0];
1438  g = thepalette[i*3+1];
1439  b = thepalette[i*3+2];
1440 
1441  out[0] = r;
1442  out[1] = g;
1443  out[2] = b;
1444  }
1445 }

Referenced by GL_InitImages(), R_Init(), and Vk_InitImages().

◆ Draw_GetPicSize()

void Draw_GetPicSize ( int w,
int h,
char *  name 
)

Definition at line 321 of file r_draw.c.

322 {
323  image_t *gl;
324 
325  gl = Draw_FindPic(pic);
326  if (!gl)
327  {
328  *w = *h = -1;
329  return;
330  }
331  cvar_t *scale = ri.Cvar_Get("hudscale", "1", 0);
332 
333  *w = gl->width*scale->value;
334  *h = gl->height*scale->value;
335 }

Referenced by GetRefAPI().

◆ Draw_InitLocal()

void Draw_InitLocal ( void  )

Definition at line 222 of file r_draw.c.

223 {
224  draw_chars = Draw_FindPic("conchars");
225  // Knightmare- error out instead of crashing if we can't load this
226  if (!draw_chars)
227  ri.Sys_Error(ERR_FATAL, "Couldn't load pics/conchars.pcx");
228  // end Knightmare
229 }

Referenced by R_Init().

◆ Draw_Pic()

void Draw_Pic ( int  x,
int  y,
char *  name 
)

Definition at line 438 of file r_draw.c.

439 {
440  image_t *pic;
441  byte *dest, *source;
442  int v, u;
443  int tbyte;
444  int height;
445 
446  pic = Draw_FindPic(name);
447  if (!pic)
448  {
449  ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", name);
450  return;
451  }
452 
453  cvar_t *scale = ri.Cvar_Get("hudscale", "1", 0);
454  if (scale->value > 1.f)
455  {
456  Draw_StretchPicImplementation(x, y, pic->width*scale->value, pic->height*scale->value, pic);
457  return;
458  }
459 
460  if ((x < 0) ||
461  (x + pic->width > vid.width) ||
462  (y + pic->height > vid.height))
463  return; // ri.Sys_Error (ERR_FATAL,"Draw_Pic: bad coordinates");
464 
465  height = pic->height;
466  source = pic->pixels[0];
467  if (y < 0)
468  {
469  height += y;
470  source += pic->width*-y;
471  y = 0;
472  }
473 
474  dest = vid.buffer + y * vid.rowbytes + x;
475 
476  if (!pic->transparent)
477  {
478  for (v = 0; v < height; v++)
479  {
480  memcpy(dest, source, pic->width);
481  dest += vid.rowbytes;
482  source += pic->width;
483  }
484  }
485  else
486  {
487  if (pic->width & 7)
488  { // general
489  for (v = 0; v < height; v++)
490  {
491  for (u = 0; u < pic->width; u++)
492  if ((tbyte = source[u]) != TRANSPARENT_COLOR)
493  dest[u] = tbyte;
494 
495  dest += vid.rowbytes;
496  source += pic->width;
497  }
498  }
499  else
500  { // unwound
501  for (v = 0; v < height; v++)
502  {
503  for (u = 0; u < pic->width; u += 8)
504  {
505  if ((tbyte = source[u]) != TRANSPARENT_COLOR)
506  dest[u] = tbyte;
507  if ((tbyte = source[u + 1]) != TRANSPARENT_COLOR)
508  dest[u + 1] = tbyte;
509  if ((tbyte = source[u + 2]) != TRANSPARENT_COLOR)
510  dest[u + 2] = tbyte;
511  if ((tbyte = source[u + 3]) != TRANSPARENT_COLOR)
512  dest[u + 3] = tbyte;
513  if ((tbyte = source[u + 4]) != TRANSPARENT_COLOR)
514  dest[u + 4] = tbyte;
515  if ((tbyte = source[u + 5]) != TRANSPARENT_COLOR)
516  dest[u + 5] = tbyte;
517  if ((tbyte = source[u + 6]) != TRANSPARENT_COLOR)
518  dest[u + 6] = tbyte;
519  if ((tbyte = source[u + 7]) != TRANSPARENT_COLOR)
520  dest[u + 7] = tbyte;
521  }
522  dest += vid.rowbytes;
523  source += pic->width;
524  }
525  }
526  }
527 }

◆ Draw_StretchPic()

void Draw_StretchPic ( int  x,
int  y,
int  w,
int  h,
char *  name 
)

Definition at line 405 of file r_draw.c.

406 {
407  image_t *pic;
408 
409  pic = Draw_FindPic(name);
410  if (!pic)
411  {
412  ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", name);
413  return;
414  }
415  Draw_StretchPicImplementation(x, y, w, h, pic);
416 }

Referenced by Draw_Pic(), and GetRefAPI().

◆ Draw_StretchRaw()

void Draw_StretchRaw ( int  x,
int  y,
int  w,
int  h,
int  cols,
int  rows,
byte data 
)

Definition at line 423 of file r_draw.c.

424 {
425  image_t pic;
426 
427  pic.pixels[0] = data;
428  pic.width = cols;
429  pic.height = rows;
430  Draw_StretchPicImplementation(x, y, w, h, &pic);
431 }

Referenced by GetRefAPI().

◆ Draw_TileClear()

void Draw_TileClear ( int  x,
int  y,
int  w,
int  h,
char *  name 
)

Definition at line 537 of file r_draw.c.

538 {
539  int i, j;
540  byte *psrc;
541  byte *pdest;
542  image_t *pic;
543  int x2;
544 
545  if (x < 0)
546  {
547  w += x;
548  x = 0;
549  }
550  if (y < 0)
551  {
552  h += y;
553  y = 0;
554  }
555  if (x + w > vid.width)
556  w = vid.width - x;
557  if (y + h > vid.height)
558  h = vid.height - y;
559  if (w <= 0 || h <= 0)
560  return;
561 
562  pic = Draw_FindPic(name);
563  if (!pic)
564  {
565  ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", name);
566  return;
567  }
568  x2 = x + w;
570  for (i = 0; i < h; i++, pdest += vid.rowbytes)
571  {
572  psrc = pic->pixels[0] + pic->width * ((i + y) & 63);
573  for (j = x; j < x2; j++)
574  pdest[j] = psrc[j & 63];
575  }
576 }

◆ EmitWaterPolys()

void EmitWaterPolys ( msurface_t fa,
image_t texture,
float *  modelMatrix,
float *  color 
)

Definition at line 202 of file vk_warp.c.

203 {
204  vkpoly_t *p, *bp;
205  float *v;
206  int i;
207 
208  typedef struct {
209  float vertex[3];
210  float texCoord[2];
211  } polyvert;
212 
213  struct {
214  float model[16];
215  float color[4];
216  float time;
217  float scroll;
218  } polyUbo;
219 
220  polyUbo.color[0] = color[0];
221  polyUbo.color[1] = color[1];
222  polyUbo.color[2] = color[2];
223  polyUbo.color[3] = color[3];
224  polyUbo.time = r_newrefdef.time;
225 
226  static polyvert verts[MAX_VERTS];
227 
228  if (fa->texinfo->flags & SURF_FLOWING)
229  polyUbo.scroll = (-64 * ((r_newrefdef.time*0.5) - (int)(r_newrefdef.time*0.5))) / 64.f;
230  else
231  polyUbo.scroll = 0;
232 
233  if (modelMatrix)
234  {
235  memcpy(polyUbo.model, modelMatrix, sizeof(float) * 16);
236  }
237  else
238  {
239  Mat_Identity(polyUbo.model);
240  }
241 
243 
244  uint32_t uboOffset;
245  VkDescriptorSet uboDescriptorSet;
246  uint8_t *uboData = QVk_GetUniformBuffer(sizeof(polyUbo), &uboOffset, &uboDescriptorSet);
247  memcpy(uboData, &polyUbo, sizeof(polyUbo));
248 
249  VkBuffer vbo;
250  VkDeviceSize vboOffset;
251  VkDescriptorSet descriptorSets[] = { texture->vk_texture.descriptorSet, uboDescriptorSet };
252  vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawPolyWarpPipeline.layout, 0, 2, descriptorSets, 1, &uboOffset);
253 
254  for (bp = fa->polys; bp; bp = bp->next)
255  {
256  p = bp;
257 
258  for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE)
259  {
260  verts[i].vertex[0] = v[0];
261  verts[i].vertex[1] = v[1];
262  verts[i].vertex[2] = v[2];
263  verts[i].texCoord[0] = v[3] / 64.f;
264  verts[i].texCoord[1] = v[4] / 64.f;
265  }
266 
267  uint8_t *vertData = QVk_GetVertexBuffer(sizeof(polyvert) * p->numverts, &vbo, &vboOffset);
268  memcpy(vertData, verts, sizeof(polyvert) * p->numverts);
269 
270  vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1, &vbo, &vboOffset);
271  vkCmdBindIndexBuffer(vk_activeCmdbuffer, QVk_GetTriangleFanIbo((p->numverts - 2) * 3), 0, VK_INDEX_TYPE_UINT16);
272  vkCmdDrawIndexed(vk_activeCmdbuffer, (p->numverts - 2) * 3, 1, 0, 0, 0);
273  }
274 }

◆ LoadPCX()

void LoadPCX ( char *  filename,
byte **  pic,
byte **  palette,
int width,
int height 
)

Definition at line 87 of file r_image.c.

88 {
89  byte *raw;
90  pcx_t *pcx;
91  int x, y;
92  int len;
93  int dataByte, runLength;
94  byte *out, *pix;
95 
96  *pic = NULL;
97 
98  //
99  // load the file
100  //
101  len = ri.FS_LoadFile (filename, (void **)&raw);
102  if (!raw)
103  {
104  ri.Con_Printf (PRINT_DEVELOPER, "Bad pcx file %s\n", filename);
105  return;
106  }
107 
108  //
109  // parse the PCX file
110  //
111  pcx = (pcx_t *)raw;
112 
113  pcx->xmin = LittleShort(pcx->xmin);
114  pcx->ymin = LittleShort(pcx->ymin);
115  pcx->xmax = LittleShort(pcx->xmax);
116  pcx->ymax = LittleShort(pcx->ymax);
117  pcx->hres = LittleShort(pcx->hres);
118  pcx->vres = LittleShort(pcx->vres);
121 
122  raw = &pcx->data;
123 
124  if (pcx->manufacturer != 0x0a
125  || pcx->version != 5
126  || pcx->encoding != 1
127  || pcx->bits_per_pixel != 8
128  || pcx->xmax >= 640
129  || pcx->ymax >= 480)
130  {
131  ri.Con_Printf (PRINT_ALL, "Bad pcx file %s\n", filename);
132  return;
133  }
134 
135  out = malloc ( (pcx->ymax+1) * (pcx->xmax+1) );
136 
137  *pic = out;
138 
139  pix = out;
140 
141  if (palette)
142  {
143  *palette = malloc(768);
144  memcpy (*palette, (byte *)pcx + len - 768, 768);
145  }
146 
147  if (width)
148  *width = pcx->xmax+1;
149  if (height)
150  *height = pcx->ymax+1;
151 
152  for (y=0 ; y<=pcx->ymax ; y++, pix += pcx->xmax+1)
153  {
154  for (x=0 ; x<=pcx->xmax ; )
155  {
156  dataByte = *raw++;
157 
158  if((dataByte & 0xC0) == 0xC0)
159  {
160  runLength = dataByte & 0x3F;
161  dataByte = *raw++;
162  }
163  else
164  runLength = 1;
165 
166  while(runLength-- > 0)
167  pix[x++] = dataByte;
168  }
169 
170  }
171 
172  if ( raw - (byte *)pcx > len)
173  {
174  ri.Con_Printf (PRINT_DEVELOPER, "PCX file %s was malformed", filename);
175  free (*pic);
176  *pic = NULL;
177  }
178 
179  ri.FS_FreeFile (pcx);
180 }

Referenced by Draw_GetPalette(), GL_FindImage(), R_FindImage(), and Vk_FindImage().

◆ Mat_Identity()

void Mat_Identity ( float *  matrix)

Definition at line 675 of file vk_rmain.c.

676 {
677  matrix[0] = 1.f;
678  matrix[1] = 0.f;
679  matrix[2] = 0.f;
680  matrix[3] = 0.f;
681  matrix[4] = 0.f;
682  matrix[5] = 1.f;
683  matrix[6] = 0.f;
684  matrix[7] = 0.f;
685  matrix[8] = 0.f;
686  matrix[9] = 0.f;
687  matrix[10] = 1.f;
688  matrix[11] = 0.f;
689  matrix[12] = 0.f;
690  matrix[13] = 0.f;
691  matrix[14] = 0.f;
692  matrix[15] = 1.f;
693 }

Referenced by EmitWaterPolys(), R_DrawAliasModel(), R_DrawBrushModel(), R_DrawNullModel(), R_DrawSkyBox(), R_SetupVulkan(), and Vk_RenderLightmappedPoly().

◆ Mat_Mul()

void Mat_Mul ( float *  m1,
float *  m2,
float *  res 
)

Definition at line 695 of file vk_rmain.c.

696 {
697  float mul[16] = { m1[0] * m2[0] + m1[1] * m2[4] + m1[2] * m2[8] + m1[3] * m2[12],
698  m1[0] * m2[1] + m1[1] * m2[5] + m1[2] * m2[9] + m1[3] * m2[13],
699  m1[0] * m2[2] + m1[1] * m2[6] + m1[2] * m2[10] + m1[3] * m2[14],
700  m1[0] * m2[3] + m1[1] * m2[7] + m1[2] * m2[11] + m1[3] * m2[15],
701  m1[4] * m2[0] + m1[5] * m2[4] + m1[6] * m2[8] + m1[7] * m2[12],
702  m1[4] * m2[1] + m1[5] * m2[5] + m1[6] * m2[9] + m1[7] * m2[13],
703  m1[4] * m2[2] + m1[5] * m2[6] + m1[6] * m2[10] + m1[7] * m2[14],
704  m1[4] * m2[3] + m1[5] * m2[7] + m1[6] * m2[11] + m1[7] * m2[15],
705  m1[8] * m2[0] + m1[9] * m2[4] + m1[10] * m2[8] + m1[11] * m2[12],
706  m1[8] * m2[1] + m1[9] * m2[5] + m1[10] * m2[9] + m1[11] * m2[13],
707  m1[8] * m2[2] + m1[9] * m2[6] + m1[10] * m2[10] + m1[11] * m2[14],
708  m1[8] * m2[3] + m1[9] * m2[7] + m1[10] * m2[11] + m1[11] * m2[15],
709  m1[12] * m2[0] + m1[13] * m2[4] + m1[14] * m2[8] + m1[15] * m2[12],
710  m1[12] * m2[1] + m1[13] * m2[5] + m1[14] * m2[9] + m1[15] * m2[13],
711  m1[12] * m2[2] + m1[13] * m2[6] + m1[14] * m2[10] + m1[15] * m2[14],
712  m1[12] * m2[3] + m1[13] * m2[7] + m1[14] * m2[11] + m1[15] * m2[15]
713  };
714 
715  memcpy(res, mul, sizeof(float) * 16);
716 }

Referenced by Mat_Ortho(), Mat_Perspective(), Mat_Rotate(), Mat_Scale(), Mat_Translate(), R_DrawAliasModel(), and R_SetupVulkan().

◆ Mat_Ortho()

void Mat_Ortho ( float *  matrix,
float  left,
float  right,
float  bottom,
float  top,
float  zNear,
float  zFar 
)

Definition at line 784 of file vk_rmain.c.

786 {
787  float proj[16];
788  memset(proj, 0, sizeof(float) * 16);
789  proj[0] = 2.f / (right - left);
790  proj[3] = (right + left) / (right - left);
791  proj[5] = 2.f / (top - bottom);
792  proj[7] = (top + bottom) / (top - bottom);
793  proj[10] = -2.f / (zFar - zNear);
794  proj[11] = -(zFar + zNear) / (zFar - zNear);
795  proj[15] = 1.f;
796 
797  // Convert projection matrix to Vulkan coordinate system (https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/)
798  Mat_Mul(proj, r_vulkan_correction, matrix);
799 }

◆ Mat_Perspective()

void Mat_Perspective ( float *  matrix,
float *  correction_matrix,
float  fovy,
float  aspect,
float  zNear,
float  zFar 
)

Definition at line 756 of file vk_rmain.c.

758 {
759  float xmin, xmax, ymin, ymax;
760 
761  ymax = zNear * tan(fovy * M_PI / 360.0);
762  ymin = -ymax;
763 
764  xmin = ymin * aspect;
765  xmax = ymax * aspect;
766 
767  xmin += -(2 * vk_state.camera_separation) / zNear;
768  xmax += -(2 * vk_state.camera_separation) / zNear;
769 
770  float proj[16];
771  memset(proj, 0, sizeof(float) * 16);
772  proj[0] = 2.f * zNear / (xmax - xmin);
773  proj[2] = (xmax + xmin) / (xmax - xmin);
774  proj[5] = 2.f * zNear / (ymax - ymin);
775  proj[6] = (ymax + ymin) / (ymax - ymin);
776  proj[10] = -(zFar + zNear) / (zFar - zNear);
777  proj[11] = -1.f;
778  proj[14] = -2.f * zFar * zNear / (zFar - zNear);
779 
780  // Convert projection matrix to Vulkan coordinate system (https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/)
781  Mat_Mul(proj, correction_matrix, matrix);
782 }

Referenced by R_DrawAliasModel(), and R_SetupVulkan().

◆ Mat_Rotate()

void Mat_Rotate ( float *  matrix,
float  deg,
float  x,
float  y,
float  z 
)

Definition at line 728 of file vk_rmain.c.

729 {
730  double c = cos(deg * M_PI / 180.0);
731  double s = sin(deg * M_PI / 180.0);
732  double cd = 1.0 - c;
733  vec3_t r = { x, y, z };
735 
736  float rot[16] = { r[0]*r[0]*cd + c, r[1]*r[0]*cd + r[2]*s, r[0]*r[2]*cd - r[1]*s, 0.f,
737  r[0]*r[1]*cd - r[2]*s, r[1]*r[1]*cd + c, r[1]*r[2]*cd + r[0]*s, 0.f,
738  r[0]*r[2]*cd + r[1]*s, r[1]*r[2]*cd - r[0]*s, r[2]*r[2]*cd + c, 0.f,
739  0.f, 0.f, 0.f, 1.f
740  };
741 
742  Mat_Mul(matrix, rot, matrix);
743 }

Referenced by R_DrawSkyBox(), R_RotateForEntity(), and R_SetupVulkan().

◆ Mat_Scale()

void Mat_Scale ( float *  matrix,
float  x,
float  y,
float  z 
)

Definition at line 745 of file vk_rmain.c.

746 {
747  float s[16] = { x, 0.f, 0.f, 0.f,
748  0.f, y, 0.f, 0.f,
749  0.f, 0.f, z, 0.f,
750  0.f, 0.f, 0.f, 1.f
751  };
752 
753  Mat_Mul(matrix, s, matrix);
754 }

Referenced by R_DrawAliasModel().

◆ Mat_Translate()

void Mat_Translate ( float *  matrix,
float  x,
float  y,
float  z 
)

Definition at line 718 of file vk_rmain.c.

719 {
720  float t[16] = { 1.f, 0.f, 0.f, 0.f,
721  0.f, 1.f, 0.f, 0.f,
722  0.f, 0.f, 1.f, 0.f,
723  x, y, z, 1.f };
724 
725  Mat_Mul(matrix, t, matrix);
726 }

Referenced by R_DrawSkyBox(), R_RotateForEntity(), and R_SetupVulkan().

◆ R_AddSkySurface()

void R_AddSkySurface ( msurface_t fa)

Definition at line 485 of file gl_warp.c.

486 {
487  int i;
488  vec3_t verts[MAX_CLIP_VERTS];
489  glpoly_t *p;
490 
491  // calculate vertex values for sky box
492  for (p=fa->polys ; p ; p=p->next)
493  {
494  for (i=0 ; i<p->numverts ; i++)
495  {
496  VectorSubtract (p->verts[i], r_origin, verts[i]);
497  }
498  ClipSkyPolygon (p->numverts, verts[0], 0);
499  }
500 }

◆ R_BeginFrame()

void R_BeginFrame ( float  camera_separation)

Definition at line 1177 of file r_main.c.

1178 {
1179  extern void Draw_BuildGammaTable(void);
1180 #ifdef REDBLUE
1181  SetStereoBuffer((camera_separation <= 0.0) ? 0 : 1);
1182 #endif
1183  /*
1184  ** rebuild the gamma correction palette if necessary
1185  */
1186  if (vid_gamma->modified)
1187  {
1189  R_GammaCorrectAndSetPalette((const unsigned char *)d_8to24table);
1190 
1191  vid_gamma->modified = false;
1192  }
1193 
1195  {
1196  rserr_t err;
1197 
1198  /* a bit hackish approach to enable custom resolutions:
1199  * SWimp_SetMode needs these values set for mode -1 */
1202 
1203  /*
1204  ** if this returns rserr_invalid_fullscreen then it set the mode but not as a
1205  ** fullscreen mode, e.g. 320x200 on a system that doesn't support that res
1206  */
1208  {
1210 
1211  if (sw_mode->value == -1)
1212  {
1213  sw_state.prev_mode = 4; /* safe default for custom mode */
1214  }
1215  else
1216  {
1218  }
1219 
1220  vid_fullscreen->modified = false;
1221  sw_mode->modified = false;
1222  }
1223  else
1224  {
1225  if (err == rserr_invalid_mode)
1226  {
1227  ri.Cvar_SetValue("sw_mode", sw_state.prev_mode);
1228  ri.Con_Printf(PRINT_ALL, "ref_soft::R_BeginFrame() - could not set mode\n");
1229  }
1230  else if (err == rserr_invalid_fullscreen)
1231  {
1233  ri.Con_Printf(PRINT_ALL, "ref_soft::R_BeginFrame() - fullscreen unavailable in this mode\n");
1235  // vid_fullscreen->modified = false;
1236  // sw_mode->modified = false;
1237  }
1238  else
1239  {
1240  ri.Sys_Error(ERR_FATAL, "ref_soft::R_BeginFrame() - catastrophic mode change failure\n");
1241  }
1242  }
1243  }
1244 }

Referenced by GetRefAPI(), and R_Init().

◆ R_ClearSkyBox()

void R_ClearSkyBox ( void  )

Definition at line 508 of file gl_warp.c.

509 {
510  int i;
511 
512  for (i=0 ; i<6 ; i++)
513  {
514  skymins[0][i] = skymins[1][i] = 9999;
515  skymaxs[0][i] = skymaxs[1][i] = -9999;
516  }
517 }

◆ R_CullBox()

qboolean R_CullBox ( vec3_t  mins,
vec3_t  maxs 
)

Definition at line 151 of file gl_rmain.c.

152 {
153  int i;
154 
155  if (r_nocull->value)
156  return false;
157 
158  for (i=0 ; i<4 ; i++)
159  if ( BOX_ON_PLANE_SIDE(mins, maxs, &frustum[i]) == 2)
160  return true;
161  return false;
162 }

◆ R_DrawAliasModel()

void R_DrawAliasModel ( entity_t e)

Definition at line 519 of file gl_mesh.c.

520 {
521  int i;
522  dmdl_t *paliashdr;
523  float an;
524  vec3_t bbox[8];
525  image_t *skin;
526 
527  if ( !( e->flags & RF_WEAPONMODEL ) )
528  {
529  if ( R_CullAliasModel( bbox, e ) )
530  return;
531  }
532 
533  if ( e->flags & RF_WEAPONMODEL )
534  {
535  if ( r_lefthand->value == 2 )
536  return;
537  }
538 
539  paliashdr = (dmdl_t *)currentmodel->extradata;
540 
541  //
542  // get lighting information
543  //
544  // PMM - rewrote, reordered to handle new shells & mixing
545  // PMM - 3.20 code .. replaced with original way of doing it to keep mod authors happy
546  //
548  {
551  {
552  shadelight[0] = 0.56;
553  shadelight[1] = 0.59;
554  shadelight[2] = 0.45;
555  }
557  {
558  shadelight[0] = 0.9;
559  shadelight[1] = 0.7;
560  }
562  shadelight[0] = 1.0;
564  shadelight[1] = 1.0;
566  shadelight[2] = 1.0;
567  }
568 /*
569  // PMM -special case for godmode
570  if ( (currententity->flags & RF_SHELL_RED) &&
571  (currententity->flags & RF_SHELL_BLUE) &&
572  (currententity->flags & RF_SHELL_GREEN) )
573  {
574  for (i=0 ; i<3 ; i++)
575  shadelight[i] = 1.0;
576  }
577  else if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_BLUE | RF_SHELL_DOUBLE ) )
578  {
579  VectorClear (shadelight);
580 
581  if ( currententity->flags & RF_SHELL_RED )
582  {
583  shadelight[0] = 1.0;
584  if (currententity->flags & (RF_SHELL_BLUE|RF_SHELL_DOUBLE) )
585  shadelight[2] = 1.0;
586  }
587  else if ( currententity->flags & RF_SHELL_BLUE )
588  {
589  if ( currententity->flags & RF_SHELL_DOUBLE )
590  {
591  shadelight[1] = 1.0;
592  shadelight[2] = 1.0;
593  }
594  else
595  {
596  shadelight[2] = 1.0;
597  }
598  }
599  else if ( currententity->flags & RF_SHELL_DOUBLE )
600  {
601  shadelight[0] = 0.9;
602  shadelight[1] = 0.7;
603  }
604  }
605  else if ( currententity->flags & ( RF_SHELL_HALF_DAM | RF_SHELL_GREEN ) )
606  {
607  VectorClear (shadelight);
608  // PMM - new colors
609  if ( currententity->flags & RF_SHELL_HALF_DAM )
610  {
611  shadelight[0] = 0.56;
612  shadelight[1] = 0.59;
613  shadelight[2] = 0.45;
614  }
615  if ( currententity->flags & RF_SHELL_GREEN )
616  {
617  shadelight[1] = 1.0;
618  }
619  }
620  }
621  //PMM - ok, now flatten these down to range from 0 to 1.0.
622  // max_shell_val = max(shadelight[0], max(shadelight[1], shadelight[2]));
623  // if (max_shell_val > 0)
624  // {
625  // for (i=0; i<3; i++)
626  // {
627  // shadelight[i] = shadelight[i] / max_shell_val;
628  // }
629  // }
630  // pmm
631 */
632  else if ( currententity->flags & RF_FULLBRIGHT )
633  {
634  for (i=0 ; i<3 ; i++)
635  shadelight[i] = 1.0;
636  }
637  else
638  {
640 
641  // player lighting hack for communication back to server
642  // big hack!
644  {
645  // pick the greatest component, which should be the same
646  // as the mono value returned by software
647  if (shadelight[0] > shadelight[1])
648  {
649  if (shadelight[0] > shadelight[2])
650  r_lightlevel->value = 150*shadelight[0];
651  else
652  r_lightlevel->value = 150*shadelight[2];
653  }
654  else
655  {
656  if (shadelight[1] > shadelight[2])
657  r_lightlevel->value = 150*shadelight[1];
658  else
659  r_lightlevel->value = 150*shadelight[2];
660  }
661 
662  }
663 
664  if ( gl_monolightmap->string[0] != '0' )
665  {
666  float s = shadelight[0];
667 
668  if ( s < shadelight[1] )
669  s = shadelight[1];
670  if ( s < shadelight[2] )
671  s = shadelight[2];
672 
673  shadelight[0] = s;
674  shadelight[1] = s;
675  shadelight[2] = s;
676  }
677  }
678 
680  {
681  for (i=0 ; i<3 ; i++)
682  if (shadelight[i] > 0.1)
683  break;
684  if (i == 3)
685  {
686  shadelight[0] = 0.1;
687  shadelight[1] = 0.1;
688  shadelight[2] = 0.1;
689  }
690  }
691 
692  if ( currententity->flags & RF_GLOW )
693  { // bonus items will pulse with time
694  float scale;
695  float min;
696 
697  scale = 0.1 * sin(r_newrefdef.time*7);
698  for (i=0 ; i<3 ; i++)
699  {
700  min = shadelight[i] * 0.8;
701  shadelight[i] += scale;
702  if (shadelight[i] < min)
703  shadelight[i] = min;
704  }
705  }
706 
707 // =================
708 // PGM ir goggles color override
710  {
711  shadelight[0] = 1.0;
712  shadelight[1] = 0.0;
713  shadelight[2] = 0.0;
714  }
715 // PGM
716 // =================
717 
719 
720  an = currententity->angles[1]/180*M_PI;
721  shadevector[0] = cos(-an);
722  shadevector[1] = sin(-an);
723  shadevector[2] = 1;
725 
726  //
727  // locate the proper data
728  //
729 
730  c_alias_polys += paliashdr->num_tris;
731 
732  //
733  // draw all the triangles
734  //
735  if (currententity->flags & RF_DEPTHHACK) // hack the depth range to prevent view model from poking into walls
736  qglDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
737 
738  if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
739  {
740  extern void MYgluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar );
741 
742  qglMatrixMode( GL_PROJECTION );
743  qglPushMatrix();
744  qglLoadIdentity();
745  qglScalef( -1, 1, 1 );
747  qglMatrixMode( GL_MODELVIEW );
748 
749  qglCullFace( GL_BACK );
750  }
751 
752  qglPushMatrix ();
753  e->angles[PITCH] = -e->angles[PITCH]; // sigh.
754  R_RotateForEntity (e);
755  e->angles[PITCH] = -e->angles[PITCH]; // sigh.
756 
757  // select skin
758  if (currententity->skin)
759  skin = currententity->skin; // custom player skin
760  else
761  {
763  skin = currentmodel->skins[0];
764  else
765  {
767  if (!skin)
768  skin = currentmodel->skins[0];
769  }
770  }
771  if (!skin)
772  skin = r_notexture; // fallback...
773  GL_Bind(skin->texnum);
774 
775  // draw it
776 
777  qglShadeModel (GL_SMOOTH);
778 
779  GL_TexEnv( GL_MODULATE );
781  {
782  qglEnable (GL_BLEND);
783  }
784 
785 
786  if ( (currententity->frame >= paliashdr->num_frames)
787  || (currententity->frame < 0) )
788  {
789  ri.Con_Printf (PRINT_ALL, "R_DrawAliasModel %s: no such frame %d\n",
791  currententity->frame = 0;
792  currententity->oldframe = 0;
793  }
794 
795  if ( (currententity->oldframe >= paliashdr->num_frames)
796  || (currententity->oldframe < 0))
797  {
798  ri.Con_Printf (PRINT_ALL, "R_DrawAliasModel %s: no such oldframe %d\n",
800  currententity->frame = 0;
801  currententity->oldframe = 0;
802  }
803 
804  if ( !r_lerpmodels->value )
805  currententity->backlerp = 0;
807 
808  GL_TexEnv( GL_REPLACE );
809  qglShadeModel (GL_FLAT);
810 
811  qglPopMatrix ();
812 
813 #if 0
814  qglDisable( GL_CULL_FACE );
815  qglPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
816  qglDisable( GL_TEXTURE_2D );
817  qglBegin( GL_TRIANGLE_STRIP );
818  for ( i = 0; i < 8; i++ )
819  {
820  qglVertex3fv( bbox[i] );
821  }
822  qglEnd();
823  qglEnable( GL_TEXTURE_2D );
824  qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
825  qglEnable( GL_CULL_FACE );
826 #endif
827 
828  if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
829  {
830  qglMatrixMode( GL_PROJECTION );
831  qglPopMatrix();
832  qglMatrixMode( GL_MODELVIEW );
833  qglCullFace( GL_FRONT );
834  }
835 
837  {
838  qglDisable (GL_BLEND);
839  }
840 
842  qglDepthRange (gldepthmin, gldepthmax);
843 
844 #if 1
846  {
847  qglPushMatrix ();
848  R_RotateForEntity (e);
849  qglDisable (GL_TEXTURE_2D);
850  qglEnable (GL_BLEND);
851  qglColor4f (0,0,0,0.5);
852  GL_DrawAliasShadow (paliashdr, currententity->frame );
853  qglEnable (GL_TEXTURE_2D);
854  qglDisable (GL_BLEND);
855  qglPopMatrix ();
856  }
857 #endif
858  qglColor4f (1,1,1,1);
859 }

◆ R_DrawAlphaSurfaces()

void R_DrawAlphaSurfaces ( void  )

Definition at line 1342 of file r_poly.c.

1343 {
1345 
1347 
1348  modelorg[0] = -r_origin[0];
1349  modelorg[1] = -r_origin[1];
1350  modelorg[2] = -r_origin[2];
1351 
1352  while (s)
1353  {
1355 
1356  //=======
1357  //PGM
1358  // if (s->texinfo->flags & SURF_TRANS66)
1359  // R_ClipAndDrawPoly( 0.60f, ( s->texinfo->flags & SURF_WARP) != 0, true );
1360  // else
1361  // R_ClipAndDrawPoly( 0.30f, ( s->texinfo->flags & SURF_WARP) != 0, true );
1362 
1363  // PGM - pass down all the texinfo flags, not just SURF_WARP.
1364  if (s->texinfo->flags & SURF_TRANS66)
1365  R_ClipAndDrawPoly(0.60f, (s->texinfo->flags & (SURF_WARP | SURF_FLOWING)), true);
1366  else
1367  R_ClipAndDrawPoly(0.30f, (s->texinfo->flags & (SURF_WARP | SURF_FLOWING)), true);
1368 
1369  //PGM
1370  //=======
1371 
1372  s = s->nextalphasurface;
1373  }
1374 
1376 }

◆ R_DrawBeam()

void R_DrawBeam ( entity_t e)

Definition at line 1342 of file r_main.c.

1343 {
1344 #define NUM_BEAM_SEGS 6
1345 
1346  int i;
1347 
1348  vec3_t perpvec;
1349  vec3_t direction, normalized_direction;
1350  vec3_t start_points[NUM_BEAM_SEGS], end_points[NUM_BEAM_SEGS];
1351  vec3_t oldorigin, origin;
1352 
1353  oldorigin[0] = e->oldorigin[0];
1354  oldorigin[1] = e->oldorigin[1];
1355  oldorigin[2] = e->oldorigin[2];
1356 
1357  origin[0] = e->origin[0];
1358  origin[1] = e->origin[1];
1359  origin[2] = e->origin[2];
1360 
1361  normalized_direction[0] = direction[0] = oldorigin[0] - origin[0];
1362  normalized_direction[1] = direction[1] = oldorigin[1] - origin[1];
1363  normalized_direction[2] = direction[2] = oldorigin[2] - origin[2];
1364 
1365  if (VectorNormalize(normalized_direction) == 0)
1366  return;
1367 
1368  PerpendicularVector(perpvec, normalized_direction);
1369  VectorScale(perpvec, e->frame / 2, perpvec);
1370 
1371  for (i = 0; i < NUM_BEAM_SEGS; i++)
1372  {
1373  RotatePointAroundVector(start_points[i], normalized_direction, perpvec, (360.0 / NUM_BEAM_SEGS)*i);
1374  VectorAdd(start_points[i], origin, start_points[i]);
1375  VectorAdd(start_points[i], direction, end_points[i]);
1376  }
1377 
1378  for (i = 0; i < NUM_BEAM_SEGS; i++)
1379  {
1380  R_IMFlatShadedQuad(start_points[i],
1381  end_points[i],
1382  end_points[(i + 1) % NUM_BEAM_SEGS],
1383  start_points[(i + 1) % NUM_BEAM_SEGS],
1384  e->skinnum & 0xFF,
1385  e->alpha);
1386  }
1387 }

Referenced by R_DrawEntitiesOnList().

◆ R_DrawBrushModel()

void R_DrawBrushModel ( entity_t e)

Definition at line 957 of file gl_rsurf.c.

958 {
959  vec3_t mins, maxs;
960  int i;
961  qboolean rotated;
962 
963  if (currentmodel->nummodelsurfaces == 0)
964  return;
965 
966  currententity = e;
968 
969  if (e->angles[0] || e->angles[1] || e->angles[2])
970  {
971  rotated = true;
972  for (i=0 ; i<3 ; i++)
973  {
974  mins[i] = e->origin[i] - currentmodel->radius;
975  maxs[i] = e->origin[i] + currentmodel->radius;
976  }
977  }
978  else
979  {
980  rotated = false;
981  VectorAdd (e->origin, currentmodel->mins, mins);
982  VectorAdd (e->origin, currentmodel->maxs, maxs);
983  }
984 
985  if (R_CullBox (mins, maxs))
986  return;
987 
988  qglColor3f (1,1,1);
989  memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
990 
992  if (rotated)
993  {
994  vec3_t temp;
996 
997  VectorCopy (modelorg, temp);
999  modelorg[0] = DotProduct (temp, forward);
1000  modelorg[1] = -DotProduct (temp, right);
1001  modelorg[2] = DotProduct (temp, up);
1002  }
1003 
1004  qglPushMatrix ();
1005 e->angles[0] = -e->angles[0]; // stupid quake bug
1006 e->angles[2] = -e->angles[2]; // stupid quake bug
1007  R_RotateForEntity (e);
1008 e->angles[0] = -e->angles[0]; // stupid quake bug
1009 e->angles[2] = -e->angles[2]; // stupid quake bug
1010 
1011  GL_EnableMultitexture( true );
1013  GL_TexEnv( GL_REPLACE );
1015  GL_TexEnv( GL_MODULATE );
1016 
1017  R_DrawInlineBModel ();
1018  GL_EnableMultitexture( false );
1019 
1020  qglPopMatrix ();
1021 }

◆ R_DrawSkyBox()

void R_DrawSkyBox ( void  )

Definition at line 562 of file gl_warp.c.

563 {
564  int i;
565 
566 #if 0
567 qglEnable (GL_BLEND);
568 GL_TexEnv( GL_MODULATE );
569 qglColor4f (1,1,1,0.5);
570 qglDisable (GL_DEPTH_TEST);
571 #endif
572  if (skyrotate)
573  { // check for no sky at all
574  for (i=0 ; i<6 ; i++)
575  if (skymins[0][i] < skymaxs[0][i]
576  && skymins[1][i] < skymaxs[1][i])
577  break;
578  if (i == 6)
579  return; // nothing visible
580  }
581 
582 qglPushMatrix ();
583 qglTranslatef (r_origin[0], r_origin[1], r_origin[2]);
584 qglRotatef (r_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
585 
586  for (i=0 ; i<6 ; i++)
587  {
588  if (skyrotate)
589  { // hack, forces full sky to draw when rotating
590  skymins[0][i] = -1;
591  skymins[1][i] = -1;
592  skymaxs[0][i] = 1;
593  skymaxs[1][i] = 1;
594  }
595 
596  if (skymins[0][i] >= skymaxs[0][i]
597  || skymins[1][i] >= skymaxs[1][i])
598  continue;
599 
600  GL_Bind (sky_images[skytexorder[i]]->texnum);
601 
602  qglBegin (GL_QUADS);
603  MakeSkyVec (skymins[0][i], skymins[1][i], i);
604  MakeSkyVec (skymins[0][i], skymaxs[1][i], i);
605  MakeSkyVec (skymaxs[0][i], skymaxs[1][i], i);
606  MakeSkyVec (skymaxs[0][i], skymins[1][i], i);
607  qglEnd ();
608  }
609 qglPopMatrix ();
610 #if 0
611 glDisable (GL_BLEND);
612 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
613 glColor4f (1,1,1,0.5);
614 glEnable (GL_DEPTH_TEST);
615 #endif
616 }

◆ R_DrawSpriteModel()

void R_DrawSpriteModel ( entity_t e)

Definition at line 189 of file gl_rmain.c.

190 {
191  float alpha = 1.0F;
192  vec3_t point;
193  dsprframe_t *frame;
194  float *up, *right;
195  dsprite_t *psprite;
196 
197  // don't even bother culling, because it's just a single
198  // polygon without a surface cache
199 
200  psprite = (dsprite_t *)currentmodel->extradata;
201 
202 #if 0
203  if (e->frame < 0 || e->frame >= psprite->numframes)
204  {
205  ri.Con_Printf (PRINT_ALL, "no such sprite frame %i\n", e->frame);
206  e->frame = 0;
207  }
208 #endif
209  e->frame %= psprite->numframes;
210 
211  frame = &psprite->frames[e->frame];
212 
213 #if 0
214  if (psprite->type == SPR_ORIENTED)
215  { // bullet marks on walls
216  vec3_t v_forward, v_right, v_up;
217 
218  AngleVectors (currententity->angles, v_forward, v_right, v_up);
219  up = v_up;
220  right = v_right;
221  }
222  else
223 #endif
224  { // normal sprite
225  up = vup;
226  right = vright;
227  }
228 
229  if ( e->flags & RF_TRANSLUCENT )
230  alpha = e->alpha;
231 
232  if ( alpha != 1.0F )
233  qglEnable( GL_BLEND );
234 
235  qglColor4f( 1, 1, 1, alpha );
236 
238 
239  GL_TexEnv( GL_MODULATE );
240 
241  if ( alpha == 1.0 )
242  qglEnable (GL_ALPHA_TEST);
243  else
244  qglDisable( GL_ALPHA_TEST );
245 
246  qglBegin (GL_QUADS);
247 
248  qglTexCoord2f (0, 1);
249  VectorMA (e->origin, -frame->origin_y, up, point);
250  VectorMA (point, -frame->origin_x, right, point);
251  qglVertex3fv (point);
252 
253  qglTexCoord2f (0, 0);
254  VectorMA (e->origin, frame->height - frame->origin_y, up, point);
255  VectorMA (point, -frame->origin_x, right, point);
256  qglVertex3fv (point);
257 
258  qglTexCoord2f (1, 0);
259  VectorMA (e->origin, frame->height - frame->origin_y, up, point);
260  VectorMA (point, frame->width - frame->origin_x, right, point);
261  qglVertex3fv (point);
262 
263  qglTexCoord2f (1, 1);
264  VectorMA (e->origin, -frame->origin_y, up, point);
265  VectorMA (point, frame->width - frame->origin_x, right, point);
266  qglVertex3fv (point);
267 
268  qglEnd ();
269 
270  qglDisable (GL_ALPHA_TEST);
271  GL_TexEnv( GL_REPLACE );
272 
273  if ( alpha != 1.0F )
274  qglDisable( GL_BLEND );
275 
276  qglColor4f( 1, 1, 1, 1 );
277 }

Referenced by R_DrawEntitiesOnList().

◆ R_DrawWorld()

void R_DrawWorld ( void  )

Definition at line 1197 of file gl_rsurf.c.

1198 {
1199  entity_t ent;
1200 
1201  if (!r_drawworld->value)
1202  return;
1203 
1205  return;
1206 
1208 
1210 
1211  // auto cycle the world frame for texture animation
1212  memset (&ent, 0, sizeof(ent));
1213  ent.frame = (int)(r_newrefdef.time*2);
1214  currententity = &ent;
1215 
1217 
1218  qglColor3f (1,1,1);
1219  memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
1220  R_ClearSkyBox ();
1221 
1222  if ( qglMTexCoord2fSGIS )
1223  {
1224  GL_EnableMultitexture( true );
1225 
1227  GL_TexEnv( GL_REPLACE );
1229 
1230  if ( gl_lightmap->value )
1231  GL_TexEnv( GL_REPLACE );
1232  else
1233  GL_TexEnv( GL_MODULATE );
1234 
1236 
1237  GL_EnableMultitexture( false );
1238  }
1239  else
1240  {
1242  }
1243 
1244  /*
1245  ** theoretically nothing should happen in the next two functions
1246  ** if multitexture is enabled
1247  */
1248  DrawTextureChains ();
1249  R_BlendLightmaps ();
1250 
1251  R_DrawSkyBox ();
1252 
1254 }

◆ R_EndFrame()

void R_EndFrame ( void  )

Definition at line 1285 of file vk_rmain.c.

1286 {
1287  QVk_EndFrame(false);
1288 }

Referenced by GetRefAPI().

◆ R_Init()

qboolean R_Init ( void hinstance,
void hWnd 
)

Definition at line 326 of file r_main.c.

327 {
328 
329  R_InitImages();
330  Mod_Init();
331  Draw_InitLocal();
332  R_InitTextures();
333 
334  R_InitTurb();
335 
336  view_clipplanes[0].leftedge = true;
337  view_clipplanes[1].rightedge = true;
339  view_clipplanes[3].leftedge = false;
341  view_clipplanes[3].rightedge = false;
342 
345 
346  // TODO: collect 386-specific code in one place
347 #if id386
349  (long)R_EdgeCodeEnd - (long)R_EdgeCodeStart);
350  Sys_SetFPCW(); // get bit masks for FPCW (FIXME: is this id386?)
351 #endif // id386
352 
353  r_aliasuvscale = 1.0;
354 
355  R_Register();
356  Draw_GetPalette();
357  Draw_InitRGBMap(); // leilei - colored lights
358 
359  if (SWimp_Init(hInstance, wndProc) == false)
360  return -1;
361 
362  // create the window
363  R_BeginFrame(0);
364 
365  ri.Con_Printf(PRINT_ALL, "ref_soft version: "REF_VERSION"\n");
366 
367  return true;
368 }

Referenced by GetRefAPI().

◆ R_InitParticleTexture()

void R_InitParticleTexture ( void  )

Definition at line 41 of file gl_rmisc.c.

42 {
43  int x,y;
44  byte data[8][8][4];
45 
46  //
47  // particle texture
48  //
49  for (x=0 ; x<8 ; x++)
50  {
51  for (y=0 ; y<8 ; y++)
52  {
53  data[y][x][0] = 255;
54  data[y][x][1] = 255;
55  data[y][x][2] = 255;
56  data[y][x][3] = dottexture[x][y]*255;
57  }
58  }
59  r_particletexture = GL_LoadPic ("***particle***", (byte *)data, 8, 8, it_sprite, 32);
60 
61  //
62  // also use this for bad textures, but without alpha
63  //
64  for (x=0 ; x<8 ; x++)
65  {
66  for (y=0 ; y<8 ; y++)
67  {
68  data[y][x][0] = dottexture[x&3][y&3]*255;
69  data[y][x][1] = 0; // dottexture[x&3][y&3]*255;
70  data[y][x][2] = 0; //dottexture[x&3][y&3]*255;
71  data[y][x][3] = 255;
72  }
73  }
74  r_notexture = GL_LoadPic ("***r_notexture***", (byte *)data, 8, 8, it_wall, 32);
75 }

◆ R_LightPoint()

void R_LightPoint ( vec3_t  p,
vec3_t  color 
)

Definition at line 226 of file r_light.c.

227 {
228  vec3_t end;
229  float r;
230  int lnum;
231  dlight_t *dl;
232  vec3_t dist;
233  float add;
234 
235  if (!r_worldmodel->lightdata)
236  {
237  color[0] = color[1] = color[2] = 1.0;
238  return;
239  }
240 
241  end[0] = p[0];
242  end[1] = p[1];
243  end[2] = p[2] - 2048;
244 
246 
247  if (r == -1)
248  {
249  VectorCopy(vec3_origin, color);
250  }
251  else
252  {
253  VectorCopy(pointcolor, color);
254  }
255 
256  //
257  // add dynamic lights
258  //
259  for (lnum = 0; lnum<r_newrefdef.num_dlights; lnum++)
260  {
261  dl = &r_newrefdef.dlights[lnum];
263  dl->origin,
264  dist);
265  add = dl->intensity - VectorLength(dist);
266  add *= (1.0 / 256);
267  if (add > 0)
268  {
269  VectorMA(color, add, dl->color, color);
270  }
271  }
272 }

Referenced by R_DrawAliasModel(), R_DrawNullModel(), and R_SetLightLevel().

◆ R_MarkLeaves()

void R_MarkLeaves ( void  )

Definition at line 467 of file r_main.c.

468 {
469  byte *vis;
470  mnode_t *node;
471  int i;
472  mleaf_t *leaf;
473  int cluster;
474 
476  return;
477 
478  // development aid to let you run around and see exactly where
479  // the pvs ends
480  if (sw_lockpvs->value)
481  return;
482 
483  r_visframecount++;
485 
486  if (r_novis->value || r_viewcluster == -1 || !r_worldmodel->vis)
487  {
488  // mark everything
489  for (i = 0; i < r_worldmodel->numleafs; i++)
491  for (i = 0; i < r_worldmodel->numnodes; i++)
493  return;
494  }
495 
497 
498  for (i = 0, leaf = r_worldmodel->leafs; i < r_worldmodel->numleafs; i++, leaf++)
499  {
500  cluster = leaf->cluster;
501  if (cluster == -1)
502  continue;
503  if (vis[cluster >> 3] & (1 << (cluster & 7)))
504  {
505  node = (mnode_t *)leaf;
506  do
507  {
508  if (node->visframe == r_visframecount)
509  break;
510  node->visframe = r_visframecount;
511  node = node->parent;
512  } while (node);
513  }
514  }
515 
516 #if 0
517  for (i=0 ; i<r_worldmodel->vis->numclusters ; i++)
518  {
519  if (vis[i>>3] & (1<<(i&7)))
520  {
521  node = (mnode_t *)&r_worldmodel->leafs[i]; // FIXME: cluster
522  do
523  {
524  if (node->visframe == r_visframecount)
525  break;
526  node->visframe = r_visframecount;
527  node = node->parent;
528  } while (node);
529  }
530  }
531 #endif
532 }

Referenced by R_RenderFrame(), and R_RenderView().

◆ R_MarkLights()

void R_MarkLights ( dlight_t light,
int  bit,
mnode_t node 
)

Definition at line 40 of file r_light.c.

41 {
42  mplane_t *splitplane;
43  float dist;
44  msurface_t *surf;
45  int i;
46 
47  if (node->contents != -1)
48  return;
49 
50  splitplane = node->plane;
51  dist = DotProduct(light->origin, splitplane->normal) - splitplane->dist;
52 
53  //=====
54  //PGM
55  i = light->intensity;
56  if (i<0)
57  i = -i;
58  //PGM
59  //=====
60 
61  if (dist > i) // PGM (dist > light->intensity)
62  {
63  R_MarkLights(light, bit, node->children[0]);
64  return;
65  }
66  if (dist < -i) // PGM (dist < -light->intensity)
67  {
68  R_MarkLights(light, bit, node->children[1]);
69  return;
70  }
71 
72  // mark the polygons
73  surf = r_worldmodel->surfaces + node->firstsurface;
74  for (i = 0; i < node->numsurfaces; i++, surf++)
75  {
76  if (surf->dlightframe != r_dlightframecount)
77  {
78  surf->dlightbits = 0;
80  }
81  surf->dlightbits |= bit;
82  }
83 
84  R_MarkLights(light, bit, node->children[0]);
85  R_MarkLights(light, bit, node->children[1]);
86 }

Referenced by R_DrawInlineBModel(), R_MarkLights(), and R_PushDlights().

◆ R_PushDlights()

void R_PushDlights ( void  )

Definition at line 164 of file gl_light.c.

165 {
166  int i;
167  dlight_t *l;
168 
169  if (gl_flashblend->value)
170  return;
171 
172  r_dlightframecount = r_framecount + 1; // because the count hasn't
173  // advanced yet for this frame
174  l = r_newrefdef.dlights;
175  for (i=0 ; i<r_newrefdef.num_dlights ; i++, l++)
176  R_MarkLights ( l, 1<<i, r_worldmodel->nodes );
177 }

◆ R_RegisterSkin()

struct image_s* R_RegisterSkin ( char *  name)

Definition at line 550 of file r_image.c.

551 {
552  return R_FindImage (name, it_skin);
553 }

◆ R_RenderBrushPoly()

void R_RenderBrushPoly ( msurface_t fa,
float *  modelMatrix,
float  alpha 
)

Definition at line 271 of file vk_rsurf.c.

272 {
273  int maps;
274  image_t *image;
275  qboolean is_dynamic = false;
276  float color[4] = { 1.f, 1.f, 1.f, alpha };
277  c_brush_polys++;
278 
279  image = R_TextureAnimation(fa->texinfo);
280 
281  if (fa->flags & SURF_DRAWTURB)
282  {
283  color[0] = color[1] = color[2] = vk_state.inverse_intensity;
284  color[3] = 1.f;
285  // warp texture, no lightmaps
286  EmitWaterPolys(fa, image, modelMatrix, color);
287  return;
288  }
289 
290  //======
291  //PGM
292  if (fa->texinfo->flags & SURF_FLOWING)
293  DrawVkFlowingPoly(fa, image, color);
294  else
295  DrawVkPoly(fa->polys, image, color);
296  //PGM
297  //======
298 
299  /*
300  ** check for lightmap modification
301  */
302  for (maps = 0; maps < MAXLIGHTMAPS && fa->styles[maps] != 255; maps++)
303  {
304  if (r_newrefdef.lightstyles[fa->styles[maps]].white != fa->cached_light[maps])
305  goto dynamic;
306  }
307 
308  // dynamic this frame or dynamic previously
309  if (fa->dlightframe == r_framecount)
310  {
311  dynamic:
312  if (vk_dynamic->value)
313  {
315  {
316  is_dynamic = true;
317  }
318  }
319  }
320 
321  if (is_dynamic)
322  {
323  if ((fa->styles[maps] >= 32 || fa->styles[maps] == 0) && (fa->dlightframe != r_framecount))
324  {
325  unsigned temp[34 * 34];
326  int smax, tmax;
327 
328  smax = (fa->extents[0] >> 4) + 1;
329  tmax = (fa->extents[1] >> 4) + 1;
330 
331  R_BuildLightMap(fa, (void *)temp, smax * 4);
332  R_SetCacheState(fa);
333 
334  QVk_UpdateTextureData(&vk_state.lightmap_textures[fa->lightmaptexturenum], (unsigned char*)temp, fa->light_s, fa->light_t, smax, tmax);
335 
338  }
339  else
340  {
342  vk_lms.lightmap_surfaces[0] = fa;
343  }
344  }
345  else
346  {
349  }
350 }

Referenced by DrawTextureChains(), and R_DrawInlineBModel().

◆ R_RenderDlights()

void R_RenderDlights ( void  )

Definition at line 77 of file gl_light.c.

78 {
79  int i;
80  dlight_t *l;
81 
82  if (!gl_flashblend->value)
83  return;
84 
85  r_dlightframecount = r_framecount + 1; // because the count hasn't
86  // advanced yet for this frame
87  qglDepthMask (0);
88  qglDisable (GL_TEXTURE_2D);
89  qglShadeModel (GL_SMOOTH);
90  qglEnable (GL_BLEND);
91  qglBlendFunc (GL_ONE, GL_ONE);
92 
93  l = r_newrefdef.dlights;
94  for (i=0 ; i<r_newrefdef.num_dlights ; i++, l++)
95  R_RenderDlight (l);
96 
97  qglColor3f (1,1,1);
98  qglDisable (GL_BLEND);
99  qglEnable (GL_TEXTURE_2D);
100  qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
101  qglDepthMask (1);
102 }

Referenced by R_RenderView().

◆ R_RenderView()

void R_RenderView ( refdef_t fd)

Definition at line 818 of file gl_rmain.c.

819 {
820  if (r_norefresh->value)
821  return;
822 
823  r_newrefdef = *fd;
824 
826  ri.Sys_Error (ERR_DROP, "R_RenderView: NULL worldmodel");
827 
828  if (r_speeds->value)
829  {
830  c_brush_polys = 0;
831  c_alias_polys = 0;
832  }
833 
834  R_PushDlights ();
835 
836  if (gl_finish->value)
837  qglFinish ();
838 
839  R_SetupFrame ();
840 
841  R_SetFrustum ();
842 
843  R_SetupGL ();
844 
845  R_MarkLeaves (); // done here so we know if we're in water
846 
847  R_DrawWorld ();
848 
850 
851  R_RenderDlights ();
852 
853  R_DrawParticles ();
854 
856 
857  R_Flash();
858 
859  if (r_speeds->value)
860  {
861  ri.Con_Printf (PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n",
862  c_brush_polys,
863  c_alias_polys,
866  }
867 }

Referenced by R_RenderFrame().

◆ R_RotateForEntity()

void R_RotateForEntity ( entity_t e,
float *  mvMatrix 
)

Definition at line 150 of file vk_rmain.c.

151 {
152  Mat_Rotate(mvMatrix, -e->angles[2], 1.f, 0.f, 0.f);
153  Mat_Rotate(mvMatrix, -e->angles[0], 0.f, 1.f, 0.f);
154  Mat_Rotate(mvMatrix, e->angles[1], 0.f, 0.f, 1.f);
155  Mat_Translate(mvMatrix, e->origin[0], e->origin[1], e->origin[2]);
156 }

Referenced by R_DrawNullModel().

◆ R_SetPalette()

void R_SetPalette ( const unsigned char *  palette)

Definition at line 1574 of file gl_rmain.c.

1575 {
1576  int i;
1577 
1578  byte *rp = ( byte * ) r_rawpalette;
1579 
1580  if ( palette )
1581  {
1582  for ( i = 0; i < 256; i++ )
1583  {
1584  rp[i*4+0] = palette[i*3+0];
1585  rp[i*4+1] = palette[i*3+1];
1586  rp[i*4+2] = palette[i*3+2];
1587  rp[i*4+3] = 0xff;
1588  }
1589  }
1590  else
1591  {
1592  for ( i = 0; i < 256; i++ )
1593  {
1594  rp[i*4+0] = d_8to24table[i] & 0xff;
1595  rp[i*4+1] = ( d_8to24table[i] >> 8 ) & 0xff;
1596  rp[i*4+2] = ( d_8to24table[i] >> 16 ) & 0xff;
1597  rp[i*4+3] = 0xff;
1598  }
1599  }
1601 
1602  qglClearColor (0,0,0,0);
1603  qglClear (GL_COLOR_BUFFER_BIT);
1604  qglClearColor (1,0, 0.5 , 0.5);
1605 }

Referenced by GetRefAPI().

◆ R_Shutdown()

void R_Shutdown ( void  )

Definition at line 375 of file r_main.c.

376 {
377  // free z buffer
378  if (d_pzbuffer)
379  {
380  free(d_pzbuffer);
381  d_pzbuffer = NULL;
382  }
383  // free surface cache
384  if (sc_base)
385  {
386  D_FlushCaches();
387  free(sc_base);
388  sc_base = NULL;
389  }
390 
391  if (r_warpbuffer)
392  {
393  free(r_warpbuffer);
394  r_warpbuffer = NULL;
395  }
396 
397  // free colormap
398  if (vid.colormap)
399  {
400  free(vid.colormap);
401  vid.colormap = NULL;
402  }
403  R_UnRegister();
404  Mod_FreeAll();
406 
407  SWimp_Shutdown();
408 }

Referenced by GetRefAPI().

◆ Vk_DrawParticles()

void Vk_DrawParticles ( int  n,
const particle_t  particles[],
const unsigned  colortable[768] 
)

Definition at line 394 of file vk_rmain.c.

395 {
396  const particle_t *p;
397  int i;
398  vec3_t up, right;
399  float scale;
400  byte color[4];
401 
402  if (!num_particles)
403  return;
404 
405  VectorScale(vup, 1.5, up);
406  VectorScale(vright, 1.5, right);
407 
408  typedef struct {
409  float x,y,z,r,g,b,a,u,v;
410  } pvertex;
411 
412  static pvertex visibleParticles[MAX_PARTICLES*3];
413 
414  for (p = particles, i = 0; i < num_particles; i++, p++)
415  {
416  // hack a scale up to keep particles from disapearing
417  scale = (p->origin[0] - r_origin[0]) * vpn[0] +
418  (p->origin[1] - r_origin[1]) * vpn[1] +
419  (p->origin[2] - r_origin[2]) * vpn[2];
420 
421  if (scale < 20)
422  scale = 1;
423  else
424  scale = 1 + scale * 0.004;
425 
426  *(int *)color = colortable[p->color];
427 
428  int idx = i * 3;
429  float r = color[0] / 255.f;
430  float g = color[1] / 255.f;
431  float b = color[2] / 255.f;
432 
433  visibleParticles[idx].x = p->origin[0];
434  visibleParticles[idx].y = p->origin[1];
435  visibleParticles[idx].z = p->origin[2];
436  visibleParticles[idx].r = r;
437  visibleParticles[idx].g = g;
438  visibleParticles[idx].b = b;
439  visibleParticles[idx].a = p->alpha;
440  visibleParticles[idx].u = 0.0625;
441  visibleParticles[idx].v = 0.0625;
442 
443  visibleParticles[idx + 1].x = p->origin[0] + up[0] * scale;
444  visibleParticles[idx + 1].y = p->origin[1] + up[1] * scale;
445  visibleParticles[idx + 1].z = p->origin[2] + up[2] * scale;
446  visibleParticles[idx + 1].r = r;
447  visibleParticles[idx + 1].g = g;
448  visibleParticles[idx + 1].b = b;
449  visibleParticles[idx + 1].a = p->alpha;
450  visibleParticles[idx + 1].u = 1.0625;
451  visibleParticles[idx + 1].v = 0.0625;
452 
453  visibleParticles[idx + 2].x = p->origin[0] + right[0] * scale;
454  visibleParticles[idx + 2].y = p->origin[1] + right[1] * scale;
455  visibleParticles[idx + 2].z = p->origin[2] + right[2] * scale;
456  visibleParticles[idx + 2].r = r;
457  visibleParticles[idx + 2].g = g;
458  visibleParticles[idx + 2].b = b;
459  visibleParticles[idx + 2].a = p->alpha;
460  visibleParticles[idx + 2].u = 0.0625;
461  visibleParticles[idx + 2].v = 1.0625;
462  }
463 
465 
466  VkBuffer vbo;
467  VkDeviceSize vboOffset;
468  uint8_t *vertData = QVk_GetVertexBuffer(3 * sizeof(pvertex) * num_particles, &vbo, &vboOffset);
469  memcpy(vertData, &visibleParticles, 3 * sizeof(pvertex) * num_particles);
470 
471  vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawParticlesPipeline.layout, 0, 1, &r_particletexture->vk_texture.descriptorSet, 0, NULL);
472  vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1, &vbo, &vboOffset);
473  vkCmdDraw(vk_activeCmdbuffer, 3 * num_particles, 1, 0, 0);
474 }

Referenced by R_DrawParticles().

◆ Vk_FindImage()

image_t* Vk_FindImage ( char *  name,
imagetype_t  type,
qvksampler_t samplerType 
)

Definition at line 1508 of file vk_image.c.

1509 {
1510  image_t *image;
1511  int i, len;
1512  byte *pic, *palette;
1513  int width, height;
1514 
1515  if (!name)
1516  return NULL; // ri.Sys_Error (ERR_DROP, "Vk_FindImage: NULL name");
1517  len = (int)strlen(name);
1518  if (len<5)
1519  return NULL; // ri.Sys_Error (ERR_DROP, "Vk_FindImage: bad name: %s", name);
1520 
1521  // look for it
1522  for (i=0, image=vktextures ; i<numvktextures ; i++,image++)
1523  {
1524  if (!strcmp(name, image->name))
1525  {
1527  return image;
1528  }
1529  }
1530 
1531  //
1532  // load the pic from disk
1533  //
1534  pic = NULL;
1535  palette = NULL;
1536  if (!strcmp(name+len-4, ".pcx"))
1537  {
1538  LoadPCX (name, &pic, &palette, &width, &height);
1539  if (!pic)
1540  return NULL; // ri.Sys_Error (ERR_DROP, "Vk_FindImage: can't load %s", name);
1541  image = Vk_LoadPic (name, pic, width, height, type, 8, samplerType);
1542  }
1543  else if (!strcmp(name+len-4, ".wal"))
1544  {
1545  image = Vk_LoadWal (name);
1546  }
1547  else if (!strcmp(name+len-4, ".tga"))
1548  {
1549  LoadTGA (name, &pic, &width, &height);
1550  if (!pic)
1551  return NULL; // ri.Sys_Error (ERR_DROP, "Vk_FindImage: can't load %s", name);
1552  image = Vk_LoadPic (name, pic, width, height, type, 32, samplerType);
1553  }
1554  else
1555  return NULL; // ri.Sys_Error (ERR_DROP, "Vk_FindImage: bad extension on: %s", name);
1556 
1557 
1558  if (pic)
1559  free(pic);
1560  if (palette)
1561  free(palette);
1562 
1563  return image;
1564 }

Referenced by Draw_FindPic(), Draw_InitLocal(), Mod_LoadAliasModel(), Mod_LoadSpriteModel(), Mod_LoadTexinfo(), R_RegisterModel(), R_RegisterSkin(), and R_SetSky().

◆ Vk_FreeUnusedImages()

void Vk_FreeUnusedImages ( void  )

Definition at line 1587 of file vk_image.c.

1588 {
1589  int i;
1590  image_t *image;
1591 
1592  // never free r_notexture or particle texture
1595 
1596  for (i = 0, image = vktextures; i < numvktextures; i++, image++)
1597  {
1599  continue; // used this sequence
1600  if (!image->registration_sequence)
1601  continue; // free image_t slot
1602  if (image->type == it_pic)
1603  continue; // don't free pics
1604  // free it
1605  QVk_ReleaseTexture(&image->vk_texture);
1606  memset(image, 0, sizeof(*image));
1607  }
1608 }

Referenced by R_EndRegistration().

◆ Vk_ImageList_f()

void Vk_ImageList_f ( void  )

Definition at line 535 of file vk_image.c.

536 {
537  int i;
538  image_t *image;
539  int texels;
540 
541  ri.Con_Printf(PRINT_ALL, "------------------\n");
542  texels = 0;
543 
544  for (i = 0, image = vktextures; i < numvktextures; i++, image++)
545  {
546  if (image->vk_texture.image == VK_NULL_HANDLE)
547  continue;
548  texels += image->upload_width*image->upload_height;
549  switch (image->type)
550  {
551  case it_skin:
552  ri.Con_Printf(PRINT_ALL, "M");
553  break;
554  case it_sprite:
555  ri.Con_Printf(PRINT_ALL, "S");
556  break;
557  case it_wall:
558  ri.Con_Printf(PRINT_ALL, "W");
559  break;
560  case it_pic:
561  ri.Con_Printf(PRINT_ALL, "P");
562  break;
563  default:
564  ri.Con_Printf(PRINT_ALL, " ");
565  break;
566  }
567 
568  ri.Con_Printf(PRINT_ALL, " %3i %3i RGB: %s\n",
569  image->upload_width, image->upload_height, image->name);
570  }
571  ri.Con_Printf(PRINT_ALL, "Total texel count (not counting mipmaps): %i\n", texels);
572 }

Referenced by R_Register().

◆ Vk_InitImages()

void Vk_InitImages ( void  )

Definition at line 1654 of file vk_image.c.

1655 {
1656  int i, j;
1657  float g = vid_gamma->value;
1658 
1660 
1661  // init intensity conversions
1662  intensity = ri.Cvar_Get("intensity", "2", 0);
1663 
1664  if (intensity->value <= 1)
1665  ri.Cvar_Set("intensity", "1");
1666 
1668 
1669  Draw_GetPalette();
1670 
1671  for (i = 0; i < 256; i++)
1672  {
1673  if (g == 1)
1674  {
1675  gammatable[i] = i;
1676  }
1677  else
1678  {
1679  float inf;
1680 
1681  inf = 255 * pow((i + 0.5) / 255.5, g) + 0.5;
1682  if (inf < 0)
1683  inf = 0;
1684  if (inf > 255)
1685  inf = 255;
1686  gammatable[i] = inf;
1687  }
1688  }
1689 
1690  for (i = 0; i<256; i++)
1691  {
1692  j = i * intensity->value;
1693  if (j > 255)
1694  j = 255;
1695  intensitytable[i] = j;
1696  }
1697 }

Referenced by R_Init().

◆ Vk_LmapTextureMode()

void Vk_LmapTextureMode ( char *  string)

Definition at line 705 of file vk_image.c.

706 {
707  int i,j;
708  static char prev_mode[32] = { "VK_MIPMAP_LINEAR" };
709 
710  for (i = 0; i < NUM_VK_MODES; i++)
711  {
712  if (!Q_stricmp(modes[i].name, string))
713  break;
714  }
715 
716  if (i == NUM_VK_MODES)
717  {
718  ri.Con_Printf(PRINT_ALL, "bad filter name (valid values: VK_NEAREST, VK_LINEAR, VK_MIPMAP_NEAREST, VK_MIPMAP_LINEAR)\n");
719  ri.Cvar_Set("vk_lmaptexturemode", prev_mode);
720  return;
721  }
722 
723  memcpy(prev_mode, string, strlen(string));
724  prev_mode[strlen(string)] = '\0';
725 
726  i += vk_aniso->value > 0 ? NUM_VK_MODES : 0;
728 
729  vkDeviceWaitIdle(vk_device.logical);
730  for (j = 0; j < MAX_LIGHTMAPS*2; j++)
731  {
732  if (vk_state.lightmap_textures[j].image != VK_NULL_HANDLE)
734  }
735 }

Referenced by R_BeginFrame().

◆ Vk_LoadPic()

image_t* Vk_LoadPic ( char *  name,
byte pic,
int  width,
int  height,
imagetype_t  type,
int  bits,
qvksampler_t samplerType 
)

Definition at line 1369 of file vk_image.c.

1370 {
1371  image_t *image;
1372  int i;
1373 
1374  // find a free image_t
1375  for (i = 0, image = vktextures; i<numvktextures; i++, image++)
1376  {
1377  if (image->vk_texture.image == VK_NULL_HANDLE && !image->scrap)
1378  break;
1379  }
1380  if (i == numvktextures)
1381  {
1383  ri.Sys_Error(ERR_DROP, "MAX_VKTEXTURES");
1384  numvktextures++;
1385  }
1386  image = &vktextures[i];
1387 
1388  if (strlen(name) >= sizeof(image->name))
1389  ri.Sys_Error(ERR_DROP, "Draw_LoadPic: \"%s\" is too long", name);
1390  strcpy(image->name, name);
1392  // zero-clear Vulkan texture handle
1393  QVVKTEXTURE_CLEAR(image->vk_texture);
1394  image->width = width;
1395  image->height = height;
1396  image->type = type;
1397 
1398  if (type == it_skin && bits == 8)
1399  R_FloodFillSkin(pic, width, height);
1400 
1401  // load little pics into the scrap
1402  if (image->type == it_pic && bits == 8
1403  && image->width < 64 && image->height < 64)
1404  {
1405  int x, y;
1406  int i, j, k;
1407  int texnum;
1408 
1409  texnum = Scrap_AllocBlock(image->width, image->height, &x, &y);
1410  if (texnum == -1)
1411  goto nonscrap;
1412 
1413  // copy the texels into the scrap block
1414  k = 0;
1415  for (i = 0; i<image->height; i++)
1416  for (j = 0; j<image->width; j++, k++)
1417  scrap_texels[texnum][(y + i)*BLOCK_WIDTH + x + j] = pic[k];
1418  image->scrap = true;
1419  image->sl = (x + 0.01) / (float)BLOCK_WIDTH;
1420  image->sh = (x + image->width - 0.01) / (float)BLOCK_WIDTH;
1421  image->tl = (y + 0.01) / (float)BLOCK_WIDTH;
1422  image->th = (y + image->height - 0.01) / (float)BLOCK_WIDTH;
1423  image->upload_width = BLOCK_WIDTH;
1424  image->upload_height = BLOCK_HEIGHT;
1425 
1426  // update scrap data
1427  Vk_Upload8(scrap_texels[texnum], BLOCK_WIDTH, BLOCK_HEIGHT, false, false);
1428 
1429  if (vk_scrapTextures[texnum].image != VK_NULL_HANDLE)
1430  {
1431  QVk_UpdateTextureData(&vk_scrapTextures[texnum], (unsigned char*)texBuffer, 0, 0, image->upload_width, image->upload_height);
1432  }
1433  else
1434  {
1436  QVk_CreateTexture(&vk_scrapTextures[texnum], (unsigned char*)texBuffer, image->upload_width, image->upload_height, samplerType ? *samplerType : vk_current_sampler);
1437  QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].image, VK_OBJECT_TYPE_IMAGE, va("Image: %s", name));
1438  QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].imageView, VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: %s", name));
1439  QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: %s", name));
1440  QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].allocInfo.deviceMemory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: scrap texture");
1441  }
1442 
1443  image->vk_texture = vk_scrapTextures[texnum];
1444  }
1445  else
1446  {
1447  nonscrap:
1448  image->scrap = false;
1449  if (bits == 8)
1450  image->vk_texture.mipLevels = Vk_Upload8(pic, width, height, (image->type != it_pic && image->type != it_sky), image->type == it_sky);
1451  else
1452  image->vk_texture.mipLevels = Vk_Upload32((unsigned *)pic, width, height, (image->type != it_pic && image->type != it_sky));
1453 
1454  image->upload_width = upload_width; // after power of 2 and scales
1455  image->upload_height = upload_height;
1456  image->sl = 0;
1457  image->sh = 1;
1458  image->tl = 0;
1459  image->th = 1;
1460 
1461  QVk_CreateTexture(&image->vk_texture, (unsigned char*)texBuffer, image->upload_width, image->upload_height, samplerType ? *samplerType : vk_current_sampler);
1462  QVk_DebugSetObjectName((uint64_t)image->vk_texture.image, VK_OBJECT_TYPE_IMAGE, va("Image: %s", name));
1463  QVk_DebugSetObjectName((uint64_t)image->vk_texture.imageView, VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: %s", name));
1464  QVk_DebugSetObjectName((uint64_t)image->vk_texture.descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: %s", name));
1465  QVk_DebugSetObjectName((uint64_t)image->vk_texture.allocInfo.deviceMemory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: game textures");
1466  }
1467 
1468  return image;
1469 }

Referenced by R_InitParticleTexture(), Vk_FindImage(), and Vk_LoadWal().

◆ Vk_ResampleTexture()

void Vk_ResampleTexture ( unsigned *  in,
int  inwidth,
int  inheight,
unsigned *  out,
int  outwidth,
int  outheight 
)

Definition at line 1145 of file vk_image.c.

1146 {
1147  int i, j;
1148  unsigned *inrow, *inrow2;
1149  unsigned frac, fracstep;
1150  unsigned p1[1024], p2[1024];
1151  byte *pix1, *pix2, *pix3, *pix4;
1152 
1153  fracstep = inwidth*0x10000/outwidth;
1154 
1155  frac = fracstep>>2;
1156  for (i=0 ; i<outwidth ; i++)
1157  {
1158  p1[i] = 4*(frac>>16);
1159  frac += fracstep;
1160  }
1161  frac = 3*(fracstep>>2);
1162  for (i=0 ; i<outwidth ; i++)
1163  {
1164  p2[i] = 4*(frac>>16);
1165  frac += fracstep;
1166  }
1167 
1168  for (i=0 ; i<outheight ; i++, out += outwidth)
1169  {
1170  inrow = in + inwidth*(int)((i+0.25)*inheight/outheight);
1171  inrow2 = in + inwidth*(int)((i+0.75)*inheight/outheight);
1172 
1173  for (j=0 ; j<outwidth ; j++)
1174  {
1175  pix1 = (byte *)inrow + p1[j];
1176  pix2 = (byte *)inrow + p2[j];
1177  pix3 = (byte *)inrow2 + p1[j];
1178  pix4 = (byte *)inrow2 + p2[j];
1179  ((byte *)(out+j))[0] = (pix1[0] + pix2[0] + pix3[0] + pix4[0])>>2;
1180  ((byte *)(out+j))[1] = (pix1[1] + pix2[1] + pix3[1] + pix4[1])>>2;
1181  ((byte *)(out+j))[2] = (pix1[2] + pix2[2] + pix3[2] + pix4[2])>>2;
1182  ((byte *)(out+j))[3] = (pix1[3] + pix2[3] + pix3[3] + pix4[3])>>2;
1183  }
1184  }
1185 }

Referenced by Vk_Upload32().

◆ Vk_ScreenShot_f()

void Vk_ScreenShot_f ( void  )

Definition at line 101 of file vk_rmisc.c.

102 {
103  byte *buffer;
104  char picname[80];
105  char checkname[MAX_OSPATH];
106  int i, temp;
107  FILE *f;
108  size_t buffSize = vid.width * vid.height * 4 + 18;
109 
110  // create the scrnshots directory if it doesn't exist
111  Com_sprintf(checkname, sizeof(checkname), "%s/scrnshot", ri.FS_Gamedir());
112  Sys_Mkdir(checkname);
113 
114  //
115  // find a file name to save it to
116  //
117  strcpy(picname, "quake00.tga");
118 
119  for (i = 0; i <= 99; i++)
120  {
121  picname[5] = i / 10 + '0';
122  picname[6] = i % 10 + '0';
123  Com_sprintf(checkname, sizeof(checkname), "%s/scrnshot/%s", ri.FS_Gamedir(), picname);
124  f = fopen(checkname, "rb");
125  if (!f)
126  break; // file doesn't exist
127  fclose(f);
128  }
129  if (i == 100)
130  {
131  ri.Con_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n");
132  return;
133  }
134 
135  buffer = malloc(buffSize);
136  memset(buffer, 0, 18);
137  buffer[2] = 2; // uncompressed type
138  buffer[12] = vid.width & 255;
139  buffer[13] = vid.width >> 8;
140  buffer[14] = vid.height & 255;
141  buffer[15] = vid.height >> 8;
142  buffer[16] = 32; // pixel size
143  buffer[17] = 0x20; // image is upside-down
144 
146 
147  // swap rgb to bgr
148  if (vk_swapchain.format == VK_FORMAT_R8G8B8A8_UNORM || vk_swapchain.format == VK_FORMAT_R8G8B8A8_SRGB)
149  {
150  for (i = 18; i < buffSize; i += 4)
151  {
152  temp = buffer[i];
153  buffer[i] = buffer[i + 2];
154  buffer[i + 2] = temp;
155  buffer[i + 3] = 255; // alpha component
156  }
157  }
158  else
159  {
160  for (i = 18; i < buffSize; i += 4)
161  {
162  buffer[i + 3] = 255;
163  }
164  }
165 
166  f = fopen(checkname, "wb");
167  fwrite(buffer, 1, buffSize, f);
168  fclose(f);
169 
170  free(buffer);
171  ri.Con_Printf(PRINT_ALL, "Wrote %s\n", picname);
172 }

Referenced by R_Register().

◆ Vk_ShutdownImages()

void Vk_ShutdownImages ( void  )

Definition at line 1704 of file vk_image.c.

1705 {
1706  int i;
1707  image_t *image;
1708 
1709  for (i = 0, image = vktextures; i<numvktextures; i++, image++)
1710  {
1711  if (!image->registration_sequence)
1712  continue; // free image_t slot
1713  // free it (scraps are stored in a separate Vulkan buffer)
1714  if (!image->scrap)
1715  QVk_ReleaseTexture(&image->vk_texture);
1716  memset(image, 0, sizeof(*image));
1717  }
1718 
1720 
1721  for(i = 0; i < MAX_SCRAPS; i++)
1723 
1724  for(i = 0; i < MAX_LIGHTMAPS*2; i++)
1726 }

Referenced by R_Shutdown().

◆ Vk_SubdivideSurface()

void Vk_SubdivideSurface ( msurface_t fa)

Definition at line 164 of file vk_warp.c.

165 {
166  vec3_t verts[64];
167  int numverts;
168  int i;
169  int lindex;
170  float *vec;
171 
172  warpface = fa;
173 
174  //
175  // convert edges back to a normal polygon
176  //
177  numverts = 0;
178  for (i=0 ; i<fa->numedges ; i++)
179  {
180  lindex = loadmodel->surfedges[fa->firstedge + i];
181 
182  if (lindex > 0)
183  vec = loadmodel->vertexes[loadmodel->edges[lindex].v[0]].position;
184  else
185  vec = loadmodel->vertexes[loadmodel->edges[-lindex].v[1]].position;
186  VectorCopy (vec, verts[numverts]);
187  numverts++;
188  }
189 
190  SubdividePolygon (numverts, verts[0]);
191 }

Referenced by Mod_LoadFaces().

◆ Vk_TextureMode()

void Vk_TextureMode ( char *  string)

Definition at line 657 of file vk_image.c.

658 {
659  int i,j;
660  image_t *image;
661  static char prev_mode[32] = { "VK_MIPMAP_LINEAR" };
662 
663  for (i = 0; i < NUM_VK_MODES; i++)
664  {
665  if (!Q_stricmp(modes[i].name, string))
666  break;
667  }
668 
669  if (i == NUM_VK_MODES)
670  {
671  ri.Con_Printf(PRINT_ALL, "bad filter name (valid values: VK_NEAREST, VK_LINEAR, VK_MIPMAP_NEAREST, VK_MIPMAP_LINEAR)\n");
672  ri.Cvar_Set("vk_texturemode", prev_mode);
673  return;
674  }
675 
676  memcpy(prev_mode, string, strlen(string));
677  prev_mode[strlen(string)] = '\0';
678 
679  i += vk_aniso->value > 0 ? NUM_VK_MODES : 0;
681 
682  vkDeviceWaitIdle(vk_device.logical);
683  for (j = 0, image = vktextures; j < numvktextures; j++, image++)
684  {
685  // skip console characters - we want them unfiltered at all times
686  if (image->vk_texture.image != VK_NULL_HANDLE && Q_stricmp(image->name, "pics/conchars.pcx"))
688  }
689 
690  for (j = 0; j < MAX_SCRAPS; j++)
691  {
692  if (vk_scrapTextures[j].image != VK_NULL_HANDLE)
694  }
695 
696  if (vk_rawTexture.image != VK_NULL_HANDLE)
698 }

Referenced by R_BeginFrame().

◆ Vkimp_AppActivate()

void Vkimp_AppActivate ( qboolean  active)

Definition at line 376 of file vk_imp.c.

377 {
378  if ( active )
379  {
380  SetForegroundWindow( vkw_state.hWnd );
381  ShowWindow( vkw_state.hWnd, SW_RESTORE );
382  }
383  else
384  {
385  if ( vid_fullscreen->value )
386  ShowWindow( vkw_state.hWnd, SW_MINIMIZE );
387  }
388 }

Referenced by GetRefAPI().

◆ Vkimp_BeginFrame()

void Vkimp_BeginFrame ( float  camera_separation)

Definition at line 350 of file vk_imp.c.

351 {
352  if (vk_bitdepth->modified)
353  {
355  {
356  ri.Cvar_SetValue("vk_bitdepth", 0);
357  ri.Con_Printf(PRINT_ALL, "vk_bitdepth requires Win95 OSR2.x or WinNT 4.x\n");
358  }
359  vk_bitdepth->modified = false;
360  }
361 }

Referenced by R_BeginFrame().

◆ Vkimp_CreateSurface()

VkResult Vkimp_CreateSurface ( void  )

Definition at line 170 of file vk_imp.c.

171 {
172  VkWin32SurfaceCreateInfoKHR surfaceCreateInfo = {
173  .sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR,
174  .pNext = NULL,
175  .flags = 0,
176  .hinstance = GetModuleHandle(NULL),
177  .hwnd = vkw_state.hWnd,
178  };
179 
180  return vkCreateWin32SurfaceKHR(vk_instance, &surfaceCreateInfo, NULL, &vk_surface);
181 }

Referenced by QVk_Init().

◆ Vkimp_EnableLogging()

void Vkimp_EnableLogging ( qboolean  enable)

Definition at line 2328 of file vk_common.c.

2329 {
2330  if (enable)
2331  {
2332  if (!vkw_state.log_fp)
2333  {
2334  struct tm *newtime;
2335  time_t aclock;
2336  char buffer[1024];
2337 
2338  time(&aclock);
2339  newtime = localtime(&aclock);
2340 
2341  asctime(newtime);
2342 
2343  Com_sprintf(buffer, sizeof(buffer), "%s/vk.log", ri.FS_Gamedir());
2344  vkw_state.log_fp = fopen(buffer, "wt");
2345 
2346  fprintf(vkw_state.log_fp, "%s\n", asctime(newtime));
2347  }
2349  }
2350  else
2351  {
2352  vk_logfp = NULL;
2353  }
2354 }

Referenced by R_BeginFrame().

◆ Vkimp_EndFrame()

void Vkimp_EndFrame ( void  )

Definition at line 369 of file vk_imp.c.

370 {
371 }

◆ Vkimp_GetSurfaceExtensions()

void Vkimp_GetSurfaceExtensions ( char **  extensions,
uint32_t *  extCount 
)

Definition at line 158 of file vk_imp.c.

159 {
160  if (extensions)
161  {
162  extensions[0] = VK_KHR_SURFACE_EXTENSION_NAME;
163  extensions[1] = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
164  }
165 
166  if (extCount)
167  *extCount = 2;
168 }

Referenced by QVk_Init().

◆ Vkimp_Init()

int Vkimp_Init ( void hinstance,
void hWnd 
)

Definition at line 304 of file vk_imp.c.

305 {
306 #define OSR2_BUILD_NUMBER 1111
307 
308  OSVERSIONINFO vinfo;
309 
310  vinfo.dwOSVersionInfoSize = sizeof(vinfo);
311 
313 
314  if ( GetVersionEx( &vinfo) )
315  {
316  if ( vinfo.dwMajorVersion > 4 )
317  {
319  }
320  else if ( vinfo.dwMajorVersion == 4 )
321  {
322  if ( vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
323  {
325  }
326  else if ( vinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
327  {
328  if ( LOWORD( vinfo.dwBuildNumber ) >= OSR2_BUILD_NUMBER )
329  {
331  }
332  }
333  }
334  }
335  else
336  {
337  ri.Con_Printf( PRINT_ALL, "Vkimp_Init() - GetVersionEx failed\n" );
338  return false;
339  }
340 
341  vkw_state.hInstance = ( HINSTANCE ) hinstance;
342  vkw_state.wndproc = wndproc;
343 
344  return true;
345 }

Referenced by R_Init().

◆ Vkimp_LogNewFrame()

void Vkimp_LogNewFrame ( void  )

Definition at line 2356 of file vk_common.c.

2357 {
2358  fprintf( vkw_state.log_fp, "*** R_BeginFrame ***\n" );
2359 }

Referenced by R_BeginFrame().

◆ Vkimp_SetMode()

int Vkimp_SetMode ( int pwidth,
int pheight,
int  mode,
qboolean  fullscreen 
)

Definition at line 186 of file vk_imp.c.

187 {
188  int width, height;
189  const char *win_fs[] = { "W", "FS" };
190 
191  ri.Con_Printf( PRINT_ALL, "Initializing Vulkan display\n");
192 
193  ri.Con_Printf (PRINT_ALL, "...setting mode %d:", mode );
194 
195  if ( !ri.Vid_GetModeInfo( &width, &height, mode ) )
196  {
197  ri.Con_Printf( PRINT_ALL, " invalid mode\n" );
198  return rserr_invalid_mode;
199  }
200 
201  ri.Con_Printf( PRINT_ALL, " %d %d %s\n", width, height, win_fs[fullscreen] );
202 
203  // destroy the existing window
204  if (vkw_state.hWnd)
205  {
206  Vkimp_Shutdown ();
207  }
208 
209  // do a CDS if needed
210  if ( fullscreen )
211  {
212  ri.Con_Printf( PRINT_ALL, "...attempting fullscreen\n" );
213 
214  if ( vk_bitdepth->value != 0 )
215  {
216  ri.Con_Printf( PRINT_ALL, "...using vk_bitdepth of %d\n", ( int ) vk_bitdepth->value );
217  }
218  else
219  {
220  HDC hdc = GetDC( NULL );
221  int bitspixel = GetDeviceCaps( hdc, BITSPIXEL );
222 
223  ri.Con_Printf( PRINT_ALL, "...using desktop display depth of %d\n", bitspixel );
224 
225  ReleaseDC( 0, hdc );
226  }
227 
228  ri.Con_Printf( PRINT_ALL, "...calling CDS: " );
229  if ( VID_CreateWindow(width, height, true) )
230  {
231  *pwidth = width;
232  *pheight = height;
233 
234  vk_state.fullscreen = true;
235 
236  ri.Con_Printf( PRINT_ALL, "ok\n" );
237  return rserr_ok;
238  }
239  else
240  {
241  ri.Con_Printf( PRINT_ALL, " failed\n" );
242  ri.Con_Printf( PRINT_ALL, "...setting windowed mode\n" );
243 
244  DestroyWindow(vkw_state.hWnd);
245  UnregisterClass(WINDOW_CLASS_NAME, vkw_state.hInstance);
246  VID_CreateWindow(width, height, false);
247 
248  *pwidth = width;
249  *pheight = height;
250  vk_state.fullscreen = false;
252  }
253  }
254  else
255  {
256  ri.Con_Printf( PRINT_ALL, "...setting windowed mode\n" );
257 
258  *pwidth = width;
259  *pheight = height;
260  vk_state.fullscreen = false;
261  if ( !VID_CreateWindow (width, height, false) )
262  return rserr_invalid_mode;
263  }
264 
265  return rserr_ok;
266 }

Referenced by R_SetMode().

◆ Vkimp_Shutdown()

void Vkimp_Shutdown ( void  )

Definition at line 274 of file vk_imp.c.

275 {
276  if (vkw_state.hWnd)
277  {
278  DestroyWindow(vkw_state.hWnd);
279  vkw_state.hWnd = NULL;
280  }
281 
282  if (vkw_state.log_fp)
283  {
284  fclose(vkw_state.log_fp);
285  vkw_state.log_fp = 0;
286  }
287 
288  UnregisterClass(WINDOW_CLASS_NAME, vkw_state.hInstance);
289 
290  if (vk_state.fullscreen)
291  {
292  ChangeDisplaySettingsEx( vkw_state.monInfo.szDevice, NULL, NULL, 0, NULL );
293  vk_state.fullscreen = false;
294  }
295 }

Referenced by R_Shutdown(), and Vkimp_SetMode().

Variable Documentation

◆ c_alias_polys

int c_alias_polys

Definition at line 155 of file vk_local.h.

◆ c_brush_polys

int c_brush_polys

Definition at line 55 of file gl_rmain.c.

Referenced by R_RenderView(), and R_SetupFrame().

◆ c_visible_lightmaps

int c_visible_lightmaps

Definition at line 40 of file gl_rsurf.c.

Referenced by R_BlendLightmaps().

◆ c_visible_textures

int c_visible_textures

Definition at line 41 of file gl_rsurf.c.

Referenced by DrawTextureChains().

◆ currententity

◆ currentmodel

model_t* currentmodel

Definition at line 39 of file r_main.c.

Referenced by R_DrawBEntitiesOnList(), R_DrawEntitiesOnList(), and R_DrawSpriteModel().

◆ d_8to24table

unsigned d_8to24table[256]

◆ frustum

cplane_t frustum[4]

Definition at line 50 of file gl_rmain.c.

Referenced by R_CullBox(), and R_SetFrustum().

◆ intensity

◆ numvktextures

◆ r_drawentities

cvar_t* r_drawentities

Definition at line 135 of file r_main.c.

Referenced by R_DrawBEntitiesOnList(), R_DrawEntitiesOnList(), R_Register(), and R_SetLightLevel().

◆ r_drawworld

cvar_t* r_drawworld

Definition at line 134 of file r_main.c.

Referenced by R_Register().

◆ r_framecount

int r_framecount

Definition at line 97 of file r_main.c.

Referenced by R_DrawBEntitiesOnList(), and R_SetupFrame().

◆ r_fullbright

cvar_t* r_fullbright

Definition at line 137 of file r_main.c.

Referenced by R_Register().

◆ r_lefthand

cvar_t* r_lefthand

Definition at line 117 of file r_main.c.

Referenced by R_Register().

◆ r_lerpmodels

cvar_t* r_lerpmodels

Definition at line 138 of file r_main.c.

Referenced by R_Register().

◆ r_lightlevel

cvar_t* r_lightlevel

Definition at line 142 of file r_main.c.

Referenced by R_Register(), and R_SetLightLevel().

◆ r_newrefdef

◆ r_nocull

cvar_t* r_nocull

Definition at line 85 of file gl_rmain.c.

Referenced by R_CullBox(), and R_Register().

◆ r_norefresh

cvar_t* r_norefresh

Definition at line 79 of file gl_rmain.c.

Referenced by R_Register(), and R_RenderView().

◆ r_notexture

image_t* r_notexture

Definition at line 44 of file gl_rmain.c.

◆ r_novis

cvar_t* r_novis

Definition at line 139 of file r_main.c.

Referenced by R_MarkLeaves(), and R_Register().

◆ r_oldviewcluster

int r_oldviewcluster

Definition at line 169 of file vk_local.h.

◆ r_oldviewcluster2

int r_oldviewcluster2

Definition at line 169 of file vk_local.h.

◆ r_origin

◆ r_particletexture

image_t* r_particletexture

Definition at line 45 of file gl_rmain.c.

Referenced by GL_DrawParticles(), and Vk_DrawParticles().

◆ r_speeds

cvar_t* r_speeds

Definition at line 141 of file r_main.c.

Referenced by R_Register(), R_RenderFrame(), and R_RenderView().

◆ r_viewcluster

int r_viewcluster

Definition at line 108 of file r_main.c.

Referenced by R_MarkLeaves(), R_NewMap(), and R_SetupFrame().

◆ r_viewcluster2

int r_viewcluster2

Definition at line 169 of file vk_local.h.

◆ r_viewproj_matrix

float r_viewproj_matrix[16]

Definition at line 64 of file vk_rmain.c.

Referenced by R_DrawTriangleOutlines(), and R_RenderDlight().

◆ r_visframecount

int r_visframecount

Definition at line 98 of file r_main.c.

Referenced by R_FindTopnode(), and R_MarkLeaves().

◆ r_worldmodel

model_t* r_worldmodel

Definition at line 41 of file r_main.c.

Referenced by R_FindTopnode(), R_MarkLeaves(), R_RenderFrame(), R_RenderView(), and R_SetupFrame().

◆ registration_sequence

◆ ri

◆ vid

◆ vid_fullscreen

cvar_t* vid_fullscreen

Definition at line 47 of file vid_dll.c.

Referenced by MainWndProc(), R_BeginFrame(), R_Register(), R_SetMode(), VID_CheckChanges(), and VID_Init().

◆ vid_gamma

◆ vk_aniso

cvar_t* vk_aniso

Definition at line 118 of file vk_rmain.c.

Referenced by R_BeginFrame(), and R_Register().

◆ vk_bitdepth

cvar_t* vk_bitdepth

Definition at line 92 of file vk_rmain.c.

Referenced by R_Register(), VID_CreateWindow(), Vkimp_BeginFrame(), and Vkimp_SetMode().

◆ vk_clear

cvar_t* vk_clear

Definition at line 99 of file vk_rmain.c.

Referenced by QVk_Init(), R_BeginFrame(), R_Register(), and R_SetMode().

◆ vk_config

◆ vk_current_lmap_sampler

qvksampler_t vk_current_lmap_sampler

Definition at line 43 of file vk_image.c.

Referenced by LM_UploadBlock(), Vk_BeginBuildingLightmaps(), and Vk_LmapTextureMode().

◆ vk_current_sampler

qvksampler_t vk_current_sampler

Definition at line 42 of file vk_image.c.

Referenced by Draw_StretchRaw(), Vk_LoadPic(), and Vk_TextureMode().

◆ vk_device_idx

cvar_t* vk_device_idx

Definition at line 122 of file vk_rmain.c.

Referenced by QVk_Init(), R_BeginFrame(), R_Register(), R_SetMode(), and Vk_Strings_f().

◆ vk_dynamic

cvar_t* vk_dynamic

Definition at line 112 of file vk_rmain.c.

Referenced by R_Register(), R_RenderBrushPoly(), and Vk_RenderLightmappedPoly().

◆ vk_finish

cvar_t* vk_finish

Definition at line 98 of file vk_rmain.c.

Referenced by R_Register(), and R_RenderView().

◆ vk_flashblend

cvar_t* vk_flashblend

Definition at line 97 of file vk_rmain.c.

Referenced by R_DrawInlineBModel(), R_PushDlights(), R_Register(), and R_RenderDlights().

◆ vk_lightmap

cvar_t* vk_lightmap

Definition at line 115 of file vk_rmain.c.

Referenced by R_Register(), and Vk_RenderLightmappedPoly().

◆ vk_lmaptexturemode

cvar_t* vk_lmaptexturemode

Definition at line 117 of file vk_rmain.c.

Referenced by R_BeginFrame(), R_Register(), and R_SetMode().

◆ vk_lockpvs

cvar_t* vk_lockpvs

Definition at line 100 of file vk_rmain.c.

Referenced by R_MarkLeaves(), and R_Register().

◆ vk_log

cvar_t* vk_log

Definition at line 93 of file vk_rmain.c.

Referenced by R_BeginFrame(), and R_Register().

◆ vk_mode

cvar_t* vk_mode

Definition at line 91 of file vk_rmain.c.

Referenced by R_BeginFrame(), R_Register(), and R_SetMode().

◆ vk_modulate

cvar_t* vk_modulate

Definition at line 102 of file vk_rmain.c.

Referenced by R_BuildLightMap(), R_LightPoint(), R_Register(), and RecursiveLightPoint().

◆ vk_particle_att_a

cvar_t* vk_particle_att_a

Definition at line 105 of file vk_rmain.c.

Referenced by R_DrawParticles(), and R_Register().

◆ vk_particle_att_b

cvar_t* vk_particle_att_b

Definition at line 106 of file vk_rmain.c.

Referenced by R_DrawParticles(), and R_Register().

◆ vk_particle_att_c

cvar_t* vk_particle_att_c

Definition at line 107 of file vk_rmain.c.

Referenced by R_DrawParticles(), and R_Register().

◆ vk_particle_max_size

cvar_t* vk_particle_max_size

Definition at line 109 of file vk_rmain.c.

Referenced by R_DrawParticles(), and R_Register().

◆ vk_particle_min_size

cvar_t* vk_particle_min_size

Definition at line 108 of file vk_rmain.c.

Referenced by R_DrawParticles(), and R_Register().

◆ vk_particle_size

cvar_t* vk_particle_size

Definition at line 104 of file vk_rmain.c.

Referenced by R_DrawParticles(), and R_Register().

◆ vk_picmip

cvar_t* vk_picmip

Definition at line 94 of file vk_rmain.c.

Referenced by R_BeginFrame(), R_Register(), and R_SetMode().

◆ vk_point_particles

cvar_t* vk_point_particles

Definition at line 110 of file vk_rmain.c.

Referenced by R_DrawParticles(), and R_Register().

◆ vk_polyblend

cvar_t* vk_polyblend

Definition at line 101 of file vk_rmain.c.

Referenced by R_PolyBlend(), and R_Register().

◆ vk_round_down

cvar_t* vk_round_down

Definition at line 96 of file vk_rmain.c.

Referenced by R_Register(), and Vk_Upload32().

◆ vk_sampleshading

cvar_t* vk_sampleshading

Definition at line 120 of file vk_rmain.c.

Referenced by R_BeginFrame(), R_Register(), and R_SetMode().

◆ vk_shadows

cvar_t* vk_shadows

Definition at line 103 of file vk_rmain.c.

Referenced by R_DrawAliasModel(), and R_Register().

◆ vk_showtris

cvar_t* vk_showtris

◆ vk_skymip

cvar_t* vk_skymip

Definition at line 95 of file vk_rmain.c.

Referenced by R_Register(), and R_SetSky().

◆ vk_state

◆ vk_texturemode

cvar_t* vk_texturemode

Definition at line 116 of file vk_rmain.c.

Referenced by R_BeginFrame(), R_Register(), and R_SetMode().

◆ vk_validation

cvar_t* vk_validation

◆ vk_vsync

cvar_t* vk_vsync

Definition at line 121 of file vk_rmain.c.

Referenced by R_BeginFrame(), R_Register(), and R_SetMode().

◆ vktextures

◆ vpn

◆ vright

◆ vup

it_sprite
@ it_sprite
Definition: vk_local.h:102
RF_TRANSLUCENT
#define RF_TRANSLUCENT
Definition: q_shared.h:604
vk_dynamic
cvar_t * vk_dynamic
Definition: vk_rmain.c:112
image_s::vk_texture
qvktexture_t vk_texture
Definition: vk_local.h:116
it_sprite
@ it_sprite
Definition: r_local.h:65
sv
server_t sv
Definition: sv_init.c:24
vk_lms
static vklightmapstate_t vk_lms
Definition: vk_rsurf.c:54
MAX_VKTEXTURES
#define MAX_VKTEXTURES
Definition: vk_local.h:122
QVk_DebugSetObjectName
#define QVk_DebugSetObjectName(a, b, c)
Definition: qvk.h:317
refdef_t::vieworg
float vieworg[3]
Definition: ref.h:106
it_pic
@ it_pic
Definition: vk_local.h:104
texBuffer
unsigned int texBuffer[256 *256]
Definition: vk_image.c:1237
rserr_t
rserr_t
Definition: r_local.h:103
sky_images
image_t * sky_images[6]
Definition: gl_warp.c:29
SubdividePolygon
void SubdividePolygon(int numverts, float *verts)
Definition: vk_warp.c:54
RF_SHELL_RED
#define RF_SHELL_RED
Definition: q_shared.h:609
height
GLsizei height
Definition: qgl_win.c:69
currentmodel
model_t * currentmodel
Definition: r_main.c:39
r_framecount
int r_framecount
Definition: r_main.c:97
it_wall
@ it_wall
Definition: vk_local.h:103
GL_LoadPic
image_t * GL_LoadPic(char *name, byte *pic, int width, int height, imagetype_t type)
Definition: r_image.c:414
entity_s::skin
struct image_s * skin
Definition: ref.h:75
msurface_s::styles
byte styles[MAXLIGHTMAPS]
Definition: r_model.h:115
it_sky
@ it_sky
Definition: vk_local.h:105
c_brush_polys
int c_brush_polys
Definition: gl_rmain.c:55
qvkdevice_t::logical
VkDevice logical
Definition: qvk.h:40
entity_s::origin
float origin[3]
Definition: ref.h:57
R_Register
void R_Register(void)
Definition: r_main.c:260
Vk_Upload32
uint32_t Vk_Upload32(unsigned *data, int width, int height, qboolean mipmap)
Definition: vk_image.c:1239
RF_IR_VISIBLE
#define RF_IR_VISIBLE
Definition: q_shared.h:614
R_InitImages
void R_InitImages(void)
Definition: r_image.c:593
LoadPCX
void LoadPCX(char *filename, byte **pic, byte **palette, int *width, int *height)
Definition: vk_image.c:751
r_novis
cvar_t * r_novis
Definition: r_main.c:139
LittleShort
short LittleShort(short l)
Definition: q_shared.c:946
model_s::vis
dvis_t * vis
Definition: r_model.h:229
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
r_visframecount
int r_visframecount
Definition: r_main.c:98
RF_MINLIGHT
#define RF_MINLIGHT
Definition: q_shared.h:599
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:163
Draw_GetPalette
int Draw_GetPalette(void)
Definition: vk_image.c:1616
Sys_SetFPCW
void Sys_SetFPCW(void)
Definition: rw_imp.c:351
R_ShutdownImages
void R_ShutdownImages(void)
Definition: r_image.c:603
RF_SHELL_HALF_DAM
#define RF_SHELL_HALF_DAM
Definition: q_shared.h:616
OSR2_BUILD_NUMBER
#define OSR2_BUILD_NUMBER
vk_scrapTextures
qvktexture_t vk_scrapTextures[MAX_SCRAPS]
Definition: vk_image.c:593
image_s::th
float th
Definition: gl_local.h:96
r_notexture
image_t * r_notexture
Definition: gl_rmain.c:44
c_visible_lightmaps
int c_visible_lightmaps
Definition: gl_rsurf.c:40
Sys_MakeCodeWriteable
void Sys_MakeCodeWriteable(unsigned long startaddr, unsigned long length)
Definition: rw_imp.c:322
viddef_t::buffer
pixel_t * buffer
Definition: r_local.h:94
R_SetupFrame
void R_SetupFrame(void)
Definition: gl_rmain.c:618
r_oldviewcluster
int r_oldviewcluster
Definition: r_main.c:108
gl_shadows
cvar_t * gl_shadows
Definition: gl_rmain.c:114
MakeSkyVec
void MakeSkyVec(float s, float t, int axis)
Definition: gl_warp.c:520
Vk_LoadPic
image_t * Vk_LoadPic(char *name, byte *pic, int width, int height, imagetype_t type, int bits, qvksampler_t *samplerType)
Definition: vk_image.c:1369
BOX_ON_PLANE_SIDE
#define BOX_ON_PLANE_SIDE(emins, emaxs, p)
Definition: q_shared.h:197
vk_logfp
FILE * vk_logfp
Definition: vk_common.c:43
model_s::nummodelsurfaces
int nummodelsurfaces
Definition: r_model.h:196
gl_state
glstate_t gl_state
Definition: gl_rmain.c:42
R_PushDlights
void R_PushDlights(model_t *model)
Definition: r_light.c:94
bottom
GLdouble GLdouble bottom
Definition: qgl_win.c:159
vk_instance
VkInstance vk_instance
Definition: vk_common.c:46
msurface_s::light_t
int light_t
Definition: gl_model.h:108
vkstate_t::lightmap_textures
qvktexture_t lightmap_textures[MAX_LIGHTMAPS *2]
Definition: vk_local.h:339
ri
refimport_t ri
Definition: r_main.c:25
pcx_t
Definition: qfiles.h:60
skyaxis
vec3_t skyaxis
Definition: gl_warp.c:28
vk_state
vkstate_t vk_state
Definition: vk_rmain.c:31
Sys_Mkdir
void Sys_Mkdir(char *path)
Definition: q_shwin.c:135
glstate_t::currenttextures
int currenttextures[2]
Definition: gl_local.h:418
RF_SHELL_GREEN
#define RF_SHELL_GREEN
Definition: q_shared.h:610
PRINT_DEVELOPER
#define PRINT_DEVELOPER
Definition: qcommon.h:752
MAX_SCRAPS
#define MAX_SCRAPS
Definition: vk_image.c:586
r_customheight
cvar_t * r_customheight
Definition: r_main.c:152
v
GLdouble v
Definition: qgl_win.c:143
it_wall
@ it_wall
Definition: r_local.h:66
cvar_s::modified
qboolean modified
Definition: q_shared.h:330
zNear
GLdouble GLdouble GLdouble GLdouble zNear
Definition: qgl_win.c:159
dmdl_t::num_tris
int num_tris
Definition: qfiles.h:149
VID_CreateWindow
qboolean VID_CreateWindow(int width, int height, qboolean fullscreen)
Definition: vk_imp.c:49
gl_texture1
int gl_texture1
Definition: gl_rmain.c:35
R_InitGraphics
void R_InitGraphics(int width, int height)
Definition: r_main.c:1108
gldepthmax
float gldepthmax
Definition: gl_local.h:129
glpoly_s::verts
float verts[4][VERTEXSIZE]
Definition: gl_model.h:92
modelorg
static vec3_t modelorg
Definition: gl_rsurf.c:26
dsprframe_t::height
int height
Definition: qfiles.h:176
d_8to24table
unsigned d_8to24table[256]
Definition: r_main.c:27
vup
vec3_t vup
Definition: vk_rmain.c:54
gl_finish
cvar_t * gl_finish
Definition: gl_rmain.c:125
model_s::edges
medge_t * edges
Definition: r_model.h:211
R_LightPoint
void R_LightPoint(vec3_t p, vec3_t color)
Definition: r_light.c:226
vid_fullscreen
cvar_t * vid_fullscreen
Definition: vid_dll.c:47
vkpoly_s::verts
float verts[4][VERTEXSIZE]
Definition: vk_model.h:93
QVk_UpdateTextureSampler
VkSampler QVk_UpdateTextureSampler(qvktexture_t *texture, qvksampler_t samplerType)
Definition: vk_common.c:2225
x2
GLdouble GLdouble x2
Definition: qgl_win.c:301
vpn
vec3_t vpn
Definition: vk_rmain.c:55
shadevector
vec3_t shadevector
Definition: gl_mesh.c:43
mnode_s::visframe
int visframe
Definition: r_model.h:127
vid
viddef_t vid
Definition: r_main.c:24
refimport_t::FS_LoadFile
int(* FS_LoadFile)(char *name, void **buf)
Definition: ref.h:209
pix
static int pix
Definition: r_part.c:472
VERTEXSIZE
#define VERTEXSIZE
Definition: gl_model.h:84
refimport_t::Cvar_Get
cvar_t *(* Cvar_Get)(char *name, char *value, int flags)
Definition: ref.h:216
Vkimp_Shutdown
void Vkimp_Shutdown(void)
Definition: vk_imp.c:274
cvar_s::string
char * string
Definition: q_shared.h:327
VectorScale
void VectorScale(vec3_t in, vec_t scale, vec3_t out)
Definition: q_shared.c:782
pcx_t::version
char version
Definition: qfiles.h:63
pcx_t::data
unsigned char data
Definition: qfiles.h:74
R_FindImage
image_t * R_FindImage(char *name, imagetype_t type)
Definition: r_image.c:491
qboolean
qboolean
Definition: q_shared.h:63
x
GLint GLenum GLint x
Definition: qgl_win.c:116
QVk_GetTriangleFanIbo
VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount)
Definition: vk_common.c:2198
vk_aniso
static cvar_t * vk_aniso
Definition: vid_menu.c:44
z
GLdouble GLdouble z
Definition: qgl_win.c:283
oldrefdef_t::xOrigin
float xOrigin
Definition: r_local.h:135
entity_s::skinnum
int skinnum
Definition: ref.h:70
Mat_Rotate
void Mat_Rotate(float *matrix, float deg, float x, float y, float z)
Definition: vk_rmain.c:728
VectorClear
#define VectorClear(a)
Definition: q_shared.h:166
i
int i
Definition: q_shared.c:305
msurface_s::numedges
int numedges
Definition: r_model.h:104
QVk_CreateTexture
void QVk_CreateTexture(qvktexture_t *texture, const unsigned char *data, uint32_t width, uint32_t height, qvksampler_t samplerType)
Definition: vk_image.c:382
modelorg
vec3_t modelorg
Definition: r_bsp.c:29
msurface_s::dlightframe
int dlightframe
Definition: r_model.h:97
c_alias_polys
int c_alias_polys
Definition: gl_rmain.c:55
GL_DrawAliasShadow
void GL_DrawAliasShadow(dmdl_t *paliashdr, int posenum)
Definition: gl_mesh.c:306
mleaf_s::visframe
int visframe
Definition: r_model.h:147
mnode_s::parent
struct mnode_s * parent
Definition: r_model.h:131
sw_lockpvs
cvar_t * sw_lockpvs
Definition: r_main.c:148
vk_current_sampler
qvksampler_t vk_current_sampler
Definition: vk_image.c:42
mnode_s
Definition: r_model.h:123
vkwstate_t::wndproc
void * wndproc
Definition: vk_win.h:31
buffer
GLenum GLfloat * buffer
Definition: qgl_win.c:151
r_drawworld
cvar_t * r_drawworld
Definition: r_main.c:134
Vk_Upload8
uint32_t Vk_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky)
Definition: vk_image.c:1321
glpoly_s::next
struct glpoly_s * next
Definition: gl_model.h:88
R_BuildLightMap
void R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
Definition: gl_light.c:455
PITCH
#define PITCH
Definition: q_shared.h:72
r_aliasuvscale
float r_aliasuvscale
Definition: r_main.c:56
vk_drawParticlesPipeline
qvkpipeline_t vk_drawParticlesPipeline
Definition: vk_common.c:147
dlight_t::origin
vec3_t origin
Definition: ref.h:84
refimport_t::Cvar_Set
cvar_t *(* Cvar_Set)(char *name, char *value)
Definition: ref.h:217
pointcolor
vec3_t pointcolor
Definition: r_light.c:116
r_vulkan_correction
static float r_vulkan_correction[16]
Definition: vk_rmain.c:66
r_origin
vec3_t r_origin
Definition: r_main.c:75
refdef_t::rdflags
int rdflags
Definition: ref.h:110
SWimp_Shutdown
void SWimp_Shutdown(void)
Definition: rw_imp.c:274
gl_texture0
int gl_texture0
Definition: gl_rmain.c:35
Scrap_AllocBlock
int Scrap_AllocBlock(int w, int h, int *x, int *y)
Definition: vk_image.c:596
vkw_state
vkwstate_t vkw_state
Definition: vk_imp.c:39
width
GLint GLsizei width
Definition: qgl_win.c:115
vkpoly_s
Definition: vk_model.h:87
mnode_s::children
struct mnode_s * children[2]
Definition: r_model.h:135
entity_s::flags
int flags
Definition: ref.h:76
pcx_t::hres
unsigned short hres
Definition: qfiles.h:67
r_alpha_surfaces
msurface_t * r_alpha_surfaces
Definition: r_poly.c:47
vid_gamma
cvar_t * vid_gamma
Definition: r_main.c:145
M_PI
#define M_PI
Definition: q_shared.h:142
image_s::registration_sequence
int registration_sequence
Definition: r_local.h:77
currententity
entity_t * currententity
Definition: r_bsp.c:28
SURF_WARP
#define SURF_WARP
Definition: qfiles.h:372
type
GLenum type
Definition: qgl_win.c:72
oldrefdef_t::yOrigin
float yOrigin
Definition: r_local.h:136
mplane_s::normal
vec3_t normal
Definition: r_model.h:59
msurface_s::extents
short extents[2]
Definition: r_model.h:110
skip
static void skip(vorb *z, int n)
Definition: stb_vorbis.c:1336
cvar_s
Definition: q_shared.h:324
BLOCK_WIDTH
#define BLOCK_WIDTH
Definition: vk_image.c:587
msurface_s::cached_light
float cached_light[MAXLIGHTMAPS]
Definition: gl_model.h:123
R_MarkLights
void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
Definition: r_light.c:40
mleaf_s
Definition: r_model.h:143
R_MarkLights
void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
Definition: gl_light.c:118
QVk_ReleaseTexture
void QVk_ReleaseTexture(qvktexture_t *texture)
Definition: vk_image.c:448
r_avertexnormal_dots
float r_avertexnormal_dots[SHADEDOT_QUANT][256]
Definition: gl_mesh.c:48
SURF_TRANS66
#define SURF_TRANS66
Definition: qfiles.h:374
r_lefthand
cvar_t * r_lefthand
Definition: r_main.c:117
vklightmapstate_t::lightmap_surfaces
msurface_t * lightmap_surfaces[MAX_LIGHTMAPS]
Definition: vk_rsurf.c:45
model_s::extradata
void * extradata
Definition: r_model.h:235
vk_device
qvkdevice_t vk_device
Definition: vk_common.c:51
R_RenderDlight
void R_RenderDlight(dlight_t *light)
Definition: gl_light.c:36
refimport_t::FS_FreeFile
void(* FS_FreeFile)(void *buf)
Definition: ref.h:210
r_worldmodel
model_t * r_worldmodel
Definition: gl_rmain.c:37
j
GLint j
Definition: qgl_win.c:150
Draw_GetPalette
void Draw_GetPalette(void)
Definition: r_main.c:1423
QVk_GetVertexBuffer
uint8_t * QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset)
Definition: vk_common.c:2019
r_norefresh
cvar_t * r_norefresh
Definition: gl_rmain.c:79
va
char * va(char *format,...)
Definition: q_shared.c:1050
mvertex_t::position
vec3_t position
Definition: r_model.h:47
Mat_Identity
void Mat_Identity(float *matrix)
Definition: vk_rmain.c:675
Mod_FreeAll
void Mod_FreeAll(void)
Definition: r_model.c:1324
refimport_t::Vid_GetModeInfo
qboolean(* Vid_GetModeInfo)(int *width, int *height, int mode)
Definition: ref.h:220
r_dlightframecount
int r_dlightframecount
Definition: gl_light.c:24
qvktexture_t::descriptorSet
VkDescriptorSet descriptorSet
Definition: qvk.h:87
vkwstate_t::monInfo
MONITORINFOEX monInfo
Definition: vk_win.h:33
skyrotate
float skyrotate
Definition: gl_warp.c:27
r_refdef
oldrefdef_t r_refdef
Definition: r_main.c:80
dsprite_t
Definition: qfiles.h:181
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: q_shared.c:93
LoadTGA
void LoadTGA(char *name, byte **pic, int *width, int *height)
Definition: vk_image.c:869
glpoly_s::numverts
int numverts
Definition: gl_model.h:90
RF_WEAPONMODEL
#define RF_WEAPONMODEL
Definition: q_shared.h:601
Draw_InitRGBMap
void Draw_InitRGBMap(void)
Definition: r_draw.c:174
refimport_t::Con_Printf
void(* Con_Printf)(int print_level, char *str,...)
Definition: ref.h:202
u
static int u
Definition: r_part.c:472
PRINT_ALL
#define PRINT_ALL
Definition: qcommon.h:751
R_SetFrustum
void R_SetFrustum(void)
Definition: gl_rmain.c:571
WINDOW_CLASS_NAME
#define WINDOW_CLASS_NAME
Definition: vk_imp.c:47
vk_drawPolyWarpPipeline
qvkpipeline_t vk_drawPolyWarpPipeline
Definition: vk_common.c:152
R_DrawInlineBModel
void R_DrawInlineBModel(void)
Definition: gl_rsurf.c:880
pcx_t::ymin
unsigned short ymin
Definition: qfiles.h:66
r_origin
vec3_t r_origin
Definition: vk_rmain.c:57
GL_EnableMultitexture
void GL_EnableMultitexture(qboolean enable)
Definition: gl_image.c:71
RDF_NOWORLDMODEL
#define RDF_NOWORLDMODEL
Definition: q_shared.h:622
skymaxs
float skymaxs[2][6]
Definition: gl_warp.c:302
NUM_BEAM_SEGS
#define NUM_BEAM_SEGS
scrap_texels
byte scrap_texels[MAX_SCRAPS][BLOCK_WIDTH *BLOCK_HEIGHT]
Definition: vk_image.c:591
SHADEDOT_QUANT
#define SHADEDOT_QUANT
Definition: gl_mesh.c:47
image_s::scrap
qboolean scrap
Definition: gl_local.h:97
skin
cvar_t * skin
Definition: cl_main.c:80
D_FlushCaches
void D_FlushCaches(void)
Definition: r_surf.c:481
qvktexture_t::image
VkImage image
Definition: qvk.h:79
Draw_InitLocal
void Draw_InitLocal(void)
Definition: r_draw.c:222
numleafs
int numleafs
Definition: cmodel.c:77
it_pic
@ it_pic
Definition: r_local.h:67
shadedots
float * shadedots
Definition: gl_mesh.c:52
qvkswapchain_t::format
VkFormat format
Definition: qvk.h:55
R_BlendLightmaps
void R_BlendLightmaps(void)
Definition: gl_rsurf.c:316
entity_s::alpha
float alpha
Definition: ref.h:73
viddef_t::rowbytes
int rowbytes
Definition: r_local.h:97
vid_fullscreen
cvar_t * vid_fullscreen
Definition: r_main.c:144
r
GLdouble GLdouble r
Definition: qgl_win.c:336
numvktextures
int numvktextures
Definition: vk_image.c:25
dvis_t::numclusters
int numclusters
Definition: qfiles.h:465
mplane_s::dist
float dist
Definition: r_model.h:60
R_BuildPolygonFromSurface
void R_BuildPolygonFromSurface(msurface_t *fa)
Definition: r_poly.c:1160
image_s::height
int height
Definition: r_local.h:75
viddef_t::width
unsigned width
Definition: vid.h:29
R_DrawTriangleOutlines
void R_DrawTriangleOutlines(void)
Definition: gl_rsurf.c:231
Draw_StretchPicImplementation
void Draw_StretchPicImplementation(int x, int y, int w, int h, image_t *pic)
Definition: r_draw.c:342
r_lerpmodels
cvar_t * r_lerpmodels
Definition: r_main.c:138
HDC
HDC(WINAPI *qwglGetCurrentDC)(VOID)
R_InitTextures
void R_InitTextures(void)
Definition: r_main.c:211
clipplane_s::leftedge
byte leftedge
Definition: r_local.h:383
refdef_t::num_dlights
int num_dlights
Definition: ref.h:119
DrawVkFlowingPoly
void DrawVkFlowingPoly(msurface_t *fa, image_t *texture, float *color)
Definition: vk_rsurf.c:148
R_ClearSkyBox
void R_ClearSkyBox(void)
Definition: gl_warp.c:508
clipplane_s::rightedge
byte rightedge
Definition: r_local.h:384
forward
static vec3_t forward
Definition: p_view.c:29
particle_t::alpha
float alpha
Definition: ref.h:93
DrawVkPoly
void DrawVkPoly(vkpoly_t *p, image_t *texture, float *color)
Definition: vk_rsurf.c:101
vkpoly_s::next
struct vkpoly_s * next
Definition: vk_model.h:89
RF_DEPTHHACK
#define RF_DEPTHHACK
Definition: q_shared.h:603
R_GammaCorrectAndSetPalette
void R_GammaCorrectAndSetPalette(const unsigned char *palette)
Definition: r_main.c:1257
rserr_invalid_mode
@ rserr_invalid_mode
Definition: r_local.h:108
QVk_GetUniformBuffer
uint8_t * QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet)
Definition: vk_common.c:2100
PerpendicularVector
void PerpendicularVector(vec3_t dst, const vec3_t src)
Definition: q_shared.c:152
vkstate_t::inverse_intensity
float inverse_intensity
Definition: vk_local.h:332
VectorLength
vec_t VectorLength(vec3_t v)
Definition: q_shared.c:762
msurface_s::texinfo
mtexinfo_t * texinfo
Definition: r_model.h:112
model_s::leafs
mleaf_t * leafs
Definition: r_model.h:205
t
GLdouble t
Definition: qgl_win.c:328
model_s::nodes
mnode_t * nodes
Definition: r_model.h:215
vk_swapchain
qvkswapchain_t vk_swapchain
Definition: vk_common.c:63
RDF_IRGOGGLES
#define RDF_IRGOGGLES
Definition: q_shared.h:625
min
#define min(a, b)
Definition: vk_local.h:72
model_s::mins
vec3_t mins
Definition: r_model.h:185
mleaf_s::cluster
int cluster
Definition: r_model.h:154
image_s::texnum
int texnum
Definition: gl_local.h:95
ri
refimport_t ri
Definition: gl_rmain.c:33
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
GL_Bind
void GL_Bind(int texnum)
Definition: gl_image.c:137
R_SetupGL
void R_SetupGL(void)
Definition: gl_rmain.c:705
entity_s::oldframe
int oldframe
Definition: ref.h:64
dlight_t::color
vec3_t color
Definition: ref.h:85
R_CullAliasModel
static qboolean R_CullAliasModel(vec3_t bbox[8], entity_t *e)
Definition: gl_mesh.c:373
RF_SHELL_DOUBLE
#define RF_SHELL_DOUBLE
Definition: q_shared.h:615
SURF_FLOWING
#define SURF_FLOWING
Definition: qfiles.h:375
r_newrefdef
refdef_t r_newrefdef
Definition: r_main.c:38
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:162
viddef_t::height
unsigned height
Definition: vid.h:29
SURF_TRANS33
#define SURF_TRANS33
Definition: qfiles.h:373
r_worldmodel
model_t * r_worldmodel
Definition: r_main.c:41
msurface_s::lightmapchain
struct msurface_s * lightmapchain
Definition: gl_model.h:113
vktextures
image_t vktextures[MAX_VKTEXTURES]
Definition: vk_image.c:24
r_worldmodel
model_t * r_worldmodel
Definition: r_main.c:41
pcx_t::ymax
unsigned short ymax
Definition: qfiles.h:66
cvar_s::value
float value
Definition: q_shared.h:331
entity_s::backlerp
float backlerp
Definition: ref.h:69
r_particletexture
image_t * r_particletexture
Definition: gl_rmain.c:45
MAX_OSPATH
#define MAX_OSPATH
Definition: q_shared.h:81
R_UnRegister
void R_UnRegister(void)
Definition: r_main.c:314
XCENTERING
#define XCENTERING
Definition: r_local.h:223
model_s::lightdata
byte * lightdata
Definition: r_model.h:231
R_ClipAndDrawPoly
void R_ClipAndDrawPoly(float alpha, int isturbulent, qboolean textured)
Definition: r_poly.c:1048
gl_lightmap
cvar_t * gl_lightmap
Definition: gl_rmain.c:113
modes
vkmode_t modes[]
Definition: vk_image.c:643
vk_state
vkstate_t vk_state
Definition: vk_rmain.c:31
image_s::type
imagetype_t type
Definition: r_local.h:74
Mod_Init
void Mod_Init(void)
Definition: r_model.c:78
refimport_t::FS_Gamedir
char *(* FS_Gamedir)(void)
Definition: ref.h:214
SURF_DRAWTURB
#define SURF_DRAWTURB
Definition: r_model.h:70
vkwstate_t::allowdisplaydepthchange
qboolean allowdisplaydepthchange
Definition: vk_win.h:35
VectorNormalize
vec_t VectorNormalize(vec3_t v)
Definition: q_shared.c:681
F
#define F(X, Y, Z)
Definition: md4.c:13
pcx_t::encoding
char encoding
Definition: qfiles.h:64
NULL
#define NULL
Definition: q_shared.h:67
refdef_t::time
float time
Definition: ref.h:109
r_viewcluster
int r_viewcluster
Definition: r_main.c:108
SWimp_SetMode
rserr_t SWimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen)
Definition: rw_imp.c:189
QVk_UpdateTextureData
void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uint32_t offset_x, uint32_t offset_y, uint32_t width, uint32_t height)
Definition: vk_image.c:402
upload_width
int upload_width
Definition: vk_image.c:1236
model_s::surfedges
int * surfedges
Definition: r_model.h:224
dottexture
byte dottexture[8][8]
Definition: gl_rmisc.c:29
gl_flashblend
cvar_t * gl_flashblend
Definition: gl_rmain.c:129
image_s::pixels
byte * pixels[4]
Definition: r_local.h:78
image_s::width
int width
Definition: r_local.h:75
RF_GLOW
#define RF_GLOW
Definition: q_shared.h:608
QVk_UpdateTextureData
void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uint32_t offset_x, uint32_t offset_y, uint32_t width, uint32_t height)
Definition: vk_image.c:402
intensitytable
static byte intensitytable[256]
Definition: vk_image.c:30
GL_SetTexturePalette
void GL_SetTexturePalette(unsigned palette[256])
Definition: gl_image.c:48
thepalette
byte * thepalette
Definition: r_main.c:33
image_s::tl
float tl
Definition: gl_local.h:96
particle_t
Definition: ref.h:89
pcx_t::palette_type
unsigned short palette_type
Definition: qfiles.h:72
alpha
GLfloat GLfloat GLfloat alpha
Definition: qgl_win.c:74
refdef_t::height
int height
Definition: ref.h:104
ClipSkyPolygon
void ClipSkyPolygon(int nump, vec3_t vecs, int stage)
Definition: gl_warp.c:389
image_s::name
char name[MAX_QPATH]
Definition: r_local.h:73
image_s::transparent
qboolean transparent
Definition: r_local.h:76
intensity
cvar_t * intensity
Definition: vk_image.c:33
MAX_MD2SKINS
#define MAX_MD2SKINS
Definition: qfiles.h:92
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:744
MYgluPerspective
void MYgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
Definition: gl_rmain.c:682
dsprite_t::frames
dsprframe_t frames[1]
Definition: qfiles.h:185
RecursiveLightPoint
int RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
Definition: r_light.c:120
Q_stricmp
int Q_stricmp(char *s1, char *s2)
Definition: q_shared.c:1180
it_skin
@ it_skin
Definition: r_local.h:64
GL_DrawAliasFrameLerp
void GL_DrawAliasFrameLerp(dmdl_t *paliashdr, float backlerp)
Definition: gl_mesh.c:90
d_pzbuffer
short * d_pzbuffer
Definition: r_main.c:197
pcx_t::bits_per_pixel
char bits_per_pixel
Definition: qfiles.h:65
r_lightlevel
cvar_t * r_lightlevel
Definition: r_main.c:142
dsprframe_t::width
int width
Definition: qfiles.h:176
qvkpipeline_t::layout
VkPipelineLayout layout
Definition: qvk.h:154
particle_t::origin
vec3_t origin
Definition: ref.h:91
name
cvar_t * name
Definition: cl_main.c:79
REF_VERSION
#define REF_VERSION
Definition: r_local.h:36
MAXLIGHTMAPS
#define MAXLIGHTMAPS
Definition: qfiles.h:409
R_DrawWorld
void R_DrawWorld(void)
Definition: gl_rsurf.c:1197
R_DrawSkyBox
void R_DrawSkyBox(void)
Definition: gl_warp.c:562
ERR_FATAL
#define ERR_FATAL
Definition: qcommon.h:743
vright
vec3_t vright
Definition: vk_rmain.c:56
msurface_s::flags
int flags
Definition: r_model.h:101
qvktexture_t::mipLevels
uint32_t mipLevels
Definition: qvk.h:88
pcx_t::xmin
unsigned short xmin
Definition: qfiles.h:66
swstate_s::prev_mode
int prev_mode
Definition: r_local.h:881
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:164
vkpoly_s::numverts
int numverts
Definition: vk_model.h:91
model_s::maxs
vec3_t maxs
Definition: r_model.h:185
s
static fixed16_t s
Definition: r_scan.c:30
model_s::radius
float radius
Definition: gl_model.h:189
y
GLint y
Definition: qgl_win.c:115
sw_mode
cvar_t * sw_mode
Definition: r_main.c:125
R_IMFlatShadedQuad
void R_IMFlatShadedQuad(vec3_t a, vec3_t b, vec3_t c, vec3_t d, int color, float alpha)
Definition: r_poly.c:1381
msurface_s::polys
glpoly_t * polys
Definition: gl_model.h:111
R_Flash
void R_Flash(void)
Definition: gl_rmain.c:806
gl_lms
static gllightmapstate_t gl_lms
Definition: gl_rsurf.c:59
r_nocull
cvar_t * r_nocull
Definition: gl_rmain.c:85
BLOCK_HEIGHT
#define BLOCK_HEIGHT
Definition: vk_image.c:588
entity_s::frame
int frame
Definition: ref.h:58
R_FloodFillSkin
void R_FloodFillSkin(byte *skin, int skinwidth, int skinheight)
Definition: vk_image.c:1091
gllightmapstate_t::lightmap_surfaces
msurface_t * lightmap_surfaces[MAX_LIGHTMAPS]
Definition: gl_rsurf.c:50
rserr_invalid_fullscreen
@ rserr_invalid_fullscreen
Definition: vk_local.h:130
R_RecursiveWorldNode
void R_RecursiveWorldNode(mnode_t *node)
Definition: gl_rsurf.c:1036
Draw_BuildGammaTable
void Draw_BuildGammaTable(void)
Definition: r_main.c:1314
zFar
GLclampd zFar
Definition: qgl_win.c:125
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:165
currentmodel
model_t * currentmodel
Definition: gl_rmain.c:48
R_EdgeCodeStart
void R_EdgeCodeStart(void)
model_s::skins
image_t * skins[MAX_MD2SKINS]
Definition: r_model.h:234
MAX_LIGHTMAPS
#define MAX_LIGHTMAPS
Definition: gl_rsurf.c:38
QVk_EndFrame
VkResult QVk_EndFrame(qboolean force)
Definition: vk_common.c:1880
refdef_t::lightstyles
lightstyle_t * lightstyles
Definition: ref.h:114
loadmodel
model_t * loadmodel
Definition: r_model.c:27
R_InitTurb
void R_InitTurb(void)
Definition: r_main.c:246
sc_base
surfcache_t * sc_base
Definition: r_local.h:813
image_s::upload_width
int upload_width
Definition: gl_local.h:92
MAX_VERTS
#define MAX_VERTS
Definition: qfiles.h:90
d_8to24table
unsigned d_8to24table[256]
Definition: r_main.c:27
vec3_origin
vec3_t vec3_origin
Definition: q_shared.c:24
R_RenderDlights
void R_RenderDlights(void)
Definition: gl_light.c:77
c_alias_polys
int c_alias_polys
Definition: gl_local.h:157
model_s::name
char name[MAX_QPATH]
Definition: r_model.h:173
QVk_ReadPixels
void QVk_ReadPixels(uint8_t *dstBuffer, uint32_t width, uint32_t height)
Definition: vk_image.c:465
QVk_BindPipeline
void QVk_BindPipeline(qvkpipeline_t *pipeline)
Definition: vk_common.c:2284
R_CullBox
qboolean R_CullBox(vec3_t mins, vec3_t maxs)
Definition: gl_rmain.c:151
msurface_s::light_s
int light_s
Definition: gl_model.h:108
image_s::sl
float sl
Definition: gl_local.h:96
Mat_Translate
void Mat_Translate(float *matrix, float x, float y, float z)
Definition: vk_rmain.c:718
skytexorder
int skytexorder[6]
Definition: gl_warp.c:561
mnode_s::contents
int contents
Definition: r_model.h:126
mnode_s::firstsurface
unsigned short firstsurface
Definition: r_model.h:137
up
static vec3_t up
Definition: p_view.c:29
r_warpbuffer
byte * r_warpbuffer
Definition: r_main.c:45
vid_gamma
cvar_t * vid_gamma
Definition: vid_dll.c:43
r_newrefdef
refdef_t r_newrefdef
Definition: gl_rmain.c:75
dsprite_t::numframes
int numframes
Definition: qfiles.h:184
EmitWaterPolys
void EmitWaterPolys(msurface_t *fa)
Definition: gl_warp.c:211
vkstate_t::camera_separation
float camera_separation
Definition: vk_local.h:344
rserr_ok
@ rserr_ok
Definition: r_local.h:105
r_speeds
cvar_t * r_speeds
Definition: gl_rmain.c:82
pdest
static byte * pdest
Definition: r_part.c:470
dlight_t
Definition: ref.h:82
dsprframe_t::origin_y
int origin_y
Definition: qfiles.h:177
SWimp_Init
int SWimp_Init(void *hInstance, void *wndProc)
Definition: rw_imp.c:118
R_SetCacheState
void R_SetCacheState(msurface_t *surf)
Definition: gl_light.c:437
entity_s
Definition: ref.h:49
view_clipplanes
clipplane_t view_clipplanes[4]
Definition: r_rast.c:38
RF_FULLBRIGHT
#define RF_FULLBRIGHT
Definition: q_shared.h:602
vk_bitdepth
cvar_t * vk_bitdepth
Definition: vk_rmain.c:92
GL_TexEnv
void GL_TexEnv(GLenum mode)
Definition: gl_image.c:126
vkwstate_t::hWnd
HWND hWnd
Definition: vk_win.h:32
model_s::surfaces
msurface_t * surfaces
Definition: r_model.h:221
currententity
entity_t * currententity
Definition: gl_rmain.c:47
vup
vec3_t vup
Definition: gl_rmain.c:64
shadelight
float shadelight[3]
Definition: gl_mesh.c:44
medge_t::v
unsigned short v[2]
Definition: r_model.h:79
mnode_s::plane
mplane_t * plane
Definition: r_model.h:134
c_visible_textures
int c_visible_textures
Definition: gl_rsurf.c:41
DrawTextureChains
void DrawTextureChains(void)
Definition: gl_rsurf.c:635
VectorMA
void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
Definition: q_shared.c:719
model_s::numleafs
int numleafs
Definition: r_model.h:204
msurface_s::lightmaptexturenum
int lightmaptexturenum
Definition: gl_model.h:121
pcx_t::manufacturer
char manufacturer
Definition: qfiles.h:62
r_rawpalette
unsigned r_rawpalette[256]
Definition: gl_rmain.c:1572
r_dlightframecount
int r_dlightframecount
Definition: r_light.c:24
refdef_t::fov_y
float fov_y
Definition: ref.h:105
particle_t::color
int color
Definition: ref.h:92
vkwstate_t::log_fp
FILE * log_fp
Definition: vk_win.h:36
R_DrawEntitiesOnList
void R_DrawEntitiesOnList(void)
Definition: gl_rmain.c:324
msurface_s
Definition: r_model.h:93
Vk_LoadWal
image_t * Vk_LoadWal(char *name)
Definition: vk_image.c:1477
mplane_s
Definition: r_model.h:57
pcx_t::vres
unsigned short vres
Definition: qfiles.h:67
dsprframe_t
Definition: qfiles.h:174
mtexinfo_s::flags
int flags
Definition: r_model.h:88
vk_rawTexture
qvktexture_t vk_rawTexture
Definition: vk_image.c:28
model_s::numnodes
int numnodes
Definition: r_model.h:213
rserr_ok
@ rserr_ok
Definition: vk_local.h:128
R_EdgeCodeEnd
void R_EdgeCodeEnd(void)
refdef_t::dlights
dlight_t * dlights
Definition: ref.h:120
vk_surface
VkSurfaceKHR vk_surface
Definition: vk_common.c:47
R_RotateForEntity
void R_RotateForEntity(entity_t *e)
Definition: gl_rmain.c:165
refdef_t::width
int width
Definition: ref.h:104
R_TextureAnimation
image_t * R_TextureAnimation(mtexinfo_t *tex)
Definition: vk_rsurf.c:79
texture
GLuint texture
Definition: qgl_win.c:68
ri
refimport_t ri
Definition: r_main.c:25
image_s::upload_height
int upload_height
Definition: gl_local.h:92
vk_current_lmap_sampler
qvksampler_t vk_current_lmap_sampler
Definition: vk_image.c:43
R_DrawAlphaSurfaces
void R_DrawAlphaSurfaces(void)
Definition: r_poly.c:1342
Draw_FindPic
image_t * Draw_FindPic(char *name)
Definition: r_draw.c:37
r_particletexture
image_t * r_particletexture
Definition: vk_rmain.c:34
RF_SHELL_BLUE
#define RF_SHELL_BLUE
Definition: q_shared.h:611
R_DrawParticles
void R_DrawParticles(void)
Definition: gl_rmain.c:475
lightstyle_t::white
float white
Definition: ref.h:99
dsprframe_t::origin_x
int origin_x
Definition: qfiles.h:177
w
GLdouble GLdouble GLdouble w
Definition: qgl_win.c:291
top
GLdouble GLdouble GLdouble top
Definition: qgl_win.c:159
right
GLdouble right
Definition: qgl_win.c:159
registration_sequence
int registration_sequence
Definition: r_model.c:44
MAX_CLIP_VERTS
#define MAX_CLIP_VERTS
Definition: gl_warp.c:388
rserr_t
rserr_t
Definition: vk_local.h:126
refimport_t::Cvar_SetValue
void(* Cvar_SetValue)(char *name, float value)
Definition: ref.h:218
image_s
Definition: r_local.h:71
sw_state
swstate_t sw_state
Definition: r_main.c:49
particles
cparticle_t particles[MAX_PARTICLES]
Definition: cl_fx.c:887
gammatable
static unsigned char gammatable[256]
Definition: vk_image.c:31
mode
GLenum mode
Definition: qgl_win.c:113
msurface_s::dlightbits
int dlightbits
Definition: r_model.h:98
R_MarkLeaves
void R_MarkLeaves(void)
Definition: r_main.c:467
YCENTERING
#define YCENTERING
Definition: r_local.h:224
upload_height
int upload_height
Definition: vk_image.c:1236
viddef_t::colormap
pixel_t * colormap
Definition: r_local.h:95
pcx_t::xmax
unsigned short xmax
Definition: qfiles.h:66
rserr_unknown
@ rserr_unknown
Definition: vk_local.h:133
mnode_s::numsurfaces
unsigned short numsurfaces
Definition: r_model.h:138
frustum
cplane_t frustum[4]
Definition: gl_rmain.c:50
model_s::vertexes
mvertex_t * vertexes
Definition: r_model.h:208
warpface
msurface_t * warpface
Definition: vk_warp.c:31
c_brush_polys
int c_brush_polys
Definition: gl_rmain.c:55
vkwstate_t::hInstance
HINSTANCE hInstance
Definition: vk_win.h:30
gldepthmin
float gldepthmin
Definition: gl_rmain.c:39
GL_SelectTexture
void GL_SelectTexture(GLenum texture)
Definition: gl_image.c:92
imagetype_t
imagetype_t
Definition: vk_local.h:99
viddef_t::alphamap
pixel_t * alphamap
Definition: r_local.h:96
vkstate_t::fullscreen
qboolean fullscreen
Definition: vk_local.h:333
R_BeginFrame
void R_BeginFrame(float camera_separation)
Definition: r_main.c:1177
Mod_ClusterPVS
byte * Mod_ClusterPVS(int cluster, model_t *model)
Definition: r_model.c:268
rserr_invalid_fullscreen
@ rserr_invalid_fullscreen
Definition: r_local.h:107
skymins
float skymins[2][6]
Definition: gl_warp.c:302
QVVKTEXTURE_CLEAR
#define QVVKTEXTURE_CLEAR(i)
Definition: qvk.h:104
gl_monolightmap
cvar_t * gl_monolightmap
Definition: gl_rmain.c:117
entity_s::oldorigin
float oldorigin[3]
Definition: ref.h:63
dlight_t::intensity
float intensity
Definition: ref.h:86
TRANSPARENT_COLOR
#define TRANSPARENT_COLOR
Definition: asm_i386.h:78
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:134
draw_chars
image_t * draw_chars
Definition: r_draw.c:26
Com_sprintf
void Com_sprintf(char *dest, int size, char *fmt,...)
Definition: q_shared.c:1223
it_skin
@ it_skin
Definition: vk_local.h:101
dmdl_t
Definition: qfiles.h:137
entity_s::angles
float angles[3]
Definition: ref.h:52
LoadPCX
void LoadPCX(char *filename, byte **pic, byte **palette, int *width, int *height)
Definition: r_image.c:87
RotatePointAroundVector
void RotatePointAroundVector(vec3_t dst, const vec3_t dir, const vec3_t point, float degrees)
Definition: q_shared.c:32
dmdl_t::num_frames
int num_frames
Definition: qfiles.h:151
NUM_VK_MODES
#define NUM_VK_MODES
Definition: vk_image.c:650
msurface_s::firstedge
int firstedge
Definition: r_model.h:103
SURF_SKY
#define SURF_SKY
Definition: qfiles.h:371
vright
vec3_t vright
Definition: gl_rmain.c:66
rserr_invalid_mode
@ rserr_invalid_mode
Definition: vk_local.h:131
r_customwidth
cvar_t * r_customwidth
Definition: r_main.c:151
pcx_t::bytes_per_line
unsigned short bytes_per_line
Definition: qfiles.h:71
image_s::sh
float sh
Definition: gl_local.h:96
Mat_Mul
void Mat_Mul(float *m1, float *m2, float *res)
Definition: vk_rmain.c:695
it_sky
@ it_sky
Definition: r_local.h:68
glpoly_s
Definition: gl_model.h:86
vid
viddef_t vid
Definition: r_main.c:24
MAX_PARTICLES
#define MAX_PARTICLES
Definition: ref.h:27