mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
[vulkan] Implement water alpha
I'm not sure it's working properly, but that compose pass is suspect, especially with respect to lighting.
This commit is contained in:
parent
3bb54bc20a
commit
0d609efbc6
6 changed files with 17 additions and 4 deletions
|
@ -350,7 +350,7 @@
|
|||
{
|
||||
stageFlags = fragment;
|
||||
offset = 64;
|
||||
size = "4 * 4 + 4";
|
||||
size = "4 * 4 + 4 + 4";
|
||||
},
|
||||
);
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@ layout (push_constant) uniform PushConstants {
|
|||
layout (offset = 64)
|
||||
vec4 fog;
|
||||
float time;
|
||||
float alpha;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec4 tl_st;
|
||||
|
|
|
@ -10,6 +10,7 @@ layout (push_constant) uniform PushConstants {
|
|||
layout (offset = 64)
|
||||
vec4 fog;
|
||||
float time;
|
||||
float alpha;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec4 tl_st;
|
||||
|
|
|
@ -6,6 +6,7 @@ layout (push_constant) uniform PushConstants {
|
|||
layout (offset = 64)
|
||||
vec4 fog;
|
||||
float time;
|
||||
float alpha;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec4 tl_st;
|
||||
|
@ -48,5 +49,7 @@ main (void)
|
|||
|
||||
c = texture (Texture, t_st);
|
||||
e = texture (Texture, e_st);
|
||||
frag_color = c + e;//fogBlend (c);
|
||||
c += e;
|
||||
c.a = alpha;
|
||||
frag_color = c;//fogBlend (c);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ layout (push_constant) uniform PushConstants {
|
|||
layout (offset = 64)
|
||||
vec4 fog;
|
||||
float time;
|
||||
float alpha;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec4 tl_st;
|
||||
|
|
|
@ -77,6 +77,7 @@ typedef struct bsp_push_constants_s {
|
|||
mat4f_t Model;
|
||||
quat_t fog;
|
||||
float time;
|
||||
float alpha;
|
||||
} bsp_push_constants_t;
|
||||
|
||||
static const char * __attribute__((used)) bsp_pass_names[] = {
|
||||
|
@ -782,8 +783,11 @@ push_fragconst (bsp_push_constants_t *constants, VkPipelineLayout layout,
|
|||
{ VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||
field_offset (bsp_push_constants_t, time),
|
||||
sizeof (constants->time), &constants->time },
|
||||
{ VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||
field_offset (bsp_push_constants_t, alpha),
|
||||
sizeof (constants->alpha), &constants->alpha },
|
||||
};
|
||||
QFV_PushConstants (device, cmd, layout, 2, push_constants);
|
||||
QFV_PushConstants (device, cmd, layout, 3, push_constants);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1112,7 +1116,10 @@ Vulkan_DrawWaterSurfaces (qfv_renderframe_t *rFrame)
|
|||
turb_begin (rFrame);
|
||||
push_transform (identity, bctx->layout, device,
|
||||
bframe->cmdSet.a[QFV_bspTurb]);
|
||||
bsp_push_constants_t frag_constants = { .time = vr_data.realtime };
|
||||
bsp_push_constants_t frag_constants = {
|
||||
.time = vr_data.realtime,
|
||||
.alpha = r_wateralpha
|
||||
};
|
||||
push_fragconst (&frag_constants, bctx->layout, device,
|
||||
bframe->cmdSet.a[QFV_bspTurb]);
|
||||
for (is = bctx->waterchain; is; is = is->tex_chain) {
|
||||
|
|
Loading…
Reference in a new issue