miscellaneous shader changes
Since sequence resolution is provided to the nodes now, it no longer needs to be a global in the shaders Removed some unused shaders Added default params to ShaderCode to allow skipping types that aren't used
This commit is contained in:
@@ -4,8 +4,8 @@ uniform float radius_in;
|
||||
uniform bool horiz_in;
|
||||
uniform bool vert_in;
|
||||
uniform bool repeat_edge_pixels_in;
|
||||
uniform vec2 resolution_in;
|
||||
|
||||
uniform vec2 ove_resolution;
|
||||
uniform int ove_iteration;
|
||||
|
||||
in vec2 ove_texcoord;
|
||||
@@ -107,9 +107,9 @@ void main(void) {
|
||||
|
||||
vec2 pixel_coord = ove_texcoord;
|
||||
if (mode == MODE_HORIZONTAL) {
|
||||
pixel_coord.x += i / ove_resolution.x;
|
||||
pixel_coord.x += i / resolution_in.x;
|
||||
} else if (mode == MODE_VERTICAL) {
|
||||
pixel_coord.y += i / ove_resolution.y;
|
||||
pixel_coord.y += i / resolution_in.y;
|
||||
}
|
||||
|
||||
if (repeat_edge_pixels_in
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// Inputs
|
||||
uniform int orientation;
|
||||
uniform vec3 color_a;
|
||||
uniform vec3 color_b;
|
||||
|
||||
// Standard inputs
|
||||
uniform vec2 ove_resolution;
|
||||
|
||||
in vec2 ove_texcoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
float t;
|
||||
|
||||
// This very roughly conforms to Qt::Orientation
|
||||
if (orientation == 1) {
|
||||
// Horizontal orientation
|
||||
t = ove_texcoord.x;
|
||||
} else {
|
||||
// Vertical orientation
|
||||
t = 1.0 - ove_texcoord.y;
|
||||
}
|
||||
|
||||
fragColor = vec4(mix(color_a, color_b, t), 1.0);
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
// Custom inputs
|
||||
uniform float hsv_value;
|
||||
|
||||
// Standard inputs
|
||||
uniform vec2 ove_resolution;
|
||||
|
||||
in vec2 ove_texcoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
// Color wheel uses PI
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
|
||||
vec3 hsv_to_rgb(float H, float S, float V) {
|
||||
float C = S * V;
|
||||
float X = C * (1.0 - abs(mod(H / 60.0, 2.0) - 1.0));
|
||||
float m = V - C;
|
||||
float Rs, Gs, Bs;
|
||||
|
||||
if(H >= 0.0 && H < 60.0) {
|
||||
Rs = C;
|
||||
Gs = X;
|
||||
Bs = 0.0;
|
||||
}
|
||||
else if(H >= 60.0 && H < 120.0) {
|
||||
Rs = X;
|
||||
Gs = C;
|
||||
Bs = 0.0;
|
||||
}
|
||||
else if(H >= 120.0 && H < 180.0) {
|
||||
Rs = 0.0;
|
||||
Gs = C;
|
||||
Bs = X;
|
||||
}
|
||||
else if(H >= 180.0 && H < 240.0) {
|
||||
Rs = 0.0;
|
||||
Gs = X;
|
||||
Bs = C;
|
||||
}
|
||||
else if(H >= 240.0 && H < 300.0) {
|
||||
Rs = X;
|
||||
Gs = 0.0;
|
||||
Bs = C;
|
||||
}
|
||||
else {
|
||||
Rs = C;
|
||||
Gs = 0.0;
|
||||
Bs = X;
|
||||
}
|
||||
|
||||
return vec3(Rs + m, Gs + m, Bs + m);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec2 center = vec2(0.5, 0.5);
|
||||
float radius = 0.5;
|
||||
|
||||
vec2 flipped_texcoord = vec2(ove_texcoord.x, (1.0 - ove_texcoord.y));
|
||||
|
||||
// Calculate scale
|
||||
if (ove_resolution.x != ove_resolution.y) {
|
||||
// Scale around center
|
||||
flipped_texcoord -= vec2(0.5, 0.5);
|
||||
|
||||
if (ove_resolution.x > ove_resolution.y) {
|
||||
flipped_texcoord.x *= ove_resolution.x / ove_resolution.y;
|
||||
} else {
|
||||
flipped_texcoord.y *= ove_resolution.y / ove_resolution.x;
|
||||
}
|
||||
|
||||
flipped_texcoord += vec2(0.5, 0.5);
|
||||
}
|
||||
|
||||
float dist = distance(flipped_texcoord, center);
|
||||
|
||||
if (dist <= radius) {
|
||||
float opposite = flipped_texcoord.y - center.y;
|
||||
float adjacent = flipped_texcoord.x - center.x;
|
||||
|
||||
float hue = atan(opposite, adjacent) * 180.0 / M_PI + 180.0;
|
||||
float sat = dist / radius;
|
||||
|
||||
// Extremely simple antialiasing, we taper off the edges between (radius) and (radius - 1)
|
||||
float pixel_radius = min(ove_resolution.x, ove_resolution.y) * 0.5;
|
||||
float pixel_dist = (pixel_radius / radius) * dist;
|
||||
float alpha = min((pixel_radius - pixel_dist), 1.0);
|
||||
|
||||
fragColor = vec4(hsv_to_rgb(hue, sat, hsv_value), alpha);
|
||||
} else {
|
||||
fragColor = vec4(0.0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Input variables
|
||||
uniform sampler2D tex_in;
|
||||
uniform float left_in;
|
||||
uniform float top_in;
|
||||
uniform float right_in;
|
||||
uniform float bottom_in;
|
||||
uniform float feather_in;
|
||||
uniform vec2 resolution_in;
|
||||
|
||||
// Input texture coordinate
|
||||
in vec2 ove_texcoord;
|
||||
|
||||
// Output color
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
float multiplier = 1.0;
|
||||
|
||||
vec2 feather_normalized = vec2(feather_in / resolution_in.x, feather_in / resolution_in.y);
|
||||
vec2 feather_normalized_half = feather_normalized * 0.5;
|
||||
|
||||
// Calculate left cropping
|
||||
float left_adjustment;
|
||||
float right_adjustment;
|
||||
float top_adjustment;
|
||||
float bottom_adjustment;
|
||||
|
||||
if (feather_in == 0.0) {
|
||||
if (ove_texcoord.x < left_in
|
||||
|| ove_texcoord.x > (1.0-right_in)
|
||||
|| ove_texcoord.y < (top_in)
|
||||
|| ove_texcoord.y > (1.0-bottom_in)) {
|
||||
multiplier = 0.0;
|
||||
}
|
||||
} else {
|
||||
float left_adjustment = clamp((ove_texcoord.x - (left_in - feather_normalized.x*(1.0-left_in))) / feather_normalized.x, 0.0, 1.0);
|
||||
multiplier *= left_adjustment;
|
||||
|
||||
float right_adjustment = 1.0-clamp((ove_texcoord.x - ((1.0-right_in) - feather_normalized.x*(right_in))) / feather_normalized.x, 0.0, 1.0);
|
||||
multiplier *= right_adjustment;
|
||||
|
||||
float top_adjustment = clamp((ove_texcoord.y - (top_in - feather_normalized.y*(1.0-top_in))) / feather_normalized.y, 0.0, 1.0);
|
||||
multiplier *= top_adjustment;
|
||||
|
||||
float bottom_adjustment = 1.0-clamp((ove_texcoord.y - ((1.0-bottom_in) - feather_normalized.y*(bottom_in))) / feather_normalized.y, 0.0, 1.0);
|
||||
multiplier *= bottom_adjustment;
|
||||
}
|
||||
|
||||
if (multiplier > 0.0) {
|
||||
vec4 color = texture(tex_in, ove_texcoord) * multiplier;
|
||||
fragColor = color;
|
||||
} else {
|
||||
fragColor = vec4(0.0);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
uniform sampler2D ove_maintex;
|
||||
uniform vec2 ove_resolution;
|
||||
|
||||
uniform vec2 resolution_in;
|
||||
|
||||
in vec2 ove_texcoord;
|
||||
|
||||
@@ -11,9 +12,9 @@ void main() {
|
||||
// A very basic deinterlace that halves the vertical
|
||||
// resolution and linearly interpolates the two fields
|
||||
// by reading the texture coord between them.
|
||||
float half_vert = round(ove_resolution.y / 2.0);
|
||||
float half_vert = round(resolution_in.y / 2.0);
|
||||
using_texcoord.y = (round(using_texcoord.y * half_vert) + 0.25) / half_vert;
|
||||
|
||||
vec4 color = %1(texture(ove_maintex, using_texcoord));
|
||||
vec4 color = texture(ove_maintex, using_texcoord);
|
||||
fragColor = color;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ uniform vec2[256] points_in;
|
||||
uniform int points_in_count;
|
||||
uniform vec4 color_in;
|
||||
|
||||
uniform vec2 ove_resolution;
|
||||
uniform vec2 resolution_in;
|
||||
|
||||
in vec2 ove_texcoord;
|
||||
|
||||
@@ -34,7 +34,7 @@ bool pnpoly(vec2 p) {
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
if (points_in_count > 0 && pnpoly(ove_texcoord * ove_resolution)) {
|
||||
if (points_in_count > 0 && pnpoly(ove_texcoord * resolution_in)) {
|
||||
fragColor = color_in;
|
||||
} else {
|
||||
fragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
uniform float waveform_scale;
|
||||
uniform vec2 ove_resolution;
|
||||
|
||||
in vec4 a_position;
|
||||
in vec2 a_texcoord;
|
||||
@@ -24,4 +23,4 @@ void main() {
|
||||
|
||||
gl_Position = transform * a_position;
|
||||
ove_texcoord = a_texcoord;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ uniform vec4 color_in;
|
||||
uniform float radius_in;
|
||||
uniform float opacity_in;
|
||||
uniform bool inner_in;
|
||||
uniform vec2 resolution_in;
|
||||
|
||||
// Standard inputs
|
||||
uniform vec2 ove_resolution;
|
||||
uniform int ove_iteration;
|
||||
|
||||
in vec2 ove_texcoord;
|
||||
@@ -32,10 +32,10 @@ void main(void) {
|
||||
|
||||
// Loop over box
|
||||
for (float i=-radius + 0.5; i<=radius; i += 2.0) {
|
||||
float x_coord = i / ove_resolution.x;
|
||||
float x_coord = i / resolution_in.x;
|
||||
|
||||
for (float j=-radius + 0.5; j<=radius; j += 2.0) {
|
||||
float y_coord = j / ove_resolution.y;
|
||||
float y_coord = j / resolution_in.y;
|
||||
|
||||
if (abs(length(vec2(i, j))) < radius) {
|
||||
// Get pixel here
|
||||
|
||||
Reference in New Issue
Block a user