shadows flag in Renderer
This commit is contained in:
@@ -16,20 +16,23 @@ void main(void) {
|
||||
|
||||
in vec3 view_dir, world_dir;
|
||||
|
||||
uniform vec2 dt, shadow_size;
|
||||
uniform vec2 dt;
|
||||
uniform float z_near;
|
||||
uniform sampler2D tex_coeff_brdf, tex_noise;
|
||||
uniform sampler2D tex_0, tex_1, tex_2, tex_3, tex_4, tex_5, tex_sh;
|
||||
//uniform sampler2DShadow tex_shadow[16];
|
||||
#ifdef SHADOWS
|
||||
uniform vec2 shadow_size;
|
||||
uniform sampler2DArrayShadow tex_shadows_cone;
|
||||
uniform sampler2DArray tex_depths_cone;
|
||||
uniform samplerCubeArrayShadow tex_shadows_omni;
|
||||
uniform samplerCubeArray tex_depths_omni;
|
||||
uniform samplerCube tex_env;
|
||||
uniform int lights_start, lights_count, soft_shadows_samples = 16, noise_size = 64;
|
||||
uniform bool soft_shadows_enabled = false;
|
||||
uniform float soft_shadows_quality = 1.;
|
||||
|
||||
uniform int soft_shadows_samples = 16, noise_size = 64;
|
||||
#endif
|
||||
uniform samplerCube tex_env;
|
||||
uniform int lights_start, lights_count;
|
||||
uniform vec4 fog_color = vec4(0.5, 0.5, 0.5, 1.);
|
||||
uniform float fog_decay = 10., fog_density = 0.;
|
||||
uniform mat3 view_mat;
|
||||
@@ -43,7 +46,7 @@ ivec2 tc;
|
||||
vec4 pos, lpos, shp;
|
||||
vec3 li, si, ldir, halfV, bn, bn2, lwdir;
|
||||
vec3 normal, geom_normal, vds, vds2;
|
||||
float rough_diff, rough_spec, dist, NdotL, NdotH, spot, ldist, diff, spec, sdist, shadow, shadow_dz;
|
||||
float rough_diff, rough_spec, dist, NdotL, NdotH, spot, ldist, diff, spec, sdist;
|
||||
uint flags;
|
||||
|
||||
|
||||
@@ -54,6 +57,7 @@ vec4 mapScreenToShadow(in int light_index, in vec3 offset) {
|
||||
}
|
||||
|
||||
|
||||
#ifdef SHADOWS
|
||||
#ifdef SPOT
|
||||
|
||||
float getShadowCone(in vec3 uvz, in int layer) {
|
||||
@@ -141,6 +145,7 @@ float rand(vec2 co) {
|
||||
float e = sin(mod(d, 3.14)) * c;
|
||||
return fract(e) - 0.5;
|
||||
}
|
||||
#endif // SHADOWS
|
||||
|
||||
vec4 qgl_lightTexture(int index, vec2 coord, vec4 tex_shift) {
|
||||
coord *= qgl_light_parameter[index].map.scale;
|
||||
@@ -173,6 +178,7 @@ void calcLight(in int index, in vec3 n, in vec3 v) {
|
||||
spot *= light_map_pix.a;
|
||||
#endif
|
||||
|
||||
#ifdef SHADOWS
|
||||
if (int(round(qgl_light_parameter[index].flags)) == 1 && bitfieldExtract(flags, 3, 1) == 1 && (spot > 1E-4)) {
|
||||
#ifndef SPOT
|
||||
vec3 odir = -(view_mat * ldir);
|
||||
@@ -260,6 +266,7 @@ void calcLight(in int index, in vec3 n, in vec3 v) {
|
||||
//shadow += getShadowCone(shp.xyz, layer, vec2(0));
|
||||
|
||||
}
|
||||
#endif // SHADOWS
|
||||
|
||||
vec3 dist_decay = vec3(1., ldist, ldist*ldist);
|
||||
spot /= dot(qgl_light_parameter[index].decay_intensity.xyz, dist_decay);
|
||||
|
||||
Reference in New Issue
Block a user