2021-03-28 22:56:46 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "vk_const.h"
|
|
|
|
|
|
|
|
#include "xash3d_types.h"
|
|
|
|
#include "protocol.h"
|
|
|
|
#include "const.h"
|
|
|
|
#include "bspfile.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
vec3_t emissive;
|
|
|
|
qboolean set;
|
2021-06-05 21:48:16 +02:00
|
|
|
} vk_emissive_texture_t;
|
2021-03-28 22:56:46 +02:00
|
|
|
|
|
|
|
typedef struct {
|
2021-09-19 23:43:22 +02:00
|
|
|
uint8_t num_point_lights;
|
2021-04-16 20:43:37 +02:00
|
|
|
uint8_t num_emissive_surfaces;
|
2021-09-19 23:43:22 +02:00
|
|
|
uint8_t point_lights[MAX_VISIBLE_POINT_LIGHTS];
|
2021-04-16 20:43:37 +02:00
|
|
|
uint8_t emissive_surfaces[MAX_VISIBLE_SURFACE_LIGHTS];
|
2021-06-05 21:48:16 +02:00
|
|
|
} vk_lights_cell_t;
|
2021-03-28 22:56:46 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
vec3_t emissive;
|
2021-06-05 21:48:16 +02:00
|
|
|
uint32_t kusok_index;
|
|
|
|
matrix3x4 transform;
|
2021-03-28 22:56:46 +02:00
|
|
|
} vk_emissive_surface_t;
|
|
|
|
|
2021-09-19 23:43:22 +02:00
|
|
|
typedef struct {
|
|
|
|
vec4_t origin, color;
|
|
|
|
} vk_point_light_t;
|
|
|
|
|
|
|
|
// TODO spotlight
|
|
|
|
|
2021-03-28 22:56:46 +02:00
|
|
|
typedef struct {
|
2021-04-12 20:07:41 +02:00
|
|
|
struct {
|
2021-06-05 21:48:16 +02:00
|
|
|
int grid_min_cell[3];
|
|
|
|
int grid_size[3];
|
|
|
|
int grid_cells;
|
|
|
|
|
|
|
|
vk_emissive_texture_t emissive_textures[MAX_TEXTURES];
|
|
|
|
} map;
|
2021-04-16 20:43:37 +02:00
|
|
|
|
2021-06-05 21:48:16 +02:00
|
|
|
int num_emissive_surfaces;
|
2021-10-14 20:45:08 +02:00
|
|
|
vk_emissive_surface_t emissive_surfaces[MAX_SURFACE_LIGHTS];
|
2021-04-16 20:43:37 +02:00
|
|
|
|
2021-09-19 23:43:22 +02:00
|
|
|
int num_point_lights;
|
|
|
|
vk_point_light_t point_lights[MAX_POINT_LIGHTS];
|
|
|
|
|
2021-06-05 21:48:16 +02:00
|
|
|
vk_lights_cell_t cells[MAX_LIGHT_CLUSTERS];
|
|
|
|
} vk_lights_t;
|
2021-03-28 22:56:46 +02:00
|
|
|
|
2021-06-05 21:48:16 +02:00
|
|
|
extern vk_lights_t g_lights;
|
2021-03-28 22:56:46 +02:00
|
|
|
|
2021-10-13 20:57:59 +02:00
|
|
|
void VK_LightsInit( void );
|
2021-03-28 22:56:46 +02:00
|
|
|
void VK_LightsShutdown( void );
|
2021-06-05 21:48:16 +02:00
|
|
|
|
|
|
|
void VK_LightsNewMap( void );
|
2021-09-14 19:24:27 +02:00
|
|
|
void VK_LightsLoadMapStaticLights( void );
|
2021-06-05 21:48:16 +02:00
|
|
|
|
|
|
|
void VK_LightsFrameInit( void );
|
|
|
|
|
2021-08-26 19:41:35 +02:00
|
|
|
// TODO there is an arguably better way to organize this.
|
|
|
|
// a. this only belongs to ray tracing mode
|
|
|
|
// b. kusochki now have emissive color, so it probably makes more sense to not store emissive
|
|
|
|
// separately in emissive surfaces.
|
2021-08-26 18:18:20 +02:00
|
|
|
struct vk_render_geometry_s;
|
2021-09-26 18:15:19 +02:00
|
|
|
const vk_emissive_surface_t *VK_LightsAddEmissiveSurface( const struct vk_render_geometry_s *geom, const matrix3x4 *transform_row, qboolean static_map );
|
2021-06-05 21:48:16 +02:00
|
|
|
|
|
|
|
void VK_LightsFrameFinalize( void );
|