2020-05-15 12:22:17 +00:00
|
|
|
// NOTE: We currently do nothing, and just rely on the default shader behavior.
|
|
|
|
//
|
|
|
|
// However, in the future we might apply some depth transforms here.
|
|
|
|
|
|
|
|
#version 330 core
|
2020-05-17 03:59:00 +00:00
|
|
|
// #extension ARB_texture_storage : enable
|
2020-05-15 12:22:17 +00:00
|
|
|
|
|
|
|
#include <constants.glsl>
|
|
|
|
|
|
|
|
#define LIGHTING_TYPE LIGHTING_TYPE_REFLECTION
|
|
|
|
|
|
|
|
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
|
|
|
|
|
|
|
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
|
|
|
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
|
|
|
#elif (FLUID_MODE == FLUID_MODE_SHINY)
|
|
|
|
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define LIGHTING_DISTRIBUTION_SCHEME LIGHTING_DISTRIBUTION_SCHEME_MICROFACET
|
|
|
|
|
|
|
|
#define LIGHTING_DISTRIBUTION LIGHTING_DISTRIBUTION_BECKMANN
|
|
|
|
|
2020-07-15 11:30:49 +00:00
|
|
|
// Currently, we only need globals for the far plane.
|
|
|
|
#include <globals.glsl>
|
2020-07-02 20:10:22 +00:00
|
|
|
// // Currently, we only need lights for the light position
|
|
|
|
// #include <light.glsl>
|
2020-05-15 12:22:17 +00:00
|
|
|
|
2020-07-02 20:10:22 +00:00
|
|
|
// in vec3 FragPos; // FragPos from GS (output per emitvertex)
|
2020-05-17 03:59:00 +00:00
|
|
|
// flat in int FragLayer;
|
2020-05-15 12:22:17 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2020-05-17 03:59:00 +00:00
|
|
|
// Only need to do anything with point lights, since sun and moon should already have nonlinear
|
|
|
|
// distance.
|
2020-07-15 11:30:49 +00:00
|
|
|
///*if (FragLayer > 0) */{
|
|
|
|
// // get distance between fragment and light source
|
|
|
|
// float lightDistance = length(FragPos);
|
|
|
|
// // float lightDistance = length(FragPos - lights[((/*FragLayer*/1 - 1) & 31)].light_pos.xyz);
|
|
|
|
|
|
|
|
// // // map to [0;1] range by dividing by far_plane
|
|
|
|
// lightDistance = lightDistance / screen_res.w;//FragPos.w;//screen_res.w;
|
|
|
|
|
|
|
|
// // // write this as modified depth
|
|
|
|
// // // lightDistance = -1000.0 / (lightDistance + 10000.0);
|
|
|
|
// // // lightDistance /= screen_res.w;
|
|
|
|
// gl_FragDepth = lightDistance;// / /*FragPos.w;*/screen_res.w;//-1000.0 / (lightDistance + 1000.0);//lightDistance
|
|
|
|
//}
|
2020-05-15 12:22:17 +00:00
|
|
|
}
|