mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
[vulkan] Clean up r_origin and modelorg
Same deal as for GL and GLSL.
This commit is contained in:
parent
075a0fe326
commit
20536d83eb
6 changed files with 17 additions and 26 deletions
|
@ -707,10 +707,7 @@ Draw_TileClear (int x, int y, int w, int h)
|
|||
vr.x = x;
|
||||
width = w;
|
||||
|
||||
if (tileoffsety != 0)
|
||||
vr.height = r_rectdesc.height - tileoffsety;
|
||||
else
|
||||
vr.height = r_rectdesc.height;
|
||||
vr.height = r_rectdesc.height - tileoffsety;
|
||||
|
||||
if (vr.height > height)
|
||||
vr.height = height;
|
||||
|
@ -718,11 +715,7 @@ Draw_TileClear (int x, int y, int w, int h)
|
|||
tileoffsetx = vr.x % r_rectdesc.width;
|
||||
|
||||
while (width > 0) {
|
||||
if (tileoffsetx != 0)
|
||||
vr.width = r_rectdesc.width - tileoffsetx;
|
||||
else
|
||||
vr.width = r_rectdesc.width;
|
||||
|
||||
vr.width = r_rectdesc.width - tileoffsetx;
|
||||
if (vr.width > width)
|
||||
vr.width = width;
|
||||
|
||||
|
|
|
@ -653,10 +653,11 @@ get_side (mnode_t *node)
|
|||
{
|
||||
// find the node side on which we are
|
||||
plane_t *plane = node->plane;
|
||||
vec4f_t org = r_refdef.viewposition;
|
||||
|
||||
if (plane->type < 3)
|
||||
return (r_origin[plane->type] - plane->dist) < 0;
|
||||
return (DotProduct (r_origin, plane->normal) - plane->dist) < 0;
|
||||
return (org[plane->type] - plane->dist) < 0;
|
||||
return (DotProduct (org, plane->normal) - plane->dist) < 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
@ -160,7 +160,7 @@ update_lights (vulkan_ctx_t *ctx)
|
|||
light_data->distFactor2 = 1 / 16384.0;
|
||||
|
||||
light_data->lightCount = 0;
|
||||
R_FindNearLights (r_origin, MaxLights - 1, lights);
|
||||
R_FindNearLights (&r_refdef.viewposition[0], MaxLights - 1, lights);
|
||||
for (int i = 0; i < MaxLights - 1; i++) {
|
||||
if (!lights[i]) {
|
||||
break;
|
||||
|
|
|
@ -70,14 +70,15 @@ setup_frame (vulkan_ctx_t *ctx)
|
|||
EntQueue_Clear (r_ent_queue);
|
||||
r_framecount++;
|
||||
|
||||
VectorCopy (r_refdef.viewposition, r_origin);
|
||||
VectorCopy (qvmulf (r_refdef.viewrotation, (vec4f_t) { 1, 0, 0, 0 }), vpn);
|
||||
VectorCopy (qvmulf (r_refdef.viewrotation, (vec4f_t) { 0, -1, 0, 0 }), vright);
|
||||
VectorCopy (qvmulf (r_refdef.viewrotation, (vec4f_t) { 0, 0, 1, 0 }), vup);
|
||||
vec4f_t position = r_refdef.viewposition;
|
||||
vec4f_t rotation = r_refdef.viewrotation;
|
||||
VectorCopy (qvmulf (rotation, (vec4f_t) { 1, 0, 0, 0 }), vpn);
|
||||
VectorCopy (qvmulf (rotation, (vec4f_t) { 0, -1, 0, 0 }), vright);
|
||||
VectorCopy (qvmulf (rotation, (vec4f_t) { 0, 0, 1, 0 }), vup);
|
||||
|
||||
R_SetFrustum ();
|
||||
|
||||
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.renderer.model);
|
||||
r_viewleaf = Mod_PointInLeaf (&position[0], r_worldentity.renderer.model);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -108,7 +108,7 @@ setup_sky (vulkan_ctx_t *ctx)
|
|||
q = Blend (mctx->sky_rotation[0], mctx->sky_rotation[1], blend);
|
||||
q = normalf (qmulf (mctx->sky_fix, q));
|
||||
mat4fidentity (mat);
|
||||
VectorNegate (r_origin, mat[3]);
|
||||
VectorNegate (r_refdef.viewposition, mat[3]);
|
||||
mat4fquat (m, q);
|
||||
mmulf (mat, m, mat);
|
||||
Vulkan_SetSkyMatrix (ctx, mat);
|
||||
|
|
|
@ -108,7 +108,7 @@ Vulkan_DrawSprite (entity_t *ent, qfv_renderframe_t *rFrame)
|
|||
msprite_t *sprite = model->cache.data;
|
||||
animation_t *animation = &ent->animation;
|
||||
|
||||
mat4f_t mat;
|
||||
mat4f_t mat = {};
|
||||
uint32_t frame;
|
||||
qfv_push_constants_t push_constants[] = {
|
||||
{ VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof (mat), mat },
|
||||
|
@ -119,14 +119,10 @@ Vulkan_DrawSprite (entity_t *ent, qfv_renderframe_t *rFrame)
|
|||
frame = (ptrdiff_t) R_GetSpriteFrame (sprite, animation);
|
||||
|
||||
mat[3] = Transform_GetWorldPosition (ent->transform);
|
||||
vec4f_t cameravec = {r_origin[0], r_origin[1], r_origin[2], 0 };
|
||||
vec4f_t svpn = {}, svright = {}, svup = {};
|
||||
cameravec -= mat[3];
|
||||
vec4f_t cameravec = r_refdef.viewposition - mat[3];
|
||||
R_BillboardFrame (ent, sprite->type, &cameravec[0],
|
||||
&svup[0], &svright[0], &svpn[0]);
|
||||
mat[2] = svup;
|
||||
mat[1] = svright;
|
||||
mat[0] = -svpn;
|
||||
&mat[2][0], &mat[1][0], &mat[0][0]);
|
||||
mat[0] = -mat[0];
|
||||
|
||||
emit_commands (sframe->cmdSet.a[QFV_spriteDepth],
|
||||
(qfv_sprite_t *) ((byte *) sprite + sprite->data),
|
||||
|
|
Loading…
Reference in a new issue