mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-17 01:21:12 +00:00
vk: fix water on jail1 level
This commit is contained in:
parent
ec013874a0
commit
b2ff95249e
5 changed files with 50 additions and 6 deletions
|
@ -183,7 +183,9 @@ 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 EmitWaterPolys (msurface_t *fa, image_t *texture,
|
||||
float *modelMatrix, float *color,
|
||||
qboolean solid_surface);
|
||||
void R_AddSkySurface (msurface_t *fa);
|
||||
void R_ClearSkyBox (void);
|
||||
void R_DrawSkyBox (void);
|
||||
|
|
|
@ -241,6 +241,7 @@ extern qvkpipeline_t vk_drawSpritePipeline;
|
|||
extern qvkpipeline_t vk_drawPolyPipeline;
|
||||
extern qvkpipeline_t vk_drawPolyLmapPipeline;
|
||||
extern qvkpipeline_t vk_drawPolyWarpPipeline;
|
||||
extern qvkpipeline_t vk_drawPolySolidWarpPipeline;
|
||||
extern qvkpipeline_t vk_drawBeamPipeline;
|
||||
extern qvkpipeline_t vk_drawSkyboxPipeline;
|
||||
extern qvkpipeline_t vk_drawDLightPipeline;
|
||||
|
|
|
@ -146,6 +146,7 @@ qvkpipeline_t vk_drawSpritePipeline = QVKPIPELINE_INIT;
|
|||
qvkpipeline_t vk_drawPolyPipeline = QVKPIPELINE_INIT;
|
||||
qvkpipeline_t vk_drawPolyLmapPipeline = QVKPIPELINE_INIT;
|
||||
qvkpipeline_t vk_drawPolyWarpPipeline = QVKPIPELINE_INIT;
|
||||
qvkpipeline_t vk_drawPolySolidWarpPipeline = QVKPIPELINE_INIT;
|
||||
qvkpipeline_t vk_drawBeamPipeline = QVKPIPELINE_INIT;
|
||||
qvkpipeline_t vk_drawSkyboxPipeline = QVKPIPELINE_INIT;
|
||||
qvkpipeline_t vk_drawDLightPipeline = QVKPIPELINE_INIT;
|
||||
|
@ -1390,6 +1391,17 @@ static void CreatePipelines()
|
|||
QVk_DebugSetObjectName((uint64_t)vk_drawPolyWarpPipeline.layout, VK_OBJECT_TYPE_PIPELINE_LAYOUT, "Pipeline Layout: warped polygon (liquids)");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_drawPolyWarpPipeline.pl, VK_OBJECT_TYPE_PIPELINE, "Pipeline: warped polygon (liquids)");
|
||||
|
||||
// draw solid polygon with warp effect (liquid) pipeline
|
||||
VK_LOAD_VERTFRAG_SHADERS(shaders, polygon_warp, basic);
|
||||
vk_drawPolySolidWarpPipeline.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
QVk_CreatePipeline(samplerUboLmapDsLayouts, 2, &vertInfoRGB_RG,
|
||||
&vk_drawPolySolidWarpPipeline, &vk_renderpasses[RP_WORLD],
|
||||
shaders, 2);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_drawPolySolidWarpPipeline.layout,
|
||||
VK_OBJECT_TYPE_PIPELINE_LAYOUT, "Pipeline Layout: warped solid polygon (liquids)");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_drawPolySolidWarpPipeline.pl,
|
||||
VK_OBJECT_TYPE_PIPELINE, "Pipeline: warped solid polygon (liquids)");
|
||||
|
||||
// draw beam pipeline
|
||||
VK_LOAD_VERTFRAG_SHADERS(shaders, beam, basic_color_quad);
|
||||
vk_drawBeamPipeline.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
|
||||
|
@ -1512,6 +1524,7 @@ void QVk_Shutdown( void )
|
|||
QVk_DestroyPipeline(&vk_drawPolyPipeline);
|
||||
QVk_DestroyPipeline(&vk_drawPolyLmapPipeline);
|
||||
QVk_DestroyPipeline(&vk_drawPolyWarpPipeline);
|
||||
QVk_DestroyPipeline(&vk_drawPolySolidWarpPipeline);
|
||||
QVk_DestroyPipeline(&vk_drawBeamPipeline);
|
||||
QVk_DestroyPipeline(&vk_drawSkyboxPipeline);
|
||||
QVk_DestroyPipeline(&vk_drawDLightPipeline);
|
||||
|
|
|
@ -291,7 +291,7 @@ static void R_RenderBrushPoly (msurface_t *fa, float *modelMatrix, float alpha,
|
|||
color[0] = color[1] = color[2] = vk_state.inverse_intensity;
|
||||
color[3] = 1.f;
|
||||
// warp texture, no lightmaps
|
||||
EmitWaterPolys(fa, image, modelMatrix, color);
|
||||
EmitWaterPolys(fa, image, modelMatrix, color, alpha == 1.f);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ void R_DrawAlphaSurfaces (void)
|
|||
color[3] = 0.66f;
|
||||
|
||||
if (s->flags & SURF_DRAWTURB)
|
||||
EmitWaterPolys(s, s->texinfo->image, NULL, color);
|
||||
EmitWaterPolys(s, s->texinfo->image, NULL, color, false);
|
||||
else if (s->texinfo->flags & SURF_FLOWING) // PGM 9/16/98
|
||||
DrawVkFlowingPoly(s, s->texinfo->image, color); // PGM
|
||||
else
|
||||
|
@ -399,6 +399,8 @@ void R_DrawAlphaSurfaces (void)
|
|||
/*
|
||||
================
|
||||
DrawTextureChains
|
||||
|
||||
Draw world surfaces (mostly solid with alpha == 1.f)
|
||||
================
|
||||
*/
|
||||
static void DrawTextureChains (entity_t *currententity)
|
||||
|
|
|
@ -199,7 +199,9 @@ EmitWaterPolys
|
|||
Does a water warp on the pre-fragmented glpoly_t chain
|
||||
=============
|
||||
*/
|
||||
void EmitWaterPolys (msurface_t *fa, image_t *texture, float *modelMatrix, float *color)
|
||||
void
|
||||
EmitWaterPolys (msurface_t *fa, image_t *texture, float *modelMatrix,
|
||||
float *color, qboolean solid_surface)
|
||||
{
|
||||
vkpoly_t *p, *bp;
|
||||
float *v;
|
||||
|
@ -232,7 +234,16 @@ void EmitWaterPolys (msurface_t *fa, image_t *texture, float *modelMatrix, float
|
|||
Mat_Identity(polyUbo.model);
|
||||
}
|
||||
|
||||
QVk_BindPipeline(&vk_drawPolyWarpPipeline);
|
||||
if (solid_surface)
|
||||
{
|
||||
// Solid surface
|
||||
QVk_BindPipeline(&vk_drawPolySolidWarpPipeline);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Blend surface
|
||||
QVk_BindPipeline(&vk_drawPolyWarpPipeline);
|
||||
}
|
||||
|
||||
uint32_t uboOffset;
|
||||
VkDescriptorSet uboDescriptorSet;
|
||||
|
@ -248,7 +259,22 @@ void EmitWaterPolys (msurface_t *fa, image_t *texture, float *modelMatrix, float
|
|||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
|
||||
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawPolyWarpPipeline.layout, 0, 2, descriptorSets, 1, &uboOffset);
|
||||
if (solid_surface)
|
||||
{
|
||||
// Solid surface
|
||||
vkCmdBindDescriptorSets(
|
||||
vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
vk_drawPolySolidWarpPipeline.layout, 0, 2,
|
||||
descriptorSets, 1, &uboOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Blend surface
|
||||
vkCmdBindDescriptorSets(
|
||||
vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
vk_drawPolyWarpPipeline.layout, 0, 2,
|
||||
descriptorSets, 1, &uboOffset);
|
||||
}
|
||||
|
||||
for (bp = fa->polys; bp; bp = bp->next)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue