2023-10-18 20:50:40 +00:00
|
|
|
#version 430 core
|
2022-03-15 18:04:21 +00:00
|
|
|
// #extension ARB_texture_storage : enable
|
|
|
|
|
|
|
|
#define FIGURE_SHADER
|
|
|
|
|
|
|
|
#include <constants.glsl>
|
|
|
|
|
|
|
|
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
|
|
|
|
|
|
|
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
|
|
|
|
2022-10-23 19:03:21 +00:00
|
|
|
#if (FLUID_MODE == FLUID_MODE_LOW)
|
2022-03-15 18:04:21 +00:00
|
|
|
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
2022-09-23 14:04:47 +00:00
|
|
|
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
2022-03-15 18:04:21 +00:00
|
|
|
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define LIGHTING_DISTRIBUTION_SCHEME LIGHTING_DISTRIBUTION_SCHEME_MICROFACET
|
|
|
|
|
|
|
|
#define LIGHTING_DISTRIBUTION LIGHTING_DISTRIBUTION_BECKMANN
|
|
|
|
|
|
|
|
#define HAS_SHADOW_MAPS
|
|
|
|
|
|
|
|
// Currently, we only need globals for focus_off.
|
|
|
|
#include <globals.glsl>
|
|
|
|
// For shadow locals.
|
|
|
|
// #include <shadows.glsl>
|
|
|
|
|
|
|
|
layout (std140, set = 0, binding = 14)
|
|
|
|
uniform u_rain_occlusion {
|
|
|
|
mat4 rainOcclusionMatrices;
|
|
|
|
mat4 texture_mat;
|
2022-07-02 10:00:02 +00:00
|
|
|
mat4 rain_dir_mat;
|
2022-05-30 21:02:22 +00:00
|
|
|
float integrated_rain_vel;
|
2022-06-11 20:57:07 +00:00
|
|
|
float rain_density;
|
|
|
|
vec2 occlusion_dummy; // Fix alignment.
|
2022-03-15 18:04:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Accurate packed shadow maps for many lights at once!
|
|
|
|
*
|
|
|
|
* Ideally, we would just write to a bitmask...
|
|
|
|
*
|
|
|
|
* */
|
|
|
|
|
|
|
|
layout(location = 0) in uint v_pos_norm;
|
|
|
|
layout(location = 1) in uint v_atlas_pos;
|
|
|
|
// in uint v_col_light;
|
|
|
|
// in vec4 v_pos;
|
|
|
|
|
|
|
|
layout (std140, set = 1, binding = 0)
|
|
|
|
uniform u_locals {
|
|
|
|
mat4 model_mat;
|
|
|
|
vec4 highlight_col;
|
|
|
|
vec4 model_light;
|
|
|
|
vec4 model_glow;
|
|
|
|
ivec4 atlas_offs;
|
|
|
|
vec3 model_pos;
|
|
|
|
// bit 0 - is player
|
|
|
|
// bit 1-31 - unused
|
|
|
|
int flags;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BoneData {
|
|
|
|
mat4 bone_mat;
|
|
|
|
mat4 normals_mat;
|
|
|
|
};
|
|
|
|
|
|
|
|
layout (std140, set = 1, binding = 1)
|
|
|
|
uniform u_bones {
|
|
|
|
// Warning: might not actually be 16 elements long. Don't index out of bounds!
|
|
|
|
BoneData bones[16];
|
|
|
|
};
|
|
|
|
|
|
|
|
// out vec4 shadowMapCoord;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
uint bone_idx = (v_pos_norm >> 27) & 0xFu;
|
|
|
|
vec3 pos = (vec3((uvec3(v_pos_norm) >> uvec3(0, 9, 18)) & uvec3(0x1FFu)) - 256.0) / 2.0;
|
|
|
|
|
|
|
|
vec3 f_pos = (
|
|
|
|
bones[bone_idx].bone_mat *
|
|
|
|
vec4(pos, 1.0)
|
|
|
|
).xyz + (model_pos - focus_off.xyz/* + vec3(0.0, 0.0, 0.0001)*/);
|
|
|
|
|
|
|
|
gl_Position = rainOcclusionMatrices * vec4(f_pos, 1.0);
|
|
|
|
}
|