2021-02-27 22:43:49 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "vk_core.h"
|
|
|
|
|
2021-04-09 23:59:04 +02:00
|
|
|
struct vk_render_model_s;
|
2021-05-24 20:14:03 +02:00
|
|
|
struct vk_ray_model_s;
|
2021-06-05 21:48:16 +02:00
|
|
|
struct model_s;
|
2021-04-09 23:59:04 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
struct vk_render_model_s *model;
|
2021-05-24 20:14:03 +02:00
|
|
|
VkBuffer buffer; // TODO must be uniform for all models. Shall we read it directly from vk_render?
|
2021-04-09 23:59:04 +02:00
|
|
|
} vk_ray_model_init_t;
|
|
|
|
|
2021-05-26 18:35:36 +02:00
|
|
|
struct vk_ray_model_s *VK_RayModelCreate( vk_ray_model_init_t model_init );
|
2021-05-24 20:14:03 +02:00
|
|
|
void VK_RayModelDestroy( struct vk_ray_model_s *model );
|
2021-02-27 22:43:49 +01:00
|
|
|
|
2021-04-09 23:59:04 +02:00
|
|
|
void VK_RayFrameBegin( void );
|
2021-06-05 21:48:16 +02:00
|
|
|
|
|
|
|
// TODO how to improve this render vs ray model storage/interaction?
|
2021-10-27 19:21:06 +02:00
|
|
|
void VK_RayFrameAddModel( struct vk_ray_model_s *model, const struct vk_render_model_s *render_model, const matrix3x4 *transform_row, const vec4_t color, color24 entcolor );
|
2021-03-03 20:58:40 +01:00
|
|
|
|
2021-07-17 20:45:28 +02:00
|
|
|
typedef struct {
|
|
|
|
VkBuffer buffer;
|
|
|
|
uint32_t offset;
|
|
|
|
uint32_t size;
|
|
|
|
} vk_buffer_region_t;
|
|
|
|
|
2021-03-03 20:58:40 +01:00
|
|
|
typedef struct {
|
|
|
|
VkCommandBuffer cmdbuf;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
VkImageView image_view;
|
|
|
|
VkImage image;
|
|
|
|
uint32_t width, height;
|
|
|
|
} dst;
|
|
|
|
|
2021-07-17 20:45:28 +02:00
|
|
|
// TODO inv_view/proj matrices instead of UBO
|
|
|
|
vk_buffer_region_t ubo;
|
2021-03-08 21:09:11 +01:00
|
|
|
|
|
|
|
// Buffer holding vertex and index data
|
|
|
|
struct {
|
|
|
|
VkBuffer buffer; // must be the same as in vk_ray_model_create_t TODO: validate or make impossible to specify incorrectly
|
2021-09-14 20:44:19 +02:00
|
|
|
uint64_t size;
|
2021-03-08 21:09:11 +01:00
|
|
|
} geometry_data;
|
2021-08-05 03:36:53 +02:00
|
|
|
|
|
|
|
float fov_angle_y;
|
2021-04-09 23:59:04 +02:00
|
|
|
} vk_ray_frame_render_args_t;
|
|
|
|
void VK_RayFrameEnd(const vk_ray_frame_render_args_t* args);
|
|
|
|
|
|
|
|
void VK_RayNewMap( void );
|
2021-05-03 20:17:01 +02:00
|
|
|
void VK_RayMapLoadEnd( void );
|
2021-02-27 22:43:49 +01:00
|
|
|
|
|
|
|
qboolean VK_RayInit( void );
|
|
|
|
void VK_RayShutdown( void );
|
|
|
|
|