2021-01-25 15:55:45 +00:00
|
|
|
/*
|
|
|
|
qf_alias.h
|
|
|
|
|
2021-02-24 07:27:56 +00:00
|
|
|
Vulkan specific alias model stuff
|
2021-01-25 15:55:45 +00:00
|
|
|
|
|
|
|
Copyright (C) 2012 Bill Currie <bill@taniwha.org>
|
|
|
|
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
|
|
|
|
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
|
|
Date: 2012/1/7
|
|
|
|
Date: 2021/1/18
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifndef __QF_Vulkan_qf_alias_h
|
|
|
|
#define __QF_Vulkan_qf_alias_h
|
|
|
|
|
|
|
|
#include "QF/darray.h"
|
|
|
|
#include "QF/model.h"
|
|
|
|
#include "QF/modelgen.h"
|
|
|
|
#include "QF/Vulkan/qf_vid.h"
|
2021-02-14 02:35:06 +00:00
|
|
|
#include "QF/Vulkan/command.h"
|
2021-01-25 15:55:45 +00:00
|
|
|
|
|
|
|
typedef struct aliasvrt_s {
|
|
|
|
float vertex[4];
|
|
|
|
float normal[4];
|
|
|
|
} aliasvrt_t;
|
|
|
|
|
|
|
|
typedef struct aliasuv_s {
|
|
|
|
float u, v;
|
|
|
|
} aliasuv_t;
|
|
|
|
|
|
|
|
typedef struct qfv_alias_mesh_s {
|
|
|
|
VkBuffer vertex_buffer;
|
|
|
|
VkBuffer uv_buffer;
|
|
|
|
VkBuffer index_buffer;
|
|
|
|
VkDeviceMemory memory;
|
|
|
|
} qfv_alias_mesh_t;
|
|
|
|
|
2021-02-02 10:53:36 +00:00
|
|
|
typedef struct qfv_alias_skin_s {
|
|
|
|
VkDeviceMemory memory;
|
|
|
|
VkImage image;
|
|
|
|
VkImageView view;
|
|
|
|
byte colora[4];
|
|
|
|
byte colorb[4];
|
2021-12-17 03:20:32 +00:00
|
|
|
VkDescriptorSet descriptor;
|
2021-02-02 10:53:36 +00:00
|
|
|
} qfv_alias_skin_t;
|
|
|
|
|
2021-02-19 02:14:54 +00:00
|
|
|
typedef enum {
|
2021-02-14 02:35:06 +00:00
|
|
|
QFV_aliasDepth,
|
|
|
|
QFV_aliasGBuffer,
|
2021-02-19 02:14:54 +00:00
|
|
|
QFV_aliasTranslucent,
|
2021-01-25 15:55:45 +00:00
|
|
|
|
2021-02-14 02:35:06 +00:00
|
|
|
QFV_aliasNumPasses
|
2021-02-19 02:14:54 +00:00
|
|
|
} QFV_AliasSubpass;
|
2021-01-26 11:58:24 +00:00
|
|
|
|
|
|
|
typedef struct aliasframe_s {
|
2021-02-14 02:35:06 +00:00
|
|
|
qfv_cmdbufferset_t cmdSet;
|
2021-01-26 11:58:24 +00:00
|
|
|
} aliasframe_t;
|
|
|
|
|
|
|
|
typedef struct aliasframeset_s
|
|
|
|
DARRAY_TYPE (aliasframe_t) aliasframeset_t;
|
|
|
|
|
2021-12-08 15:25:50 +00:00
|
|
|
typedef struct aliasindset_s
|
|
|
|
DARRAY_TYPE (unsigned) aliasindset_t;
|
|
|
|
|
2021-01-26 11:58:24 +00:00
|
|
|
typedef struct aliasctx_s {
|
|
|
|
aliasframeset_t frames;
|
2021-02-14 02:35:06 +00:00
|
|
|
VkPipeline depth;
|
|
|
|
VkPipeline gbuf;
|
2021-01-26 11:58:24 +00:00
|
|
|
VkPipelineLayout layout;
|
|
|
|
VkSampler sampler;
|
|
|
|
} aliasctx_t;
|
2021-01-25 15:55:45 +00:00
|
|
|
|
|
|
|
struct vulkan_ctx_s;
|
2021-12-02 12:58:29 +00:00
|
|
|
struct qfv_renderframe_s;
|
2021-01-26 11:58:24 +00:00
|
|
|
struct entity_s;
|
2021-02-01 12:11:45 +00:00
|
|
|
struct mod_alias_ctx_s;
|
2021-12-02 12:58:29 +00:00
|
|
|
|
[model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models
with more than one skin are quite rare, and those with animated skin
groups are even rarer. However, for those models that do have more than
one skin, it will allow for reduced allocation overheads, and when
supported (glsl, vulkan, maybe gl), loading all the skins into an array
texture (since all skins are the same size, though external skins may
vary), but that's not implemented yet, this just wraps the old one skin
at a time code.
2022-04-04 06:38:27 +00:00
|
|
|
void Vulkan_Mod_LoadAllSkins (struct mod_alias_ctx_s *alias_ctx,
|
|
|
|
struct vulkan_ctx_s *ctx);
|
2021-02-01 12:11:45 +00:00
|
|
|
void Vulkan_Mod_FinalizeAliasModel (struct mod_alias_ctx_s *alias_ctx,
|
2021-01-25 15:55:45 +00:00
|
|
|
struct vulkan_ctx_s *ctx);
|
2021-02-01 12:11:45 +00:00
|
|
|
void Vulkan_Mod_LoadExternalSkins (struct mod_alias_ctx_s *alias_ctx,
|
|
|
|
struct vulkan_ctx_s *ctx);
|
|
|
|
void Vulkan_Mod_MakeAliasModelDisplayLists (struct mod_alias_ctx_s *alias_ctx,
|
2021-01-25 15:55:45 +00:00
|
|
|
void *_m, int _s, int extra,
|
|
|
|
struct vulkan_ctx_s *ctx);
|
|
|
|
|
2021-12-08 15:25:50 +00:00
|
|
|
void Vulkan_AliasAddSkin (struct vulkan_ctx_s *ctx, qfv_alias_skin_t *skin);
|
|
|
|
void Vulkan_AliasRemoveSkin (struct vulkan_ctx_s *ctx, qfv_alias_skin_t *skin);
|
|
|
|
|
2021-12-02 12:58:29 +00:00
|
|
|
void Vulkan_AliasBegin (struct qfv_renderframe_s *rFrame);
|
|
|
|
void Vulkan_DrawAlias (struct entity_s *ent, struct qfv_renderframe_s *rFrame);
|
|
|
|
void Vulkan_AliasEnd (struct qfv_renderframe_s *rFrame);
|
2021-01-26 11:58:24 +00:00
|
|
|
|
|
|
|
void Vulkan_Alias_Init (struct vulkan_ctx_s *ctx);
|
|
|
|
void Vulkan_Alias_Shutdown (struct vulkan_ctx_s *ctx);
|
|
|
|
|
2021-12-02 12:58:29 +00:00
|
|
|
void Vulkan_AliasDepthRange (struct qfv_renderframe_s *rFrame, float n, float f);
|
2021-07-25 05:03:25 +00:00
|
|
|
|
2021-01-25 15:55:45 +00:00
|
|
|
#endif//__QF_Vulkan_qf_alias_h
|