Skip to content

Commit

Permalink
whitespace from the generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaž Hrastnik committed Jun 29, 2016
1 parent b8d98f3 commit 3cddf98
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions resources/shaders/build/120/quad.frag
Expand Up @@ -12,22 +12,28 @@ vec3 rgb2hsv(vec3 c)
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}

vec3 hsv2rgb(vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

void main(void)
{
const vec3 white = vec3(1.0, 1.0, 1.0);

vec4 basecolor = texture2D(tex0, f_texcoord);
if (basecolor.a == 0.0) discard;

vec3 blendcolor = mix(basecolor.rgb, white, tone.rgb);

if (tone.a != 1.0) {
gl_FragColor = f_color * vec4(hsv2rgb(rgb2hsv(blendcolor) * vec3(1.0, tone.a, 1.0)),
basecolor.a * opacity) * color;
Expand Down
2 changes: 2 additions & 0 deletions resources/shaders/build/120/quad.vert
Expand Up @@ -3,9 +3,11 @@
attribute vec2 vertex_pos;
attribute vec2 texcoord;
attribute vec4 color;

uniform mat4 mvp_matrix;
varying vec2 f_texcoord;
varying vec4 f_color;

void main(void)
{
gl_Position = mvp_matrix * vec4(vertex_pos, 0.0, 1.0);
Expand Down
7 changes: 7 additions & 0 deletions resources/shaders/build/330/quad.frag
Expand Up @@ -7,27 +7,34 @@ uniform vec4 color;
in vec4 f_color;
uniform vec4 tone;
out vec4 fragColor;

vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}

vec3 hsv2rgb(vec3 c)
{
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

void main(void)
{
const vec3 white = vec3(1.0, 1.0, 1.0);

vec4 basecolor = texture(tex0, f_texcoord);
if (basecolor.a == 0.0) discard;

vec3 blendcolor = mix(basecolor.rgb, white, tone.rgb);

if (tone.a != 1.0) {
fragColor = f_color * vec4(hsv2rgb(rgb2hsv(blendcolor) * vec3(1.0, tone.a, 1.0)),
basecolor.a * opacity) * color;
Expand Down
2 changes: 2 additions & 0 deletions resources/shaders/build/330/quad.vert
Expand Up @@ -3,9 +3,11 @@
layout(location = 0) in vec2 vertex_pos;
layout(location = 1) in vec2 texcoord;
layout(location = 2) in vec4 color;

uniform mat4 mvp_matrix;
out vec2 f_texcoord;
out vec4 f_color;

void main(void)
{
gl_Position = mvp_matrix * vec4(vertex_pos, 0.0, 1.0);
Expand Down
1 change: 1 addition & 0 deletions resources/shaders/build/330/text.frag
Expand Up @@ -4,6 +4,7 @@ uniform sampler2D tex0;
in vec2 f_texcoord;
in vec4 f_color;
out vec4 fragColor;

void main()
{
fragColor = vec4(1, 1, 1, texture(tex0, f_texcoord).r) * f_color;
Expand Down

0 comments on commit 3cddf98

Please sign in to comment.