Upload new game: Koala Seasons

This commit is contained in:
Ray
2017-04-18 10:42:15 +02:00
parent 99c226b344
commit a5c8ce2a34
25 changed files with 6695 additions and 0 deletions

View File

@ -0,0 +1,25 @@
#version 100
// Input vertex attributes
attribute vec3 vertexPosition;
attribute vec2 vertexTexCoord;
attribute vec4 vertexColor;
// Input uniform values
uniform mat4 mvpMatrix;
// Output vertex attributes (to fragment shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// NOTE: Add here your custom variables
void main()
{
// Send vertex attributes to fragment shader
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
// Calculate final vertex position
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
}

View File

@ -0,0 +1,63 @@
#version 100
precision mediump float;
// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord;
in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
vec3 BlendOverlay(vec3 base, vec3 blend)
{
float red;
float green;
float blue;
if (base.r < 0.5) red = 2.0*base.r*blend.r;
else red = 1.0 - 2.0*(1.0 - base.r)*(1.0 - blend.r);
if (base.g < 0.5) green = 2.0*base.g*blend.g;
else green = 1.0 - 2.0 *(1.0 - base.g)*(1.0 - blend.g);
if (base.b < 0.5) blue = 2.0*base.b*blend.b;
else blue = 1.0 - 2.0 *(1.0 - base.b)*(1.0 - blend.b);
return vec3(red, green, blue);
}
void main()
{
// Blending Overlay
vec4 base = texture2D(texture0, fragTexCoord);
// No blending shader -> 64 FPS (1280x720)
//gl_FragColor = base*fragColor;
// Option01 -> 50 FPS (1280x720), 200 FPS (640x360)
vec3 final = BlendOverlay(base.rgb, fragColor.rgb);
gl_FragColor = vec4(final.rgb, base.a*fragColor.a);
// Option02 (Doesn't work) -> 63 FPS (1280x720)
//float luminance = (base.r*0.2126) + (base.g*0.7152) + (base.b*0.0722);
//gl_FragColor = vec4(tint*luminance, base.a);
// Option03 (no branches, precalculated ifs) -> 28 FPS (1280x720)
/*
vec4 blend = fragColor;
//if (base.a == 0.0) discard; // No improvement
vec3 br = clamp(sign(base.rgb - vec3(0.5)), vec3(0.0), vec3(1.0));
vec3 multiply = 2.0 * base.rgb * blend.rgb;
vec3 screen = vec3(1.0) - 2.0 * (vec3(1.0) - base.rgb)*(vec3(1.0) - blend.rgb);
vec3 overlay = mix(multiply, screen, br);
vec3 finalColor = mix(base.rgb, overlay, blend.a);
gl_FragColor = vec4(finalColor, base.a);
*/
// Option04 (no branches, using built-in functions) -> 38 FPS (1280x720)
//gl_FragColor = vec4(mix(1 - 2*(1 - base.rgb)*(1 - tint), 2*base.rgb*tint, step(0.5, base.rgb)), base.a);
}

View File

@ -0,0 +1,25 @@
#version 330
// Input vertex attributes
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec4 vertexColor;
// Input uniform values
uniform mat4 mvpMatrix;
// Output vertex attributes (to fragment shader)
out vec2 fragTexCoord;
out vec4 fragColor;
// NOTE: Add here your custom variables
void main()
{
// Send vertex attributes to fragment shader
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
// Calculate final vertex position
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
}

View File

@ -0,0 +1,64 @@
#version 330
// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord;
in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;
// NOTE: Add here your custom variables
vec3 BlendOverlay(vec3 base, vec3 blend)
{
float red;
float green;
float blue;
if (base.r < 0.5) red = 2.0*base.r*blend.r;
else red = 1.0 - 2.0*(1.0 - base.r)*(1.0 - blend.r);
if (base.g < 0.5) green = 2.0*base.g*blend.g;
else green = 1.0 - 2.0 *(1.0 - base.g)*(1.0 - blend.g);
if (base.b < 0.5) blue = 2.0*base.b*blend.b;
else blue = 1.0 - 2.0 *(1.0 - base.b)*(1.0 - blend.b);
return vec3(red, green, blue);
}
void main()
{
// Blending Overlay
vec4 base = texture2D(texture0, fragTexCoord);
// No blending shader -> 64 FPS (1280x720)
//gl_FragColor = base*tintColor;
// Option01 -> 50 FPS (1280x720), 200 FPS (640x360)
vec3 final = BlendOverlay(base.rgb, fragColor.rgb);
finalColor = vec4(final.rgb, base.a*fragColor.a);
// Option02 (Doesn't work) -> 63 FPS (1280x720)
//float luminance = (base.r*0.2126) + (base.g*0.7152) + (base.b*0.0722);
//gl_FragColor = vec4(tintColor.rgb*luminance, base.a);
// Option03 (no branches, precalculated ifs) -> 28 FPS (1280x720)
/*
vec4 blend = tintColor;
//if (base.a == 0.0) discard; // No improvement
vec3 br = clamp(sign(base.rgb - vec3(0.5)), vec3(0.0), vec3(1.0));
vec3 multiply = 2.0 * base.rgb * blend.rgb;
vec3 screen = vec3(1.0) - 2.0 * (vec3(1.0) - base.rgb)*(vec3(1.0) - blend.rgb);
vec3 overlay = mix(multiply, screen, br);
vec3 finalColor = mix(base.rgb, overlay, blend.a);
gl_FragColor = vec4(finalColor, base.a);
*/
// Option04 (no branches, using built-in functions) -> 38 FPS (1280x720)
//gl_FragColor = vec4(mix(1 - 2*(1 - base.rgb)*(1 - tintColor.rgb), 2*base.rgb*tintColor.rgb, step(0.5, base.rgb)), base.a);
}