2021-01-18 03:46:06 +00:00
|
|
|
#ifndef __QF_Vulkan_qf_particles_h
|
|
|
|
#define __QF_Vulkan_qf_particles_h
|
|
|
|
|
2021-12-16 14:17:01 +00:00
|
|
|
#include "QF/darray.h"
|
2021-01-18 03:46:06 +00:00
|
|
|
#include "QF/image.h"
|
2022-11-27 15:52:07 +00:00
|
|
|
#include "QF/render.h"
|
2021-01-18 03:46:06 +00:00
|
|
|
|
2021-12-16 14:17:01 +00:00
|
|
|
#include "QF/Vulkan/command.h"
|
|
|
|
|
|
|
|
typedef struct qfv_particle_s {
|
|
|
|
vec4f_t pos;
|
|
|
|
vec4f_t vel;
|
|
|
|
vec4f_t color;
|
|
|
|
float texture;
|
|
|
|
float ramp;
|
|
|
|
float scale;
|
|
|
|
float live;
|
|
|
|
} qfv_particle_t;
|
|
|
|
|
|
|
|
typedef struct qfv_parameters_s {
|
|
|
|
vec4f_t drag;
|
|
|
|
vec4f_t ramp;
|
|
|
|
} qfv_parameters_t;
|
|
|
|
|
2021-12-21 21:54:23 +00:00
|
|
|
// Doubles as VkDrawIndirectCommand
|
|
|
|
typedef struct qfv_particle_system_s {
|
|
|
|
uint32_t vertexCount; // always 1
|
|
|
|
uint32_t particleCount;
|
|
|
|
uint32_t firstVertex; // always 0
|
|
|
|
uint32_t firstInstance; // always 0
|
|
|
|
} qfv_particle_system_t;
|
|
|
|
|
2021-12-16 14:17:01 +00:00
|
|
|
typedef enum {
|
|
|
|
QFV_particleTranslucent,
|
|
|
|
|
|
|
|
QFV_particleNumPasses
|
|
|
|
} QFV_ParticleSubpass;
|
|
|
|
|
|
|
|
typedef struct particleframe_s {
|
|
|
|
VkCommandBuffer compute;
|
2022-11-27 15:52:07 +00:00
|
|
|
VkEvent physicsEvent;
|
|
|
|
VkEvent updateEvent;
|
|
|
|
VkBuffer states;
|
2021-12-16 14:17:01 +00:00
|
|
|
VkBuffer params;
|
|
|
|
VkBuffer system;
|
|
|
|
|
2022-11-27 15:52:07 +00:00
|
|
|
VkDescriptorSet curDescriptors;
|
|
|
|
VkDescriptorSet inDescriptors;
|
|
|
|
VkDescriptorSet newDescriptors;
|
2021-12-16 14:17:01 +00:00
|
|
|
|
|
|
|
qfv_cmdbufferset_t cmdSet;
|
|
|
|
} particleframe_t;
|
|
|
|
|
|
|
|
typedef struct particleframeset_s
|
|
|
|
DARRAY_TYPE (particleframe_t) particleframeset_t;
|
|
|
|
|
|
|
|
typedef struct particlectx_s {
|
|
|
|
particleframeset_t frames;
|
|
|
|
VkPipeline physics;
|
|
|
|
VkPipeline update;
|
|
|
|
VkPipeline draw;
|
|
|
|
|
2022-11-27 15:52:07 +00:00
|
|
|
struct qfv_resource_s *resources;
|
2021-12-21 21:54:23 +00:00
|
|
|
struct qfv_stagebuf_s *stage;
|
|
|
|
|
2021-12-16 14:17:01 +00:00
|
|
|
VkDescriptorPool pool;
|
|
|
|
VkDescriptorSetLayout setLayout;
|
|
|
|
VkPipelineLayout physics_layout;
|
|
|
|
VkPipelineLayout update_layout;
|
|
|
|
VkPipelineLayout draw_layout;
|
2021-12-19 05:47:25 +00:00
|
|
|
|
2022-11-28 01:21:20 +00:00
|
|
|
psystem_t *psystem;
|
2021-12-16 14:17:01 +00:00
|
|
|
} particlectx_t;
|
|
|
|
|
2021-01-18 03:46:06 +00:00
|
|
|
struct cvar_s;
|
2022-11-28 01:21:20 +00:00
|
|
|
struct vulkan_ctx_s;
|
|
|
|
struct qfv_renderframe_s;
|
2021-01-18 03:46:06 +00:00
|
|
|
|
2021-12-19 05:47:25 +00:00
|
|
|
struct psystem_s *Vulkan_ParticleSystem (struct vulkan_ctx_s *ctx);
|
2021-01-18 03:46:06 +00:00
|
|
|
void Vulkan_Particles_Init (struct vulkan_ctx_s *ctx);
|
2021-12-16 14:17:01 +00:00
|
|
|
void Vulkan_Particles_Shutdown (struct vulkan_ctx_s *ctx);
|
2022-11-28 01:21:20 +00:00
|
|
|
void Vulkan_DrawParticles (struct qfv_renderframe_s *rFrame);
|
2022-11-27 15:52:07 +00:00
|
|
|
void Vulkan_Particles_CreateRenderPasses (struct vulkan_ctx_s *ctx);
|
2021-01-18 03:46:06 +00:00
|
|
|
|
|
|
|
#endif//__QF_Vulkan_qf_particles_h
|