[vulkan] Hook up the view model again

And with that, the vulkan renderer is fully back to where it was before
this mini-project (and even a little ahead). Time for shadows (finally).
This commit is contained in:
Bill Currie 2023-06-26 18:14:38 +09:00
parent 614ca744ab
commit 4932987b08
3 changed files with 30 additions and 36 deletions

View file

@ -1627,6 +1627,7 @@ steps = {
tasks = (
{ func = bsp_visit_world;
params = (main); },
{ func = scene_draw_viewmodel; },
);
};
};

View file

@ -66,43 +66,7 @@
#include "mod_internal.h"
#include "r_internal.h"
#include "vid_vulkan.h"
#if 0
static void
Vulkan_DrawViewModel (vulkan_ctx_t *ctx)
{
entity_t ent = vr_data.view_model;
if (!Entity_Valid (ent)) {
return;
}
renderer_t *renderer = Ent_GetComponent (ent.id, scene_renderer, ent.reg);
if (vr_data.inhibit_viewmodel
|| !r_drawviewmodel
|| !r_drawentities
|| !renderer->model)
return;
EntQueue_AddEntity (r_ent_queue, ent, renderer->model->type);
}
void
Vulkan_RenderView (qfv_orenderframe_t *rFrame)
{
vulkan_ctx_t *ctx = rFrame->vulkan_ctx;
if (!r_refdef.worldmodel) {
return;
}
Vulkan_DrawWorld (rFrame);
Vulkan_DrawSky (rFrame);
if (Entity_Valid (vr_data.view_model)) {
Vulkan_DrawViewModel (ctx);
}
Vulkan_DrawWaterSurfaces (rFrame);
Vulkan_Bsp_Flush (ctx);
Vulkan_Scene_Flush (ctx);
}
#endif
void
Vulkan_NewScene (scene_t *scene, vulkan_ctx_t *ctx)
{

View file

@ -131,9 +131,38 @@ static VkWriteDescriptorSet base_buffer_write = {
0, 0, 0
};
static void
scene_draw_viewmodel (const exprval_t **params, exprval_t *result,
exprctx_t *ectx)
{
entity_t ent = vr_data.view_model;
if (!Entity_Valid (ent)) {
return;
}
renderer_t *renderer = Ent_GetComponent (ent.id, scene_renderer, ent.reg);
if (vr_data.inhibit_viewmodel
|| !r_drawviewmodel
|| !r_drawentities
|| !renderer->model)
return;
EntQueue_AddEntity (r_ent_queue, ent, renderer->model->type);
}
static exprfunc_t scene_draw_viewmodel_func[] = {
{ .func = scene_draw_viewmodel },
{}
};
static exprsym_t scene_task_syms[] = {
{ "scene_draw_viewmodel", &cexpr_function, scene_draw_viewmodel_func },
{}
};
void
Vulkan_Scene_Init (vulkan_ctx_t *ctx)
{
QFV_Render_AddTasks (ctx, scene_task_syms);
scenectx_t *sctx = calloc (1, sizeof (scenectx_t)
+ sizeof (qfv_resource_t)
+ sizeof (qfv_resobj_t));