ported more effects to gles

This commit is contained in:
itsmattkc
2019-03-28 21:43:05 +11:00
parent 86bd06795a
commit 31bb862715
39 changed files with 50 additions and 113 deletions
+4 -8
View File
@@ -1,7 +1,3 @@
#version 120
uniform sampler2D tex0;
varying vec2 vTexCoord;
const float PI = 3.1415926535;
uniform vec2 resolution;
@@ -18,15 +14,15 @@ vec2 distort(vec2 p, vec2 offset) {
return 0.5 * (p + 1.0);
}
void main(void) {
vec4 process(vec4 col) {
vec2 offset = vec2(xoff/resolution.x, yoff/resolution.y);
vec2 xy = 2.0 * vTexCoord - 1.0 - offset;
vec2 xy = 2.0 * v_texcoord - 1.0 - offset;
vec2 uv;
float d = length(xy);
uv = distort(xy, offset);
if (uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0) {
gl_FragColor = texture2D(tex0, uv);
return texture2D(texture, uv);
} else {
discard;
return vec4(0.0);
}
}
-16
View File
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Drop Shadow" category="Stylize">
<row name="Color">
<field type="color" r="0" g="0" b="0" id="shadowcolor"/>
</row>
<row name="Softness">
<field type="double" min="0" default="20" id="shadowsoftness"/>
</row>
<row name="Opacity">
<field type="double" min="0" default="100" max="100" id="shadowopacity"/>
</row>
<row name="Distance">
<field type="double" min="0" default="20" id="shadowdistance"/>
</row>
<shader vert="common.vert" frag="dropshadow.frag"/>
</effect>
@@ -4,9 +4,6 @@ feel free to use or modify at will*/
/*the follwing three functions convert RGB into YCbCr in the same manner as in JPEG images*/
uniform sampler2D tex;
varying vec2 vTexCoord;
uniform vec3 key_color;
uniform float tola;
uniform float tolb;
@@ -36,12 +33,10 @@ float colorclose(float Cb_p,float Cr_p,float Cb_key,float Cr_key,float tola,floa
return (1.0);
}
void main(void) {
vec4 process(vec4 texture_color) {
float cb_key = rgb2cb(key_color);
float cr_key = rgb2cr(key_color);
vec4 texture_color = texture2D(tex, vTexCoord);
float cb = rgb2cb(texture_color.rgb);
float cr = rgb2cr(texture_color.rgb);
float mask = colorclose(cb, cr, cb_key, cr_key, (tola/100.0), (tolb/100.0));
@@ -61,5 +56,5 @@ void main(void) {
} else if (mode == 2) { // original
}
gl_FragColor = texture_color;
return texture_color;
}
@@ -2,10 +2,6 @@
Based on Edward Cannon's Simple Chroma Key (adaptation by Olive Team)
RGB to HSV based on MattKC's toonify source code
Feel free to modify and use at will */
#version 110
uniform sampler2D tex;
varying vec2 vTexCoord;
uniform float loc;
uniform float hic;
@@ -57,8 +53,7 @@ bool isNotIncreasingSequence(float a, float b, float c) {
return (c < b || a > b);
}
void main(void) {
vec4 texture_color = texture2D(tex,vTexCoord);
vec4 process(vec4 texture_color) {
vec3 color = texture_color.rgb;
float toCheck = 0.0;
@@ -79,5 +74,5 @@ void main(void) {
}
texture_color.a = isNotIncreasingSequence(loc, toCheck, hic) ? (invert ? texture_color.a : 0.0) : (invert ? 0.0 : texture_color.a);
texture_color.rgb *= texture_color.a;
gl_FragColor = texture_color;
return texture_color;
}
@@ -1,15 +1,12 @@
#version 120
uniform sampler2D tex0;
varying vec2 vTexCoord;
#define M_PI 3.1415926535897932384626433832795
uniform float size;
void main(void) {
vec4 process(vec4 col) {
float maxFactor = 2.0 - (size * 0.01);
vec2 uv;
vec2 xy = 2.0 * vTexCoord - 1.0;
vec2 xy = 2.0 * v_texcoord - 1.0;
float d = length(xy);
if (d < (2.0-maxFactor)) {
d = length(xy * maxFactor);
@@ -20,8 +17,7 @@ void main(void) {
uv.x = r * cos(phi) + 0.5;
uv.y = r * sin(phi) + 0.5;
} else {
uv = vTexCoord;
uv = v_texcoord;
}
vec4 c = texture2D(tex0, uv);
gl_FragColor = c;
return texture2D(texture, uv);
}
@@ -1,12 +1,7 @@
#version 110
uniform float hue;
uniform float saturation;
uniform float brightness;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
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));
@@ -23,9 +18,7 @@ vec3 hsv2rgb(vec3 c) {
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main(void) {
vec4 tex_color = texture2D(myTexture, vTexCoord);
vec4 process(vec4 tex_color) {
vec3 hsv = rgb2hsv(tex_color.rgb);
hsv.r += (hue/360.0);
hsv.g *= (saturation*0.01);
@@ -33,10 +26,8 @@ void main(void) {
vec3 rgb = hsv2rgb(hsv);
gl_FragColor = vec4(
rgb.r,
rgb.g,
rgb.b,
return vec4(
rgb.rgb,
tex_color.a
);
}
+5 -23
View File
@@ -1,33 +1,14 @@
#version 110
varying vec2 vTexCoord;
uniform sampler2D tex0; // scene buffer
uniform float scale;
uniform float centerx;
uniform float centery;
uniform bool mirrorx;
uniform bool mirrory;
void main(void) {
vec2 texCoord = vTexCoord;
/*vec2 coord = vec2(
mod(vTexCoord.x*tilecount, 1.0),
mod(vTexCoord.y*tilecount, 1.0)
);
if (mirrorx && mod(vTexCoord.x*tilecount, 2.0) > 1.0) {
coord.x = 1.0 - coord.x;
}
if (mirrory && mod(vTexCoord.y*tilecount, 2.0) > 1.0) {
coord.y = 1.0 - coord.y;
}*/
vec4 process(vec4 col) {
float adj_scale = scale*0.01;
vec2 scaled_coords = (vTexCoord/adj_scale);
vec2 scaled_coords = (v_texcoord/adj_scale);
vec2 coord = scaled_coords-vec2(0.5/adj_scale, 0.5/adj_scale)+vec2(0.5, 0.5)+vec2(-centerx*0.01, -centery*0.01);
vec2 modcoord = mod(coord, 1.0);
@@ -39,5 +20,6 @@ void main(void) {
modcoord.y = 1.0 - modcoord.y;
}
gl_FragColor = vec4(texture2D(tex0, modcoord));
return vec4(texture2D(texture, modcoord));
}
+5 -12
View File
@@ -1,20 +1,14 @@
#version 110
uniform sampler2D sceneTex; // 0
uniform float lensRadiusX;
uniform float lensRadiusY;
uniform bool circular;
uniform vec2 resolution;
// uniform vec2 lensRadius; // 0.45, 0.38
varying vec2 vTexCoord;
void main(void) {
vec4 process(vec4 c) {
if (lensRadiusX == 0.0) {
discard;
return vec4(0.0);
}
vec4 c = texture2D(sceneTex, vTexCoord);
vec2 vignetteCoord = vTexCoord;
vec2 vignetteCoord = v_texcoord;
if (circular) {
float ar = (resolution.x/resolution.y);
vignetteCoord.x *= ar;
@@ -22,6 +16,5 @@ void main(void) {
}
float dist = distance(vignetteCoord, vec2(0.5,0.5));
float size = (lensRadiusX*0.01);
c *= smoothstep(size, size*0.99*(1.0-lensRadiusY*0.01), dist);
gl_FragColor = c;
}
return vec4(c.rgb * smoothstep(size, size*0.99*(1.0-lensRadiusY*0.01), dist), c.a);
}
-1
View File
@@ -108,7 +108,6 @@ void CollapsibleWidget::SetContents(QWidget* c) {
contents = c;
if (!existing) {
layout->addWidget(contents);
connect(enabled_check, SIGNAL(toggled(bool)), contents, SLOT(setEnabled(bool)));
connect(collapse_button, SIGNAL(clicked()), this, SLOT(on_visible_change()));
}
}
+1 -1
View File
@@ -347,7 +347,7 @@ void GraphView::paintEvent(QPaintEvent *) {
p.drawLine(playhead_x, 0, playhead_x, height());
if (rect_select) {
draw_selection_rectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
olive::ui::DrawSelectionRectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
p.setBrush(Qt::NoBrush);
}
}
+1 -1
View File
@@ -182,7 +182,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
}
if (select_rect) {
draw_selection_rectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
olive::ui::DrawSelectionRectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
}
/*if (mouseover && mouseover_row < rowY.size()) {
+1 -1
View File
@@ -20,7 +20,7 @@
#include "rectangleselect.h"
void draw_selection_rectangle(QPainter& painter, const QRect& rect) {
void olive::ui::DrawSelectionRectangle(QPainter& painter, const QRect& rect) {
painter.setPen(QColor(204, 204, 204));
painter.setBrush(QColor(0, 0, 0, 32));
painter.drawRect(rect);
+7 -1
View File
@@ -23,6 +23,9 @@
#include <QPainter>
namespace olive {
namespace ui {
/**
* @brief Routine for drawing a drag selection rectangle for any given QPainter
*
@@ -34,6 +37,9 @@
*
* Rectangle to draw
*/
void draw_selection_rectangle(QPainter& painter, const QRect& rect);
void DrawSelectionRectangle(QPainter& painter, const QRect& rect);
}
}
#endif // RECTANGLESELECT_H
+14 -14
View File
@@ -25,25 +25,25 @@
class ResizableScrollBar : public QScrollBar
{
Q_OBJECT
Q_OBJECT
public:
ResizableScrollBar(QWidget * parent = 0);
bool is_resizing();
ResizableScrollBar(QWidget * parent = nullptr);
bool is_resizing();
signals:
void resize_move(double i);
void resize_move(double i);
protected:
void resizeEvent(QResizeEvent *event) override;
void mousePressEvent(QMouseEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
void resizeEvent(QResizeEvent *event) override;
void mousePressEvent(QMouseEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
private:
bool resize_init;
bool resize_proc;
int resize_start;
bool resize_top;
bool resize_init;
bool resize_proc;
int resize_start;
bool resize_top;
int resize_start_max;
int resize_start_width;
int resize_start_max;
int resize_start_width;
};
#endif // RESIZABLESCROLLBAR_H
+1 -1
View File
@@ -3269,7 +3269,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
rect_select.translate(0, height());
}
draw_selection_rectangle(p, rect_select);
olive::ui::DrawSelectionRectangle(p, rect_select);
}
// Draw ghosts