summaryrefslogtreecommitdiff
path: root/keyshade/bin/data
diff options
context:
space:
mode:
authorTim Redfern <tim@getdrop.com>2017-10-19 07:39:51 +0100
committerTim Redfern <tim@getdrop.com>2017-10-19 07:39:51 +0100
commita4b2c2a0c569f6732ead116f7cbc3dae0fc999a0 (patch)
tree5ba644745817528e496f0b161d5f3edd784c08af /keyshade/bin/data
parenta3c99df80c201e56a32eb5fe650d45e9a9ccaee2 (diff)
basically it
Diffstat (limited to 'keyshade/bin/data')
-rw-r--r--keyshade/bin/data/shader.frag21
-rw-r--r--keyshade/bin/data/shader.vert7
2 files changed, 13 insertions, 15 deletions
diff --git a/keyshade/bin/data/shader.frag b/keyshade/bin/data/shader.frag
index 7dbf468..560766b 100644
--- a/keyshade/bin/data/shader.frag
+++ b/keyshade/bin/data/shader.frag
@@ -3,13 +3,15 @@
uniform vec4 keyColour;
uniform float keyMinDist;
uniform float keyMaxDist;
+uniform float time;
// these are our textures
uniform sampler2DRect backgroundTex;
uniform sampler2DRect foregroundTex;
// this comes from the vertex shader
-in vec2 texCoordVarying;
+in vec2 texCoordVarying1;
+in vec2 texCoordVarying2;
@@ -19,20 +21,13 @@ out vec4 outputColor;
void main()
{
// Get color values from the background and foreground
- vec4 back = texture(backgroundTex, texCoordVarying);
- vec4 fore = texture(foregroundTex, texCoordVarying);
+ vec4 back = texture(backgroundTex, (texCoordVarying1 - 0.5) * time + (0.5 * time) );
+ vec4 fore = texture(foregroundTex, texCoordVarying1);
- // get alpha from mask
- float mask = texture(backgroundTex, texCoordVarying).r;
-
- vec4 delta = back - keyColour;
+ vec4 delta = fore - keyColour;
float distance2 = dot( delta, delta );
- float weight = clamp( (distance2 - keyMinDist) / (keyMaxDist - keyMinDist) ,0.0,1.0);
-
- //float4 transparent = IN.color;
- //transparent.w = 0;
- //OUT.color = lerp( transparent, IN.color, weight );
+ float weight = clamp( (distance2 - keyMinDist) / (keyMaxDist - keyMinDist), 0.0, 1.0);
//mix colors from background and foreground based on the mask value
- outputColor = mix(fore , back, weight);
+ outputColor = mix(back, fore, weight);
}
diff --git a/keyshade/bin/data/shader.vert b/keyshade/bin/data/shader.vert
index 0e63995..df91b35 100644
--- a/keyshade/bin/data/shader.vert
+++ b/keyshade/bin/data/shader.vert
@@ -7,10 +7,13 @@ in vec4 position;
in vec2 texcoord;
// texture coordinates are sent to fragment shader
-out vec2 texCoordVarying;
+out vec2 texCoordVarying1;
+out vec2 texCoordVarying2;
void main()
{
- texCoordVarying = texcoord;
+ texCoordVarying1 = texcoord;
+ //texCoordVarying = (texcoord - 0.5); ///(2.0f+sin(time));
+ //texCoords = (texCoords - 0.5) * scale + (0.5 * scale);
gl_Position = modelViewProjectionMatrix * position;
} \ No newline at end of file