godot/drivers/gles2/shaders/canvas.glsl
Juan Linietsky 1cad087969 Making Godot Easier to Use..
-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-Auto indenter in code editor, this makes it much easier to paste external code.
-Zoom in 2D viewport now uses the mouse pointer as reference.
-Obscure hack to see where code/line of GDScript in C++ backtrace.
-Fixed a bug where keys would get stuck on X11 if pressed simultaneously
-Added Api on IP singleton to request local IPs.
-Premultiplied alpha support when importing texture, editing PNGs and as a blend mode.
2014-05-24 01:35:47 -03:00

72 lines
1.3 KiB
GLSL

[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 modelview_matrix;
uniform highp mat4 extra_matrix;
attribute highp vec3 vertex; // attrib:0
attribute vec4 color_attrib; // attrib:3
attribute highp vec2 uv_attrib; // attrib:4
varying vec2 uv_interp;
varying vec4 color_interp;
//uniform bool snap_pixels;
void main() {
color_interp = color_attrib;
uv_interp = uv_attrib;
highp vec4 outvec = vec4(vertex, 1.0);
outvec = extra_matrix * outvec;
outvec = modelview_matrix * outvec;
#ifdef USE_PIXEL_SNAP
outvec.xy=floor(outvec.xy+0.5);
#endif
gl_Position = projection_matrix * outvec;
}
[fragment]
#ifdef USE_GLES_OVER_GL
#define mediump
#define highp
#else
precision mediump float;
precision mediump int;
#endif
// texunit:0
uniform sampler2D texture;
varying vec2 uv_interp;
varying vec4 color_interp;
#ifdef MOMO
#endif
void main() {
vec4 color = color_interp;
color *= texture2D( texture, uv_interp );
#ifdef DEBUG_ENCODED_32
highp float enc32 = dot( color,highp vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) );
color = vec4(vec3(enc32),1.0);
#endif
// color.rgb*=color.a;
gl_FragColor = color;
}