#include <assert.h>
#include "vk_local.h"
Go to the source code of this file.
|
static void | LM_InitBlock (void) |
|
static void | LM_UploadBlock (qboolean dynamic) |
|
static qboolean | LM_AllocBlock (int w, int h, int *x, int *y) |
|
void | R_SetCacheState (msurface_t *surf) |
|
void | R_BuildLightMap (msurface_t *surf, byte *dest, int stride) |
|
image_t * | R_TextureAnimation (mtexinfo_t *tex) |
|
void | DrawVkPoly (vkpoly_t *p, image_t *texture, float *color) |
|
void | DrawVkFlowingPoly (msurface_t *fa, image_t *texture, float *color) |
|
void | R_DrawTriangleOutlines (void) |
|
void | R_RenderBrushPoly (msurface_t *fa, float *modelMatrix, float alpha) |
|
void | R_DrawAlphaSurfaces (void) |
|
void | DrawTextureChains (void) |
|
static void | Vk_RenderLightmappedPoly (msurface_t *surf, float *modelMatrix, float alpha) |
|
void | R_DrawInlineBModel (float *modelMatrix) |
|
void | R_DrawBrushModel (entity_t *e) |
|
void | R_RecursiveWorldNode (mnode_t *node) |
|
void | R_DrawWorld (void) |
|
void | R_MarkLeaves (void) |
|
void | Vk_BuildPolygonFromSurface (msurface_t *fa) |
|
void | Vk_CreateSurfaceLightmap (msurface_t *surf) |
|
void | Vk_BeginBuildingLightmaps (model_t *m) |
|
void | Vk_EndBuildingLightmaps (void) |
|
◆ BLOCK_HEIGHT
◆ BLOCK_WIDTH
◆ DYNAMIC_LIGHT_HEIGHT
#define DYNAMIC_LIGHT_HEIGHT 128 |
◆ DYNAMIC_LIGHT_WIDTH
#define DYNAMIC_LIGHT_WIDTH 128 |
◆ LIGHTMAP_BYTES
◆ DrawTextureChains()
◆ DrawVkFlowingPoly()
Definition at line 148 of file vk_rsurf.c.
171 verts[
i].vertex[0] =
v[0];
172 verts[
i].vertex[1] =
v[1];
173 verts[
i].vertex[2] =
v[2];
174 verts[
i].texCoord[0] =
v[3] + scroll;
175 verts[
i].texCoord[1] =
v[4];
181 VkDeviceSize vboOffset;
183 VkDescriptorSet uboDescriptorSet;
186 memcpy(vertData, verts,
sizeof(polyvert) * p->
numverts);
187 memcpy(uboData, color,
sizeof(
float) * 4);
189 VkDescriptorSet descriptorSets[] = {
texture->vk_texture.descriptorSet, uboDescriptorSet };
Referenced by R_DrawAlphaSurfaces(), and R_RenderBrushPoly().
◆ DrawVkPoly()
Definition at line 101 of file vk_rsurf.c.
116 verts[
i].vertex[0] =
v[0];
117 verts[
i].vertex[1] =
v[1];
118 verts[
i].vertex[2] =
v[2];
119 verts[
i].texCoord[0] =
v[3];
120 verts[
i].texCoord[1] =
v[4];
126 VkDeviceSize vboOffset;
128 VkDescriptorSet uboDescriptorSet;
131 memcpy(vertData, verts,
sizeof(polyvert) * p->
numverts);
132 memcpy(uboData, color,
sizeof(
float) * 4);
134 VkDescriptorSet descriptorSets[] = {
texture->vk_texture.descriptorSet, uboDescriptorSet };
Referenced by R_DrawAlphaSurfaces(), and R_RenderBrushPoly().
◆ LM_AllocBlock()
◆ LM_InitBlock()
◆ LM_UploadBlock()
◆ R_BuildLightMap()
Definition at line 455 of file gl_light.c.
470 smax = (surf->
extents[0]>>4)+1;
471 tmax = (surf->
extents[1]>>4)+1;
481 for (
i=0 ;
i<size*3 ;
i++)
508 for (
i=0 ;
i<3 ;
i++)
511 if ( scale[0] == 1.0
F &&
515 for (
i=0 ;
i<size ;
i++, bl+=3)
517 bl[0] = lightmap[
i*3+0];
518 bl[1] = lightmap[
i*3+1];
519 bl[2] = lightmap[
i*3+2];
524 for (
i=0 ;
i<size ;
i++, bl+=3)
526 bl[0] = lightmap[
i*3+0] * scale[0];
527 bl[1] = lightmap[
i*3+1] * scale[1];
528 bl[2] = lightmap[
i*3+2] * scale[2];
545 for (
i=0 ;
i<3 ;
i++)
548 if ( scale[0] == 1.0
F &&
552 for (
i=0 ;
i<size ;
i++, bl+=3 )
554 bl[0] += lightmap[
i*3+0];
555 bl[1] += lightmap[
i*3+1];
556 bl[2] += lightmap[
i*3+2];
561 for (
i=0 ;
i<size ;
i++, bl+=3)
563 bl[0] += lightmap[
i*3+0] * scale[0];
564 bl[1] += lightmap[
i*3+1] * scale[1];
565 bl[2] += lightmap[
i*3+2] * scale[2];
583 if ( monolightmap ==
'0' )
587 for (
j=0 ;
j<smax ;
j++)
625 float t = 255.0F /
max;
647 for (
j=0 ;
j<smax ;
j++)
685 float t = 255.0F /
max;
697 switch ( monolightmap )
706 a = 255 - ((
r+g+b)/3);
Referenced by R_RenderBrushPoly(), Vk_CreateSurfaceLightmap(), and Vk_RenderLightmappedPoly().
◆ R_DrawAlphaSurfaces()
◆ R_DrawBrushModel()
◆ R_DrawInlineBModel()
void R_DrawInlineBModel |
( |
float * |
modelMatrix | ) |
|
◆ R_DrawTriangleOutlines()
Definition at line 201 of file vk_rsurf.c.
210 VkDeviceSize vboOffset;
211 float color[3] = { 1.f, 1.f, 1.f };
219 VkDescriptorSet uboDescriptorSet;
231 for (; p; p = p->
chain)
235 triVert[0].v[0] = p->
verts[0][0];
236 triVert[0].v[1] = p->
verts[0][1];
237 triVert[0].v[2] = p->
verts[0][2];
238 memcpy(triVert[0].color, color,
sizeof(color));
240 triVert[1].v[0] = p->
verts[
j - 1][0];
241 triVert[1].v[1] = p->
verts[
j - 1][1];
242 triVert[1].v[2] = p->
verts[
j - 1][2];
243 memcpy(triVert[1].color, color,
sizeof(color));
245 triVert[2].v[0] = p->
verts[
j][0];
246 triVert[2].v[1] = p->
verts[
j][1];
247 triVert[2].v[2] = p->
verts[
j][2];
248 memcpy(triVert[2].color, color,
sizeof(color));
250 triVert[3].v[0] = p->
verts[0][0];
251 triVert[3].v[1] = p->
verts[0][1];
252 triVert[3].v[2] = p->
verts[0][2];
253 memcpy(triVert[3].color, color,
sizeof(color));
256 memcpy(vertData, triVert,
sizeof(triVert));
Referenced by R_DrawWorld().
◆ R_DrawWorld()
◆ R_MarkLeaves()
Definition at line 976 of file vk_rsurf.c.
1014 for (
i=0 ;
i<c ;
i++)
1015 ((
int *)fatvis)[
i] |= ((
int *)vis)[
i];
1024 if (vis[cluster>>3] & (1<<(cluster&7)))
◆ R_RecursiveWorldNode()
◆ R_RenderBrushPoly()
void R_RenderBrushPoly |
( |
msurface_t * |
fa, |
|
|
float * |
modelMatrix, |
|
|
float |
alpha |
|
) |
| |
◆ R_SetCacheState()
◆ R_TextureAnimation()
◆ Vk_BeginBuildingLightmaps()
◆ Vk_BuildPolygonFromSurface()
◆ Vk_CreateSurfaceLightmap()
◆ Vk_EndBuildingLightmaps()
◆ Vk_RenderLightmappedPoly()
static void Vk_RenderLightmappedPoly |
( |
msurface_t * |
surf, |
|
|
float * |
modelMatrix, |
|
|
float |
alpha |
|
) |
| |
|
static |
Definition at line 438 of file vk_rsurf.c.
451 float texCoordLmap[2];
465 memcpy(lmapPolyUbo.model, modelMatrix,
sizeof(
float) * 16);
475 VkDescriptorSet uboDescriptorSet;
477 memcpy(uboData, &lmapPolyUbo,
sizeof(lmapPolyUbo));
500 unsigned temp[128 * 128];
505 smax = (surf->
extents[0] >> 4) + 1;
506 tmax = (surf->
extents[1] >> 4) + 1;
516 smax = (surf->
extents[0] >> 4) + 1;
517 tmax = (surf->
extents[1] >> 4) + 1;
538 VkDeviceSize vboOffset;
547 verts[
i].vertex[0] =
v[0];
548 verts[
i].vertex[1] =
v[1];
549 verts[
i].vertex[2] =
v[2];
550 verts[
i].texCoord[0] =
v[3] + scroll;
551 verts[
i].texCoord[1] =
v[4];
552 verts[
i].texCoordLmap[0] =
v[5];
553 verts[
i].texCoordLmap[1] =
v[6];
557 memcpy(vertData, verts,
sizeof(lmappolyvert) * nv);
567 VkDeviceSize vboOffset;
576 verts[
i].vertex[0] =
v[0];
577 verts[
i].vertex[1] =
v[1];
578 verts[
i].vertex[2] =
v[2];
579 verts[
i].texCoord[0] =
v[3];
580 verts[
i].texCoord[1] =
v[4];
581 verts[
i].texCoordLmap[0] =
v[5];
582 verts[
i].texCoordLmap[1] =
v[6];
586 memcpy(vertData, verts,
sizeof(lmappolyvert) * nv);
615 verts[
i].vertex[0] =
v[0];
616 verts[
i].vertex[1] =
v[1];
617 verts[
i].vertex[2] =
v[2];
618 verts[
i].texCoord[0] =
v[3] + scroll;
619 verts[
i].texCoord[1] =
v[4];
620 verts[
i].texCoordLmap[0] =
v[5];
621 verts[
i].texCoordLmap[1] =
v[6];
624 VkDeviceSize vboOffset;
626 memcpy(vertData, verts,
sizeof(lmappolyvert) * nv);
644 verts[
i].vertex[0] =
v[0];
645 verts[
i].vertex[1] =
v[1];
646 verts[
i].vertex[2] =
v[2];
647 verts[
i].texCoord[0] =
v[3];
648 verts[
i].texCoord[1] =
v[4];
649 verts[
i].texCoordLmap[0] =
v[5];
650 verts[
i].texCoordLmap[1] =
v[6];
653 VkDeviceSize vboOffset;
655 memcpy(vertData, verts,
sizeof(lmappolyvert) * nv);
Referenced by R_DrawInlineBModel(), and R_RecursiveWorldNode().
◆ c_visible_lightmaps
◆ c_visible_textures
◆ modelorg
◆ r_alpha_surfaces
◆ vk_lms
static vklightmapstate_t vk_lms
#define QVk_DebugSetObjectName(a, b, c)
byte styles[MAXLIGHTMAPS]
CONST PIXELFORMATDESCRIPTOR int
#define VectorSubtract(a, b, c)
static void LM_InitBlock(void)
void R_DrawInlineBModel(float *modelMatrix)
qvktexture_t lightmap_textures[MAX_LIGHTMAPS *2]
VkDeviceMemory deviceMemory
Handle to Vulkan memory object.
float verts[4][VERTEXSIZE]
static qboolean LM_AllocBlock(int w, int h, int *x, int *y)
VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount)
msurface_t ** firstmarksurface
void R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
float r_viewproj_matrix[16]
struct mnode_s * children[2]
int registration_sequence
float cached_light[MAXLIGHTMAPS]
void R_MarkLights(dlight_t *light, int bit, mnode_t *node)
msurface_t * lightmap_surfaces[MAX_LIGHTMAPS]
uint8_t * QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset)
char * va(char *format,...)
void Mat_Identity(float *matrix)
VkDescriptorSet descriptorSet
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
int current_lightmap_texture
VmaAllocationInfo allocInfo
void DrawTextureChains(void)
void DrawVkFlowingPoly(msurface_t *fa, image_t *texture, float *color)
void R_AddSkySurface(msurface_t *fa)
void R_DrawTriangleOutlines(void)
void DrawVkPoly(vkpoly_t *p, image_t *texture, float *color)
uint8_t * QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet)
VkCommandBuffer vk_activeCmdbuffer
void QVk_CreateTexture(qvktexture_t *texture, const unsigned char *data, uint32_t width, uint32_t height, qvksampler_t samplerType)
void(* Sys_Error)(int err_level, char *str,...)
qvkpipeline_t vk_drawPolyPipeline
struct msurface_s * texturechain
struct msurface_s * lightmapchain
image_t vktextures[MAX_VKTEXTURES]
msurface_t * r_alpha_surfaces
#define DYNLIGHTMAP_OFFSET
void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uint32_t offset_x, uint32_t offset_y, uint32_t width, uint32_t height)
GLfloat GLfloat GLfloat alpha
qvkpipeline_t vk_showTrisPipeline
#define VectorAdd(a, b, c)
static void LM_UploadBlock(qboolean dynamic)
qvkpipeline_t vk_drawPolyLmapPipeline
void R_RenderBrushPoly(msurface_t *fa, float *modelMatrix, float alpha)
lightstyle_t * lightstyles
void QVk_BindPipeline(qvkpipeline_t *pipeline)
qboolean R_CullBox(vec3_t mins, vec3_t maxs)
unsigned short firstsurface
void EmitWaterPolys(msurface_t *fa)
void R_SetCacheState(msurface_t *surf)
void R_AddDynamicLights(msurface_t *surf)
void R_RecursiveWorldNode(mnode_t *node)
void R_RotateForEntity(entity_t *e)
image_t * R_TextureAnimation(mtexinfo_t *tex)
qvksampler_t vk_current_lmap_sampler
int allocated[BLOCK_WIDTH]
static void Vk_RenderLightmappedPoly(msurface_t *surf, float *modelMatrix, float alpha)
GLdouble GLdouble GLdouble w
byte lightmap_buffer[4 *BLOCK_WIDTH *BLOCK_HEIGHT]
unsigned short numsurfaces
byte * Mod_ClusterPVS(int cluster, model_t *model)
#define QVVKTEXTURE_CLEAR(i)
void * Hunk_Alloc(int size)
static float s_blocklights[34 *34 *3]
struct msurface_s * texturechain