attribute vec3 position;
attribute vec3 normal;
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
varying vec3 fragNormal;
void main()
{
fragNormal = (modelViewMatrix * vec4(normal, 0.0)).xyz;
gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);
}
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform vec3 DiffuseColor;
uniform vec3 PhongColor;
uniform float Edge;
uniform float Phong;
varying vec3 fragNormal;
void main()
{
vec3 color = DiffuseColor;
float f = fragNormal.z;
if (abs(f) < Edge) color = vec3(0.0);
if (f > Phong) color = PhongColor;
gl_FragColor = vec4(color, 1.0);
}
attribute vec3 position;
attribute vec2 texcoord;
uniform mat4 modelViewProjectionMatrix;
varying vec2 fragTexCoord;
void main()
{
fragTexCoord = vec2(texcoord.x, 1.0 - texcoord.y);
gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);
}
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform sampler2D tex;
varying vec2 fragTexCoord;
void main()
{
vec2 Offset0 = vec2(0.0, 0.0),
Offset1 = vec2(0.0, 0.0041667),
Offset2 = vec2(0.0, -0.0041667),
Offset3 = vec2( 0.003125, 0.0),
Offset4 = vec2(-0.003125, 0.0);
float KernelValue0 = -4.0,
KernelValue1 = 1.0,
KernelValue2 = 1.0,
KernelValue3 = 1.0,
KernelValue4 = 1.0;
vec3 tmp;
float luminance, sum = 0.0;
tmp = texture2D(tex, fragTexCoord + Offset0).rgb;
luminance = dot(vec3(0.2125, 0.7154, 0.0721), tmp);
sum += luminance * KernelValue0;
tmp = texture2D(tex, fragTexCoord + Offset1).rgb;
luminance = dot(vec3(0.2125, 0.7154, 0.0721), tmp);
sum += luminance * KernelValue1;
tmp = texture2D(tex, fragTexCoord + Offset2).rgb;
luminance = dot(vec3(0.2125, 0.7154, 0.0721), tmp);
sum += luminance * KernelValue2;
tmp = texture2D(tex, fragTexCoord + Offset3).rgb;
luminance = dot(vec3(0.2125, 0.7154, 0.0721), tmp);
sum += luminance * KernelValue3;
tmp = texture2D(tex, fragTexCoord + Offset4).rgb;
luminance = dot(vec3(0.2125, 0.7154, 0.0721), tmp);
sum += luminance * KernelValue4;
sum = 1.0 - sum;
gl_FragColor = vec4(sum, sum, sum, 1.0);
}