#include "vkpt.h"
#include "precomputed_sky.h"
#include "refresh/refresh.h"
#include <math.h>
#include <assert.h>
#include "dds.h"
Go to the source code of this file.
Classes | |
struct | ImageGPUInfo |
struct | ShadowVertex |
struct | ShadowFace |
struct | Shadowmap |
struct | ShadowmapGeometry |
Macros | |
#define | _USE_MATH_DEFINES |
#define | EARTH_SURFACE_RADIUS (6360.0f) |
#define | EARTH_ATMOSPHERE_RADIUS (6420.f) |
#define | STROGGOS_SURFACE_RADIUS (6360.0f) |
#define | STROGGOS_ATMOSPHERE_RADIUS (6520.f) |
#define | DIST_TO_HORIZON(LOW, HIGH) ( HIGH*HIGH - LOW*LOW ) |
#define | PRECOMPUTED_SKY_BINDING_IDX 0 |
#define | PRECOMPUTED_SKY_UBO_DESC_SET_IDX 3 |
#define | ISBITMASK(header, r, g, b, a) ( header.RBitMask == r && header.GBitMask == g && header.BBitMask == b && header.ABitMask == a ) |
#define | MATRIX(row, col) (row * 4 + col) |
Functions | |
void | ReleaseInfo (struct ImageGPUInfo *Info) |
VkResult | UploadImage (void *FirstPixel, size_t total_size, unsigned int Width, unsigned int Height, unsigned int Depth, unsigned int ArraySize, unsigned char Cube, VkFormat PixelFormat, uint32_t Binding, struct ImageGPUInfo *Info, const char *DebugName) |
qboolean | LoadImageFromDDS (const char *FileName, uint32_t Binding, struct ImageGPUInfo *Info, const char *DebugName) |
VkDescriptorSetLayout * | SkyGetDescriptorLayout () |
VkDescriptorSet | SkyGetDescriptorSet () |
VkResult | vkpt_uniform_precomputed_buffer_create () |
VkResult | vkpt_uniform_precomputed_buffer_destroy () |
VkResult | vkpt_uniform_precomputed_buffer_update () |
void | create_identity_matrix (float matrix[16]) |
void | create_look_at_matrix (float matrix[16], vec3_t EyePosition, vec3_t EyeDirection, vec3_t UpDirection) |
void | create_centered_orthographic_matrix (float matrix[16], float xmin, float xmax, float ymin, float ymax, float znear, float zfar) |
void | UpdateTerrainShadowMapView (vec3_t forward) |
VkResult | SkyLoadScatterParameters (SkyPreset preset) |
VkResult | SkyInitializeDataGPU () |
void | SkyReleaseDataGPU () |
struct ShadowmapGeometry | FillVertexAndIndexBuffers (const char *FileName, unsigned int SideSize, float size_km) |
void | ReleaseShadowmap (struct Shadowmap *InOutShadowmap) |
void | CreateShadowMap (struct Shadowmap *InOutShadowmap) |
void | InitializeShadowmapResources () |
void | ReleaseShadowmapResources () |
void | RecordCommandBufferShadowmap (VkCommandBuffer cmd_buf) |
Variables | |
const struct AtmosphereParameters * | Constants = NULL |
static struct AtmosphereParameters | Params_Earth |
static struct AtmosphereParameters | Params_Stroggos |
struct ImageGPUInfo | SkyTransmittance |
struct ImageGPUInfo | SkyInscatter |
struct ImageGPUInfo | SkyIrradiance |
struct ImageGPUInfo | SkyClouds |
struct ImageGPUInfo | TerrainAlbedo |
struct ImageGPUInfo | TerrainNormals |
struct ImageGPUInfo | TerrainDepth |
VkDescriptorSetLayout | uniform_precomputed_descriptor_layout |
VkDescriptorSet | desc_set_precomputed_ubo |
static BufferResource_t | atmosphere_params_buffer |
static VkDescriptorPool | desc_pool_precomputed_ubo |
float | terrain_shadowmap_viewproj [16] = { 0.f } |
struct Shadowmap | ShadowmapData |
struct ShadowmapGeometry | ShadowmapGrid |
VkPipelineLayout | pipeline_layout_smap |
VkRenderPass | render_pass_smap |
VkPipeline | pipeline_smap |
#define _USE_MATH_DEFINES |
Definition at line 22 of file precomputed_sky.c.
#define DIST_TO_HORIZON | ( | LOW, | |
HIGH | |||
) | ( HIGH*HIGH - LOW*LOW ) |
Definition at line 36 of file precomputed_sky.c.
#define EARTH_ATMOSPHERE_RADIUS (6420.f) |
Definition at line 33 of file precomputed_sky.c.
#define EARTH_SURFACE_RADIUS (6360.0f) |
Definition at line 32 of file precomputed_sky.c.
#define ISBITMASK | ( | header, | |
r, | |||
g, | |||
b, | |||
a | |||
) | ( header.RBitMask == r && header.GBitMask == g && header.BBitMask == b && header.ABitMask == a ) |
Definition at line 284 of file precomputed_sky.c.
#define MATRIX | ( | row, | |
col | |||
) | (row * 4 + col) |
Definition at line 471 of file precomputed_sky.c.
#define PRECOMPUTED_SKY_BINDING_IDX 0 |
Definition at line 93 of file precomputed_sky.c.
#define PRECOMPUTED_SKY_UBO_DESC_SET_IDX 3 |
Definition at line 94 of file precomputed_sky.c.
#define STROGGOS_ATMOSPHERE_RADIUS (6520.f) |
Definition at line 35 of file precomputed_sky.c.
#define STROGGOS_SURFACE_RADIUS (6360.0f) |
Definition at line 34 of file precomputed_sky.c.
void create_centered_orthographic_matrix | ( | float | matrix[16], |
float | xmin, | ||
float | xmax, | ||
float | ymin, | ||
float | ymax, | ||
float | znear, | ||
float | zfar | ||
) |
void create_identity_matrix | ( | float | matrix[16] | ) |
void create_look_at_matrix | ( | float | matrix[16], |
vec3_t | EyePosition, | ||
vec3_t | EyeDirection, | ||
vec3_t | UpDirection | ||
) |
Definition at line 868 of file precomputed_sky.c.
Referenced by InitializeShadowmapResources().
struct ShadowmapGeometry FillVertexAndIndexBuffers | ( | const char * | FileName, |
unsigned int | SideSize, | ||
float | size_km | ||
) |
Definition at line 679 of file precomputed_sky.c.
Referenced by InitializeShadowmapResources().
void InitializeShadowmapResources | ( | ) |
Definition at line 975 of file precomputed_sky.c.
Referenced by vkpt_physical_sky_initialize().
qboolean LoadImageFromDDS | ( | const char * | FileName, |
uint32_t | Binding, | ||
struct ImageGPUInfo * | Info, | ||
const char * | DebugName | ||
) |
Definition at line 286 of file precomputed_sky.c.
Referenced by SkyInitializeDataGPU(), and SkyLoadScatterParameters().
void RecordCommandBufferShadowmap | ( | VkCommandBuffer | cmd_buf | ) |
Definition at line 991 of file precomputed_sky.c.
Referenced by vkpt_physical_sky_record_cmd_buffer().
void ReleaseInfo | ( | struct ImageGPUInfo * | Info | ) |
Definition at line 73 of file precomputed_sky.c.
Referenced by SkyLoadScatterParameters(), and SkyReleaseDataGPU().
void ReleaseShadowmapResources | ( | ) |
VkDescriptorSetLayout* SkyGetDescriptorLayout | ( | ) |
Definition at line 356 of file precomputed_sky.c.
Referenced by vkpt_physical_sky_initialize().
VkDescriptorSet SkyGetDescriptorSet | ( | ) |
Definition at line 361 of file precomputed_sky.c.
Referenced by vkpt_physical_sky_record_cmd_buffer().
VkResult SkyInitializeDataGPU | ( | ) |
Definition at line 597 of file precomputed_sky.c.
Referenced by vkpt_physical_sky_initialize().
VkResult SkyLoadScatterParameters | ( | SkyPreset | preset | ) |
Definition at line 565 of file precomputed_sky.c.
Referenced by vkpt_evaluate_sun_light().
void SkyReleaseDataGPU | ( | ) |
void UpdateTerrainShadowMapView | ( | vec3_t | forward | ) |
Definition at line 550 of file precomputed_sky.c.
Referenced by vkpt_physical_sky_update_ubo().
VkResult UploadImage | ( | void * | FirstPixel, |
size_t | total_size, | ||
unsigned int | Width, | ||
unsigned int | Height, | ||
unsigned int | Depth, | ||
unsigned int | ArraySize, | ||
unsigned char | Cube, | ||
VkFormat | PixelFormat, | ||
uint32_t | Binding, | ||
struct ImageGPUInfo * | Info, | ||
const char * | DebugName | ||
) |
VkResult vkpt_uniform_precomputed_buffer_create | ( | ) |
Definition at line 367 of file precomputed_sky.c.
Referenced by SkyInitializeDataGPU().
VkResult vkpt_uniform_precomputed_buffer_destroy | ( | ) |
VkResult vkpt_uniform_precomputed_buffer_update | ( | ) |
|
static |
Definition at line 96 of file precomputed_sky.c.
Referenced by vkpt_uniform_precomputed_buffer_create(), vkpt_uniform_precomputed_buffer_destroy(), and vkpt_uniform_precomputed_buffer_update().
const struct AtmosphereParameters* Constants = NULL |
Definition at line 30 of file precomputed_sky.c.
Referenced by SkyLoadScatterParameters(), and vkpt_uniform_precomputed_buffer_update().
|
static |
Definition at line 97 of file precomputed_sky.c.
Referenced by vkpt_uniform_precomputed_buffer_create(), and vkpt_uniform_precomputed_buffer_destroy().
VkDescriptorSet desc_set_precomputed_ubo |
Definition at line 91 of file precomputed_sky.c.
Referenced by SkyGetDescriptorSet(), and vkpt_uniform_precomputed_buffer_create().
|
static |
Definition at line 38 of file precomputed_sky.c.
Referenced by SkyLoadScatterParameters().
|
static |
Definition at line 50 of file precomputed_sky.c.
Referenced by SkyLoadScatterParameters().
VkPipelineLayout pipeline_layout_smap |
Definition at line 24 of file shadow_map.c.
Referenced by RecordCommandBufferShadowmap(), vkpt_shadow_map_create_pipelines(), vkpt_shadow_map_destroy(), vkpt_shadow_map_initialize(), and vkpt_shadow_map_render().
VkPipeline pipeline_smap |
Definition at line 26 of file shadow_map.c.
Referenced by RecordCommandBufferShadowmap(), vkpt_shadow_map_create_pipelines(), vkpt_shadow_map_destroy_pipelines(), and vkpt_shadow_map_render().
VkRenderPass render_pass_smap |
Definition at line 25 of file shadow_map.c.
Referenced by create_render_pass(), CreateShadowMap(), RecordCommandBufferShadowmap(), vkpt_shadow_map_create_pipelines(), vkpt_shadow_map_destroy(), and vkpt_shadow_map_render().
struct Shadowmap ShadowmapData |
Definition at line 668 of file precomputed_sky.c.
Referenced by FillVertexAndIndexBuffers(), InitializeShadowmapResources(), RecordCommandBufferShadowmap(), and ReleaseShadowmapResources().
struct ShadowmapGeometry ShadowmapGrid |
Definition at line 669 of file precomputed_sky.c.
Referenced by InitializeShadowmapResources(), RecordCommandBufferShadowmap(), and ReleaseShadowmapResources().
struct ImageGPUInfo SkyClouds |
Definition at line 84 of file precomputed_sky.c.
Referenced by SkyInitializeDataGPU(), and SkyReleaseDataGPU().
struct ImageGPUInfo SkyInscatter |
Definition at line 82 of file precomputed_sky.c.
Referenced by SkyLoadScatterParameters(), and SkyReleaseDataGPU().
struct ImageGPUInfo SkyIrradiance |
Definition at line 83 of file precomputed_sky.c.
Referenced by SkyLoadScatterParameters(), and SkyReleaseDataGPU().
struct ImageGPUInfo SkyTransmittance |
Definition at line 81 of file precomputed_sky.c.
Referenced by SkyLoadScatterParameters(), and SkyReleaseDataGPU().
float terrain_shadowmap_viewproj[16] = { 0.f } |
Definition at line 99 of file precomputed_sky.c.
Referenced by RecordCommandBufferShadowmap(), UpdateTerrainShadowMapView(), and vkpt_physical_sky_record_cmd_buffer().
struct ImageGPUInfo TerrainAlbedo |
Definition at line 86 of file precomputed_sky.c.
Referenced by SkyInitializeDataGPU(), and SkyReleaseDataGPU().
struct ImageGPUInfo TerrainDepth |
Definition at line 88 of file precomputed_sky.c.
Referenced by SkyInitializeDataGPU(), and SkyReleaseDataGPU().
struct ImageGPUInfo TerrainNormals |
Definition at line 87 of file precomputed_sky.c.
Referenced by SkyInitializeDataGPU(), and SkyReleaseDataGPU().
VkDescriptorSetLayout uniform_precomputed_descriptor_layout |
Definition at line 90 of file precomputed_sky.c.
Referenced by SkyGetDescriptorLayout(), vkpt_uniform_precomputed_buffer_create(), and vkpt_uniform_precomputed_buffer_destroy().