2018-08-27 07:31:48 +02:00
|
|
|
/* clang-format off */
|
2017-12-04 13:41:34 +01:00
|
|
|
[vertex]
|
|
|
|
|
2018-12-20 14:09:07 +01:00
|
|
|
#ifdef USE_GLES_OVER_GL
|
2018-12-21 15:14:55 +01:00
|
|
|
#define lowp
|
2018-12-20 14:09:07 +01:00
|
|
|
#define mediump
|
|
|
|
#define highp
|
|
|
|
#else
|
|
|
|
precision highp float;
|
|
|
|
precision highp int;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
attribute highp vec3 vertex; // attrib:0
|
|
|
|
|
2017-12-04 13:41:34 +01:00
|
|
|
uniform highp mat4 projection_matrix;
|
2018-08-27 07:31:48 +02:00
|
|
|
/* clang-format on */
|
2017-12-04 13:41:34 +01:00
|
|
|
uniform highp mat4 light_matrix;
|
|
|
|
uniform highp mat4 world_matrix;
|
|
|
|
uniform highp float distance_norm;
|
|
|
|
|
2018-12-20 14:09:07 +01:00
|
|
|
varying highp vec4 position_interp;
|
2017-12-04 13:41:34 +01:00
|
|
|
|
|
|
|
void main() {
|
2018-08-24 14:50:59 +02:00
|
|
|
gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex, 1.0)));
|
|
|
|
position_interp = gl_Position;
|
2017-12-04 13:41:34 +01:00
|
|
|
}
|
|
|
|
|
2018-08-27 07:31:48 +02:00
|
|
|
/* clang-format off */
|
2017-12-04 13:41:34 +01:00
|
|
|
[fragment]
|
|
|
|
|
2018-12-20 14:09:07 +01:00
|
|
|
#ifdef USE_GLES_OVER_GL
|
2018-12-21 15:14:55 +01:00
|
|
|
#define lowp
|
2018-12-20 14:09:07 +01:00
|
|
|
#define mediump
|
|
|
|
#define highp
|
2017-12-04 13:41:34 +01:00
|
|
|
#else
|
2019-09-01 00:03:55 +02:00
|
|
|
#if defined(USE_HIGHP_PRECISION)
|
|
|
|
precision highp float;
|
|
|
|
precision highp int;
|
|
|
|
#else
|
2018-12-20 14:09:07 +01:00
|
|
|
precision mediump float;
|
|
|
|
precision mediump int;
|
|
|
|
#endif
|
2019-09-01 00:03:55 +02:00
|
|
|
#endif
|
2017-12-04 13:41:34 +01:00
|
|
|
|
2018-12-20 14:09:07 +01:00
|
|
|
varying highp vec4 position_interp;
|
|
|
|
/* clang-format on */
|
2017-12-04 13:41:34 +01:00
|
|
|
|
|
|
|
void main() {
|
2018-12-20 14:09:07 +01:00
|
|
|
highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; // bias
|
2017-12-04 13:41:34 +01:00
|
|
|
|
|
|
|
#ifdef USE_RGBA_SHADOWS
|
|
|
|
|
2019-07-27 17:05:26 +02:00
|
|
|
highp vec4 comp = fract(depth * vec4(255.0 * 255.0 * 255.0, 255.0 * 255.0, 255.0, 1.0));
|
|
|
|
comp -= comp.xxyz * vec4(0.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);
|
2018-12-20 14:09:07 +01:00
|
|
|
gl_FragColor = comp;
|
2017-12-04 13:41:34 +01:00
|
|
|
#else
|
|
|
|
|
2018-12-20 14:09:07 +01:00
|
|
|
gl_FragColor = vec4(depth);
|
2017-12-04 13:41:34 +01:00
|
|
|
#endif
|
|
|
|
}
|