vkQuake2 doxygen  1.0 dev
vk_warp.c
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 Copyright (C) 2018-2019 Krzysztof Kondrak
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 
14 See the GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 
20 */
21 // vk_warp.c -- sky and water polygons
22 #include "vk_local.h"
23 
24 extern model_t *loadmodel;
25 
27 float skyrotate;
30 
32 
33 #define SUBDIVIDE_SIZE 64
34 //#define SUBDIVIDE_SIZE 1024
35 
36 void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
37 {
38  int i, j;
39  float *v;
40 
41  mins[0] = mins[1] = mins[2] = 9999;
42  maxs[0] = maxs[1] = maxs[2] = -9999;
43  v = verts;
44  for (i=0 ; i<numverts ; i++)
45  for (j=0 ; j<3 ; j++, v++)
46  {
47  if (*v < mins[j])
48  mins[j] = *v;
49  if (*v > maxs[j])
50  maxs[j] = *v;
51  }
52 }
53 
54 void SubdividePolygon (int numverts, float *verts)
55 {
56  int i, j, k;
57  vec3_t mins, maxs;
58  float m;
59  float *v;
60  vec3_t front[64], back[64];
61  int f, b;
62  float dist[64];
63  float frac;
64  vkpoly_t *poly;
65  float s, t;
66  vec3_t total;
67  float total_s, total_t;
68 
69  if (numverts > 60)
70  ri.Sys_Error (ERR_DROP, "numverts = %i", numverts);
71 
72  BoundPoly (numverts, verts, mins, maxs);
73 
74  for (i=0 ; i<3 ; i++)
75  {
76  m = (mins[i] + maxs[i]) * 0.5;
77  m = SUBDIVIDE_SIZE * floor (m/SUBDIVIDE_SIZE + 0.5);
78  if (maxs[i] - m < 8)
79  continue;
80  if (m - mins[i] < 8)
81  continue;
82 
83  // cut it
84  v = verts + i;
85  for (j=0 ; j<numverts ; j++, v+= 3)
86  dist[j] = *v - m;
87 
88  // wrap cases
89  dist[j] = dist[0];
90  v-=i;
91  VectorCopy (verts, v);
92 
93  f = b = 0;
94  v = verts;
95  for (j=0 ; j<numverts ; j++, v+= 3)
96  {
97  if (dist[j] >= 0)
98  {
99  VectorCopy (v, front[f]);
100  f++;
101  }
102  if (dist[j] <= 0)
103  {
104  VectorCopy (v, back[b]);
105  b++;
106  }
107  if (dist[j] == 0 || dist[j+1] == 0)
108  continue;
109  if ( (dist[j] > 0) != (dist[j+1] > 0) )
110  {
111  // clip point
112  frac = dist[j] / (dist[j] - dist[j+1]);
113  for (k=0 ; k<3 ; k++)
114  front[f][k] = back[b][k] = v[k] + frac*(v[3+k] - v[k]);
115  f++;
116  b++;
117  }
118  }
119 
120  SubdividePolygon (f, front[0]);
121  SubdividePolygon (b, back[0]);
122  return;
123  }
124 
125  // add a point in the center to help keep warp valid
126  poly = Hunk_Alloc (sizeof(vkpoly_t) + ((numverts-4)+2) * VERTEXSIZE*sizeof(float));
127  poly->next = warpface->polys;
128  warpface->polys = poly;
129  poly->numverts = numverts+2;
130  VectorClear (total);
131  total_s = 0;
132  total_t = 0;
133  for (i=0 ; i<numverts ; i++, verts+= 3)
134  {
135  VectorCopy (verts, poly->verts[i+1]);
136  s = DotProduct (verts, warpface->texinfo->vecs[0]);
137  t = DotProduct (verts, warpface->texinfo->vecs[1]);
138 
139  total_s += s;
140  total_t += t;
141  VectorAdd (total, verts, total);
142 
143  poly->verts[i+1][3] = s;
144  poly->verts[i+1][4] = t;
145  }
146 
147  VectorScale (total, (1.0/numverts), poly->verts[0]);
148  poly->verts[0][3] = total_s/numverts;
149  poly->verts[0][4] = total_t/numverts;
150 
151  // copy first vertex to last
152  memcpy (poly->verts[i+1], poly->verts[1], sizeof(poly->verts[0]));
153 }
154 
155 /*
156 ================
157 Vk_SubdivideSurface
158 
159 Breaks a polygon up along axial 64 unit
160 boundaries so that turbulent and sky warps
161 can be done reasonably.
162 ================
163 */
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 }
192 
193 //=========================================================
194 
195 /*
196 =============
197 EmitWaterPolys
198 
199 Does a water warp on the pre-fragmented glpoly_t chain
200 =============
201 */
202 void EmitWaterPolys (msurface_t *fa, image_t *texture, float *modelMatrix, float *color)
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 }
275 
276 
277 //===================================================================
278 
279 
281  {1,1,0},
282  {1,-1,0},
283  {0,-1,1},
284  {0,1,1},
285  {1,0,1},
286  {-1,0,1}
287 };
288 int c_sky;
289 
290 // 1 = s, 2 = t, 3 = 2048
291 int st_to_vec[6][3] =
292 {
293  {3,-1,2},
294  {-3,1,2},
295 
296  {1,3,2},
297  {-1,-3,2},
298 
299  {-2,-1,3}, // 0 degrees yaw, look straight up
300  {2,-1,-3} // look straight down
301 
302 // {-1,2,3},
303 // {1,2,-3}
304 };
305 
306 // s = [0]/[2], t = [1]/[2]
307 int vec_to_st[6][3] =
308 {
309  {-2,3,1},
310  {2,3,-1},
311 
312  {1,3,2},
313  {-1,3,-2},
314 
315  {-2,-1,3},
316  {-2,1,-3}
317 
318 // {-1,2,3},
319 // {1,2,-3}
320 };
321 
322 float skymins[2][6], skymaxs[2][6];
324 
325 void DrawSkyPolygon (int nump, vec3_t vecs)
326 {
327  int i,j;
328  vec3_t v, av;
329  float s, t, dv;
330  int axis;
331  float *vp;
332 
333  c_sky++;
334 
335  // decide which face it maps to
337  for (i=0, vp=vecs ; i<nump ; i++, vp+=3)
338  {
339  VectorAdd (vp, v, v);
340  }
341  av[0] = fabs(v[0]);
342  av[1] = fabs(v[1]);
343  av[2] = fabs(v[2]);
344  if (av[0] > av[1] && av[0] > av[2])
345  {
346  if (v[0] < 0)
347  axis = 1;
348  else
349  axis = 0;
350  }
351  else if (av[1] > av[2] && av[1] > av[0])
352  {
353  if (v[1] < 0)
354  axis = 3;
355  else
356  axis = 2;
357  }
358  else
359  {
360  if (v[2] < 0)
361  axis = 5;
362  else
363  axis = 4;
364  }
365 
366  // project new texture coords
367  for (i=0 ; i<nump ; i++, vecs+=3)
368  {
369  j = vec_to_st[axis][2];
370  if (j > 0)
371  dv = vecs[j - 1];
372  else
373  dv = -vecs[-j - 1];
374  if (dv < 0.001)
375  continue; // don't divide by zero
376  j = vec_to_st[axis][0];
377  if (j < 0)
378  s = -vecs[-j -1] / dv;
379  else
380  s = vecs[j-1] / dv;
381  j = vec_to_st[axis][1];
382  if (j < 0)
383  t = -vecs[-j -1] / dv;
384  else
385  t = vecs[j-1] / dv;
386 
387  if (s < skymins[0][axis])
388  skymins[0][axis] = s;
389  if (t < skymins[1][axis])
390  skymins[1][axis] = t;
391  if (s > skymaxs[0][axis])
392  skymaxs[0][axis] = s;
393  if (t > skymaxs[1][axis])
394  skymaxs[1][axis] = t;
395  }
396 }
397 
398 #define ON_EPSILON 0.1 // point on plane side epsilon
399 #define MAX_CLIP_VERTS 64
400 void ClipSkyPolygon (int nump, vec3_t vecs, int stage)
401 {
402  float *norm;
403  float *v;
404  qboolean front, back;
405  float d, e;
406  float dists[MAX_CLIP_VERTS];
407  int sides[MAX_CLIP_VERTS];
408  vec3_t newv[2][MAX_CLIP_VERTS];
409  int newc[2];
410  int i, j;
411 
412  if (nump > MAX_CLIP_VERTS-2)
413  ri.Sys_Error (ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS");
414  if (stage == 6)
415  { // fully clipped, so draw it
416  DrawSkyPolygon (nump, vecs);
417  return;
418  }
419 
420  front = back = false;
421  norm = skyclip[stage];
422  for (i=0, v = vecs ; i<nump ; i++, v+=3)
423  {
424  d = DotProduct (v, norm);
425  if (d > ON_EPSILON)
426  {
427  front = true;
428  sides[i] = SIDE_FRONT;
429  }
430  else if (d < -ON_EPSILON)
431  {
432  back = true;
433  sides[i] = SIDE_BACK;
434  }
435  else
436  sides[i] = SIDE_ON;
437  dists[i] = d;
438  }
439 
440  if (!front || !back)
441  { // not clipped
442  ClipSkyPolygon (nump, vecs, stage+1);
443  return;
444  }
445 
446  // clip it
447  sides[i] = sides[0];
448  dists[i] = dists[0];
449  VectorCopy (vecs, (vecs+(i*3)) );
450  newc[0] = newc[1] = 0;
451 
452  for (i=0, v = vecs ; i<nump ; i++, v+=3)
453  {
454  switch (sides[i])
455  {
456  case SIDE_FRONT:
457  VectorCopy (v, newv[0][newc[0]]);
458  newc[0]++;
459  break;
460  case SIDE_BACK:
461  VectorCopy (v, newv[1][newc[1]]);
462  newc[1]++;
463  break;
464  case SIDE_ON:
465  VectorCopy (v, newv[0][newc[0]]);
466  newc[0]++;
467  VectorCopy (v, newv[1][newc[1]]);
468  newc[1]++;
469  break;
470  }
471 
472  if (sides[i] == SIDE_ON || sides[i+1] == SIDE_ON || sides[i+1] == sides[i])
473  continue;
474 
475  d = dists[i] / (dists[i] - dists[i+1]);
476  for (j=0 ; j<3 ; j++)
477  {
478  e = v[j] + d*(v[j+3] - v[j]);
479  newv[0][newc[0]][j] = e;
480  newv[1][newc[1]][j] = e;
481  }
482  newc[0]++;
483  newc[1]++;
484  }
485 
486  // continue
487  ClipSkyPolygon (newc[0], newv[0][0], stage+1);
488  ClipSkyPolygon (newc[1], newv[1][0], stage+1);
489 }
490 
491 /*
492 =================
493 R_AddSkySurface
494 =================
495 */
497 {
498  int i;
499  vec3_t verts[MAX_CLIP_VERTS];
500  vkpoly_t *p;
501 
502  // calculate vertex values for sky box
503  for (p=fa->polys ; p ; p=p->next)
504  {
505  for (i=0 ; i<p->numverts ; i++)
506  {
507  VectorSubtract (p->verts[i], r_origin, verts[i]);
508  }
509  ClipSkyPolygon (p->numverts, verts[0], 0);
510  }
511 }
512 
513 
514 /*
515 ==============
516 R_ClearSkyBox
517 ==============
518 */
519 void R_ClearSkyBox (void)
520 {
521  int i;
522 
523  for (i=0 ; i<6 ; i++)
524  {
525  skymins[0][i] = skymins[1][i] = 9999;
526  skymaxs[0][i] = skymaxs[1][i] = -9999;
527  }
528 }
529 
530 
531 void MakeSkyVec (float s, float t, int axis, float *vertexData)
532 {
533  vec3_t v, b;
534  int j, k;
535 
536  b[0] = s * 2300;
537  b[1] = t * 2300;
538  b[2] = 2300;
539 
540  for (j = 0; j<3; j++)
541  {
542  k = st_to_vec[axis][j];
543  if (k < 0)
544  v[j] = -b[-k - 1];
545  else
546  v[j] = b[k - 1];
547  }
548 
549  // avoid bilerp seam
550  s = (s + 1)*0.5;
551  t = (t + 1)*0.5;
552 
553  if (s < sky_min)
554  s = sky_min;
555  else if (s > sky_max)
556  s = sky_max;
557  if (t < sky_min)
558  t = sky_min;
559  else if (t > sky_max)
560  t = sky_max;
561 
562  t = 1.0 - t;
563 
564  vertexData[0] = v[0];
565  vertexData[1] = v[1];
566  vertexData[2] = v[2];
567  vertexData[3] = s;
568  vertexData[4] = t;
569 }
570 
571 /*
572 ==============
573 R_DrawSkyBox
574 ==============
575 */
576 int skytexorder[6] = {0,2,1,3,4,5};
577 void R_DrawSkyBox (void)
578 {
579  int i;
580 
581  if (skyrotate)
582  { // check for no sky at all
583  for (i = 0; i<6; i++)
584  if (skymins[0][i] < skymaxs[0][i]
585  && skymins[1][i] < skymaxs[1][i])
586  break;
587  if (i == 6)
588  return; // nothing visible
589  }
590 
591  float model[16];
592  Mat_Identity(model);
594  Mat_Translate(model, r_origin[0], r_origin[1], r_origin[2]);
595 
596  struct {
597  float data[5];
598  } skyVerts[4];
599 
601  uint32_t uboOffset;
602  VkDescriptorSet uboDescriptorSet;
603  uint8_t *uboData = QVk_GetUniformBuffer(sizeof(model), &uboOffset, &uboDescriptorSet);
604  memcpy(uboData, model, sizeof(model));
605 
606  for (i = 0; i<6; i++)
607  {
608  if (skyrotate)
609  { // hack, forces full sky to draw when rotating
610  skymins[0][i] = -1;
611  skymins[1][i] = -1;
612  skymaxs[0][i] = 1;
613  skymaxs[1][i] = 1;
614  }
615 
616  if (skymins[0][i] >= skymaxs[0][i]
617  || skymins[1][i] >= skymaxs[1][i])
618  continue;
619 
620  MakeSkyVec(skymins[0][i], skymins[1][i], i, skyVerts[0].data);
621  MakeSkyVec(skymins[0][i], skymaxs[1][i], i, skyVerts[1].data);
622  MakeSkyVec(skymaxs[0][i], skymaxs[1][i], i, skyVerts[2].data);
623  MakeSkyVec(skymaxs[0][i], skymins[1][i], i, skyVerts[3].data);
624 
625  float verts[] = {
626  skyVerts[0].data[0], skyVerts[0].data[1], skyVerts[0].data[2], skyVerts[0].data[3], skyVerts[0].data[4],
627  skyVerts[1].data[0], skyVerts[1].data[1], skyVerts[1].data[2], skyVerts[1].data[3], skyVerts[1].data[4],
628  skyVerts[2].data[0], skyVerts[2].data[1], skyVerts[2].data[2], skyVerts[2].data[3], skyVerts[2].data[4],
629  skyVerts[0].data[0], skyVerts[0].data[1], skyVerts[0].data[2], skyVerts[0].data[3], skyVerts[0].data[4],
630  skyVerts[2].data[0], skyVerts[2].data[1], skyVerts[2].data[2], skyVerts[2].data[3], skyVerts[2].data[4],
631  skyVerts[3].data[0], skyVerts[3].data[1], skyVerts[3].data[2], skyVerts[3].data[3], skyVerts[3].data[4]
632  };
633 
634  VkBuffer vbo;
635  VkDeviceSize vboOffset;
636  uint8_t *vertData = QVk_GetVertexBuffer(sizeof(verts), &vbo, &vboOffset);
637  memcpy(vertData, verts, sizeof(verts));
638 
639  VkDescriptorSet descriptorSets[] = { sky_images[skytexorder[i]]->vk_texture.descriptorSet, uboDescriptorSet };
640  vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawSkyboxPipeline.layout, 0, 2, descriptorSets, 1, &uboOffset);
641  vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1, &vbo, &vboOffset);
642  vkCmdDraw(vk_activeCmdbuffer, 6, 1, 0, 0);
643  }
644 }
645 
646 
647 /*
648 ============
649 R_SetSky
650 ============
651 */
652 // 3dstudio environment map names
653 char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
654 void R_SetSky (char *name, float rotate, vec3_t axis)
655 {
656  int i;
657  char pathname[MAX_QPATH];
658 
659  strncpy(skyname, name, sizeof(skyname) - 1);
660  skyrotate = rotate;
661  VectorCopy(axis, skyaxis);
662 
663  for (i = 0; i<6; i++)
664  {
665  // chop down rotating skies for less memory
666  if (vk_skymip->value || skyrotate)
667  vk_picmip->value++;
668 
669  Com_sprintf(pathname, sizeof(pathname), "env/%s%s.tga", skyname, suf[i]);
670 
671  sky_images[i] = Vk_FindImage(pathname, it_sky, NULL);
672  if (!sky_images[i])
674 
675  if (vk_skymip->value || skyrotate)
676  { // take less memory
677  vk_picmip->value--;
678  sky_min = 1.0 / 256;
679  sky_max = 255.0 / 256;
680  }
681  else
682  {
683  sky_min = 1.0 / 512;
684  sky_max = 511.0 / 512;
685  }
686  }
687 }
image_s::vk_texture
qvktexture_t vk_texture
Definition: vk_local.h:116
SubdividePolygon
void SubdividePolygon(int numverts, float *verts)
Definition: vk_warp.c:54
vk_skymip
cvar_t * vk_skymip
Definition: vk_rmain.c:95
MAX_QPATH
#define MAX_QPATH
Definition: q_shared.h:80
vk_local.h
vk_drawSkyboxPipeline
qvkpipeline_t vk_drawSkyboxPipeline
Definition: vk_common.c:154
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:163
r_notexture
image_t * r_notexture
Definition: gl_rmain.c:44
SUBDIVIDE_SIZE
#define SUBDIVIDE_SIZE
Definition: vk_warp.c:33
ri
refimport_t ri
Definition: r_main.c:25
SIDE_FRONT
#define SIDE_FRONT
Definition: r_model.h:50
sky_max
float sky_max
Definition: vk_warp.c:323
v
GLdouble v
Definition: qgl_win.c:143
BoundPoly
void BoundPoly(int numverts, float *verts, vec3_t mins, vec3_t maxs)
Definition: vk_warp.c:36
model_s::edges
medge_t * edges
Definition: r_model.h:211
vkpoly_s::verts
float verts[4][VERTEXSIZE]
Definition: vk_model.h:93
VERTEXSIZE
#define VERTEXSIZE
Definition: gl_model.h:84
VectorScale
void VectorScale(vec3_t in, vec_t scale, vec3_t out)
Definition: q_shared.c:782
qboolean
qboolean
Definition: q_shared.h:63
QVk_GetTriangleFanIbo
VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount)
Definition: vk_common.c:2198
EmitWaterPolys
void EmitWaterPolys(msurface_t *fa, image_t *texture, float *modelMatrix, float *color)
Definition: vk_warp.c:202
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
SIDE_BACK
#define SIDE_BACK
Definition: r_model.h:51
model_s
Definition: r_model.h:171
skyclip
vec3_t skyclip[6]
Definition: vk_warp.c:280
r_origin
vec3_t r_origin
Definition: r_main.c:75
vkpoly_s
Definition: vk_model.h:87
st_to_vec
int st_to_vec[6][3]
Definition: vk_warp.c:291
dv
static float dv
Definition: r_scan.c:31
vec_to_st
int vec_to_st[6][3]
Definition: vk_warp.c:307
ClipSkyPolygon
void ClipSkyPolygon(int nump, vec3_t vecs, int stage)
Definition: vk_warp.c:400
j
GLint j
Definition: qgl_win.c:150
QVk_GetVertexBuffer
uint8_t * QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset)
Definition: vk_common.c:2019
mvertex_t::position
vec3_t position
Definition: r_model.h:47
Mat_Identity
void Mat_Identity(float *matrix)
Definition: vk_rmain.c:675
qvktexture_t::descriptorSet
VkDescriptorSet descriptorSet
Definition: qvk.h:87
vk_drawPolyWarpPipeline
qvkpipeline_t vk_drawPolyWarpPipeline
Definition: vk_common.c:152
MAX_CLIP_VERTS
#define MAX_CLIP_VERTS
Definition: vk_warp.c:399
sky_images
image_t * sky_images[6]
Definition: vk_warp.c:29
vkpoly_s::next
struct vkpoly_s * next
Definition: vk_model.h:89
QVk_GetUniformBuffer
uint8_t * QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet)
Definition: vk_common.c:2100
suf
char * suf[6]
Definition: vk_warp.c:653
msurface_s::texinfo
mtexinfo_t * texinfo
Definition: r_model.h:112
skyrotate
float skyrotate
Definition: vk_warp.c:27
t
GLdouble t
Definition: qgl_win.c:328
Mat_Rotate
void Mat_Rotate(float *matrix, float deg, float x, float y, float z)
Definition: vk_rmain.c:728
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
Vk_SubdivideSurface
void Vk_SubdivideSurface(msurface_t *fa)
Definition: vk_warp.c:164
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
cvar_s::value
float value
Definition: q_shared.h:331
Vk_FindImage
image_t * Vk_FindImage(char *name, imagetype_t type, qvksampler_t *samplerType)
Definition: vk_image.c:1508
NULL
#define NULL
Definition: q_shared.h:67
refdef_t::time
float time
Definition: ref.h:109
model_s::surfedges
int * surfedges
Definition: r_model.h:224
ERR_DROP
#define ERR_DROP
Definition: qcommon.h:744
skymins
float skymins[2][6]
Definition: vk_warp.c:322
qvkpipeline_t::layout
VkPipelineLayout layout
Definition: qvk.h:154
name
cvar_t * name
Definition: cl_main.c:79
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:164
vkpoly_s::numverts
int numverts
Definition: vk_model.h:91
s
static fixed16_t s
Definition: r_scan.c:30
msurface_s::polys
glpoly_t * polys
Definition: gl_model.h:111
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:165
loadmodel
model_t * loadmodel
Definition: r_model.c:27
mtexinfo_s::vecs
float vecs[2][4]
Definition: r_model.h:85
ON_EPSILON
#define ON_EPSILON
Definition: vk_warp.c:398
MAX_VERTS
#define MAX_VERTS
Definition: qfiles.h:90
vec3_origin
vec3_t vec3_origin
Definition: q_shared.c:24
QVk_BindPipeline
void QVk_BindPipeline(qvkpipeline_t *pipeline)
Definition: vk_common.c:2284
R_ClearSkyBox
void R_ClearSkyBox(void)
Definition: vk_warp.c:519
Mat_Translate
void Mat_Translate(float *matrix, float x, float y, float z)
Definition: vk_rmain.c:718
skyaxis
vec3_t skyaxis
Definition: vk_warp.c:28
medge_t::v
unsigned short v[2]
Definition: r_model.h:79
R_SetSky
void R_SetSky(char *name, float rotate, vec3_t axis)
Definition: vk_warp.c:654
R_AddSkySurface
void R_AddSkySurface(msurface_t *fa)
Definition: vk_warp.c:496
vk_picmip
static cvar_t * vk_picmip
Definition: vid_menu.c:50
msurface_s
Definition: r_model.h:93
R_DrawSkyBox
void R_DrawSkyBox(void)
Definition: vk_warp.c:577
mtexinfo_s::flags
int flags
Definition: r_model.h:88
MakeSkyVec
void MakeSkyVec(float s, float t, int axis, float *vertexData)
Definition: vk_warp.c:531
texture
GLuint texture
Definition: qgl_win.c:68
image_s
Definition: r_local.h:71
model_s::vertexes
mvertex_t * vertexes
Definition: r_model.h:208
warpface
msurface_t * warpface
Definition: vk_warp.c:31
c_sky
int c_sky
Definition: vk_warp.c:288
DrawSkyPolygon
void DrawSkyPolygon(int nump, vec3_t vecs)
Definition: vk_warp.c:325
skymaxs
float skymaxs[2][6]
Definition: vk_warp.c:322
SIDE_ON
#define SIDE_ON
Definition: r_model.h:52
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:134
Hunk_Alloc
void * Hunk_Alloc(int size)
Definition: q_shwin.c:57
Com_sprintf
void Com_sprintf(char *dest, int size, char *fmt,...)
Definition: q_shared.c:1223
msurface_s::firstedge
int firstedge
Definition: r_model.h:103
sky_min
float sky_min
Definition: vk_warp.c:323
skyname
char skyname[MAX_QPATH]
Definition: vk_warp.c:26
skytexorder
int skytexorder[6]
Definition: vk_warp.c:576
it_sky
@ it_sky
Definition: r_local.h:68