diff options
author | Carl Olsson <carl.olsson@gmail.com> | 2015-03-23 08:19:20 +1000 |
---|---|---|
committer | Carl Olsson <carl.olsson@gmail.com> | 2015-03-23 08:19:20 +1000 |
commit | fb2cdfe7edcc2ccafea7604afd104f582e5b9c17 (patch) | |
tree | d9555d9519648f95d7ed3663fbca50978bb12a1f /drivers/gles2/shaders/canvas_shadow.glsl | |
parent | 41686d5fdd0d72f167894f976d19b177789f1f63 (diff) | |
parent | e9f94ce8d2cc6805e74fffdf733e6dc5b5c530f5 (diff) |
Merge branch 'master' of https://github.com/not-surt/godot into snapping2
Conflicts:
tools/editor/plugins/canvas_item_editor_plugin.cpp
tools/editor/plugins/canvas_item_editor_plugin.h
Diffstat (limited to 'drivers/gles2/shaders/canvas_shadow.glsl')
-rw-r--r-- | drivers/gles2/shaders/canvas_shadow.glsl | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/drivers/gles2/shaders/canvas_shadow.glsl b/drivers/gles2/shaders/canvas_shadow.glsl new file mode 100644 index 0000000000..40cf321dce --- /dev/null +++ b/drivers/gles2/shaders/canvas_shadow.glsl @@ -0,0 +1,62 @@ +[vertex] + +#ifdef USE_GLES_OVER_GL +#define mediump +#define highp +#else +precision mediump float; +precision mediump int; +#endif + +uniform highp mat4 projection_matrix; +uniform highp mat4 light_matrix; +uniform highp mat4 world_matrix; + +attribute highp vec3 vertex; // attrib:0 + +#ifndef USE_DEPTH_SHADOWS + +varying vec4 position_interp; + +#endif + + +void main() { + + gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex,1.0))); + +#ifndef USE_DEPTH_SHADOWS + position_interp = gl_Position; +#endif + +} + +[fragment] + +#ifdef USE_GLES_OVER_GL +#define mediump +#define highp +#else +precision mediump float; +precision mediump int; +#endif + +#ifndef USE_DEPTH_SHADOWS + +varying vec4 position_interp; + +#endif + +void main() { + +#ifdef USE_DEPTH_SHADOWS + +#else + highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0;//bias; + highp vec4 comp = fract(depth * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0)); + comp -= comp.xxyz * vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0); + gl_FragColor = comp; +#endif + +} + |