Skip to content

Commit

Permalink
fix(colorblindness): update shader to 150
Browse files Browse the repository at this point in the history
Closes #38
Closes #41
  • Loading branch information
sam-kirby committed Jan 1, 2025
1 parent 4fcc54a commit 93cc5c2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#version 150

uniform sampler2D DiffuseSampler;

in vec2 texCoord;
in vec2 oneTexel;

out vec4 fragColor;

uniform vec3 RedMatrix;
uniform vec3 GreenMatrix;
uniform vec3 BlueMatrix;

void main() {
vec4 InTexel = texture(DiffuseSampler, texCoord);

// Color Matrix
float RedValue = dot(InTexel.rgb, RedMatrix);
float GreenValue = dot(InTexel.rgb, GreenMatrix);
float BlueValue = dot(InTexel.rgb, BlueMatrix);
vec3 OutColor = vec3(RedValue, GreenValue, BlueValue);

fragColor = vec4(OutColor, 1.0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"blend": {
"func": "add",
"srcrgb": "one",
"dstrgb": "zero"
},
"vertex": "sobel",
"fragment": "colorblindness:color_shift",
"attributes": [ "Position" ],
"samplers": [
{ "name": "DiffuseSampler" }
],
"uniforms": [
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "RedMatrix", "type": "float", "count": 3, "values": [ 1.0, 0.0, 0.0 ] },
{ "name": "GreenMatrix", "type": "float", "count": 3, "values": [ 0.0, 1.0, 0.0 ] },
{ "name": "BlueMatrix", "type": "float", "count": 3, "values": [ 0.0, 0.0, 1.0 ] }
]
}

0 comments on commit 93cc5c2

Please sign in to comment.