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