mirror of https://github.com/axmolengine/axmol.git
Shader fixes for windows
This commit is contained in:
parent
e8d2cf7871
commit
488a8deae9
|
@ -29,13 +29,13 @@ attribute vec4 a_position;
|
|||
attribute vec2 a_texCoord;
|
||||
attribute vec4 a_color;
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
varying lowp vec4 v_fragmentColor;
|
||||
varying mediump vec2 v_texCoord;
|
||||
#else\n
|
||||
\n#else\n
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const char* ccLabelDistanceFieldNormal_frag = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
|
@ -12,13 +12,13 @@ uniform vec4 v_textColor;
|
|||
void main()
|
||||
{
|
||||
vec4 color = texture2D(CC_Texture0, v_texCoord);
|
||||
//the texture use dual channel 16-bit output for distance_map
|
||||
//float dist = color.b+color.g/256.0;
|
||||
// the texture use single channel 8-bit output for distance_map
|
||||
//the texture use dual channel 16-bit output for distance_map \n
|
||||
//float dist = color.b+color.g/256.0; \n
|
||||
// the texture use single channel 8-bit output for distance_map \n
|
||||
float dist = color.a;
|
||||
//todo:Implementation 'fwidth' for glsl 1.0
|
||||
//float width = fwidth(dist);
|
||||
//assign width for constant will lead to a little bit fuzzy,it's temporary measure.
|
||||
//todo:Implementation 'fwidth' for glsl 1.0 \n
|
||||
//float width = fwidth(dist); \n
|
||||
//assign width for constant will lead to a little bit fuzzy,it's temporary measure.\n
|
||||
float width = 0.04;
|
||||
float alpha = smoothstep(0.5-width, 0.5+width, dist) * v_textColor.a;
|
||||
gl_FragColor = v_fragmentColor * vec4(v_textColor.rgb,alpha);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const char* ccLabelDistanceFieldGlow_frag = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
|
@ -13,12 +13,12 @@ uniform vec4 v_textColor;
|
|||
void main()
|
||||
{
|
||||
float dist = texture2D(CC_Texture0, v_texCoord).a;
|
||||
//todo:Implementation 'fwidth' for glsl 1.0
|
||||
//float width = fwidth(dist);
|
||||
//assign width for constant will lead to a little bit fuzzy,it's temporary measure.
|
||||
//todo:Implementation 'fwidth' for glsl 1.0 \n
|
||||
//float width = fwidth(dist); \n
|
||||
//assign width for constant will lead to a little bit fuzzy,it's temporary measure.\n
|
||||
float width = 0.04;
|
||||
float alpha = smoothstep(0.5-width, 0.5+width, dist);
|
||||
//glow
|
||||
//glow \n
|
||||
float mu = smoothstep(0.5, 1.0, sqrt(dist));
|
||||
vec4 color = v_effectColor*(1.0-alpha) + v_textColor*alpha;
|
||||
gl_FragColor = v_fragmentColor * vec4(color.rgb, max(alpha,mu)*color.a);
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
*/
|
||||
|
||||
const char* ccLabelNormal_frag = STRINGIFY(
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
|
@ -35,8 +35,8 @@ uniform vec4 v_textColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = v_fragmentColor * vec4( v_textColor.rgb,// RGB from uniform
|
||||
v_textColor.a * texture2D(CC_Texture0, v_texCoord).a// A from texture & uniform
|
||||
gl_FragColor = v_fragmentColor * vec4( v_textColor.rgb,// RGB from uniform\n
|
||||
v_textColor.a * texture2D(CC_Texture0, v_texCoord).a// A from texture & uniform\n
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
/*
|
||||
* LICENSE ???
|
||||
*/
|
||||
const char* ccLabelOutline_frag = STRINGIFY(
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
const char* ccPositionColor_frag = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
varying vec4 v_fragmentColor;
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ const char* ccPositionColor_vert = STRINGIFY(
|
|||
attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
varying lowp vec4 v_fragmentColor;
|
||||
#else\n
|
||||
\n#else\n
|
||||
varying vec4 v_fragmentColor;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -21,20 +21,20 @@
|
|||
|
||||
const char* ccPositionColorLengthTexture_frag = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES\n
|
||||
// #extension GL_OES_standard_derivatives : enable
|
||||
\n
|
||||
\n#ifdef GL_ES\n
|
||||
// #extension GL_OES_standard_derivatives : enable\n
|
||||
|
||||
varying mediump vec4 v_color;
|
||||
varying mediump vec2 v_texcoord;
|
||||
#else\n
|
||||
\n#else\n
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texcoord;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
void main()
|
||||
{
|
||||
// #if defined GL_OES_standard_derivatives
|
||||
// gl_FragColor = v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord));
|
||||
// #if defined GL_OES_standard_derivatives\n
|
||||
// gl_FragColor = v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord));\n
|
||||
// #else\n
|
||||
gl_FragColor = v_color*step(0.0, 1.0 - length(v_texcoord));
|
||||
// #endif\n
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
const char* ccPositionColorLengthTexture_vert = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
attribute mediump vec4 a_position;
|
||||
attribute mediump vec2 a_texcoord;
|
||||
attribute mediump vec4 a_color;
|
||||
|
@ -29,7 +29,7 @@ attribute mediump vec4 a_color;
|
|||
varying mediump vec4 v_color;
|
||||
varying mediump vec2 v_texcoord;
|
||||
|
||||
#else\n
|
||||
\n#else\n
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texcoord;
|
||||
|
@ -37,7 +37,8 @@ attribute vec4 a_color;
|
|||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texcoord;
|
||||
#endif\n
|
||||
|
||||
\n#endif\n
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
const char* ccPositionTexture_frag = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
uniform sampler2D CC_Texture0;
|
||||
|
|
|
@ -28,11 +28,11 @@ const char* ccPositionTexture_vert = STRINGIFY(
|
|||
attribute vec4 a_position;
|
||||
attribute vec2 a_texCoord;
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
varying mediump vec2 v_texCoord;
|
||||
#else\n
|
||||
\n#else\n
|
||||
varying vec2 v_texCoord;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
const char* ccPositionTextureA8Color_frag = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
|
@ -35,8 +35,8 @@ uniform sampler2D CC_Texture0;
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4( v_fragmentColor.rgb,// RGB from uniform
|
||||
v_fragmentColor.a * texture2D(CC_Texture0, v_texCoord).a // A from texture & uniform
|
||||
gl_FragColor = vec4( v_fragmentColor.rgb,// RGB from uniform\n
|
||||
v_fragmentColor.a * texture2D(CC_Texture0, v_texCoord).a // A from texture & uniform\n
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -29,13 +29,13 @@ attribute vec4 a_position;
|
|||
attribute vec2 a_texCoord;
|
||||
attribute vec4 a_color;
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
varying lowp vec4 v_fragmentColor;
|
||||
varying mediump vec2 v_texCoord;
|
||||
#else\n
|
||||
\n#else\n
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
const char* ccPositionTextureColorAlphaTest_frag = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif
|
||||
\n#endif\n
|
||||
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
|
@ -37,8 +37,8 @@ void main()
|
|||
{
|
||||
vec4 texColor = texture2D(CC_Texture0, v_texCoord);
|
||||
|
||||
// mimic: glAlphaFunc(GL_GREATER)
|
||||
// pass if ( incoming_pixel >= CC_alpha_value ) => fail if incoming_pixel < CC_alpha_value
|
||||
\n// mimic: glAlphaFunc(GL_GREATER)
|
||||
\n// pass if ( incoming_pixel >= CC_alpha_value ) => fail if incoming_pixel < CC_alpha_value\n
|
||||
|
||||
if ( texColor.a <= CC_alpha_value )
|
||||
discard;
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
*/
|
||||
|
||||
const char* ccPositionTextureColor_noMVP_frag = STRINGIFY(
|
||||
#ifdef GL_ES
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif
|
||||
\n#endif\n
|
||||
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
|
|
|
@ -28,13 +28,13 @@ attribute vec4 a_position;
|
|||
attribute vec2 a_texCoord;
|
||||
attribute vec4 a_color;
|
||||
|
||||
#ifdef GL_ES
|
||||
\n#ifdef GL_ES\n
|
||||
varying lowp vec4 v_fragmentColor;
|
||||
varying mediump vec2 v_texCoord;
|
||||
#else
|
||||
\n#else\n
|
||||
varying vec4 v_fragmentColor;
|
||||
varying vec2 v_texCoord;
|
||||
#endif
|
||||
\n#endif\n
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
const char* ccPositionTexture_uColor_frag = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
uniform vec4 u_color;
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ const char* ccPositionTexture_uColor_vert = STRINGIFY(
|
|||
attribute vec4 a_position;
|
||||
attribute vec2 a_texCoord;
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
varying mediump vec2 v_texCoord;
|
||||
#else\n
|
||||
\n#else\n
|
||||
varying vec2 v_texCoord;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
const char* ccPosition_uColor_frag = STRINGIFY(
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
precision lowp float;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
varying vec4 v_fragmentColor;
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ attribute vec4 a_position;
|
|||
uniform vec4 u_color;
|
||||
uniform float u_pointSize;
|
||||
|
||||
#ifdef GL_ES\n
|
||||
\n#ifdef GL_ES\n
|
||||
varying lowp vec4 v_fragmentColor;
|
||||
#else\n
|
||||
\n#else\n
|
||||
varying vec4 v_fragmentColor;
|
||||
#endif\n
|
||||
\n#endif\n
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue