Merge branch 'master' of https://github.com/olive-editor/olive into winvst

This commit is contained in:
itsmattkc
2019-01-09 12:41:53 +11:00
4 changed files with 22 additions and 9 deletions
+2 -3
View File
@@ -4,7 +4,7 @@ uniform sampler2D image;
uniform vec2 resolution;
uniform bool shadow;
uniform int shadow;
uniform vec3 shadowcolor;
uniform float shadowsoftness;
uniform float shadowopacity;
@@ -14,8 +14,7 @@ varying vec2 vTexCoord;
void main(void) {
vec4 master_px = texture2D(image, vTexCoord);
if (shadow) {
if (shadow == 1) {
vec2 shadow_dist = vec2(shadowdistance)/resolution;
float shadow_opacity = 0.01*shadowopacity;
+17 -4
View File
@@ -820,9 +820,18 @@ void Effect::open() {
} else {
glslProgram = new QOpenGLShaderProgram();
validate_meta_path();
if (!vertPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Vertex, meta->path + "/" + vertPath);
if (!fragPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Fragment, meta->path + "/" + fragPath);
glslProgram->link();
bool glsl_compiled = true;
if (!vertPath.isEmpty()) {
if (!glslProgram->addShaderFromSourceFile(QOpenGLShader::Vertex, meta->path + "/" + vertPath)) {
glsl_compiled = false;
}
}
if (!fragPath.isEmpty()) {
if (!glslProgram->addShaderFromSourceFile(QOpenGLShader::Fragment, meta->path + "/" + fragPath)) {
glsl_compiled = false;
}
}
if (glsl_compiled) glslProgram->link();
isOpen = true;
}
} else {
@@ -846,12 +855,16 @@ void Effect::close() {
isOpen = false;
}
bool Effect::is_glsl_linked() {
return glslProgram != NULL && glslProgram->isLinked();
}
void Effect::startEffect() {
if (!isOpen) {
open();
dout << "[WARNING] Tried to start a closed effect - opening";
}
if (enable_shader) bound = glslProgram->bind();
if (enable_shader && glslProgram->isLinked()) bound = glslProgram->bind();
}
void Effect::endEffect() {
+1
View File
@@ -142,6 +142,7 @@ public:
bool is_open();
void open();
void close();
bool is_glsl_linked();
virtual void startEffect();
virtual void endEffect();
+2 -2
View File
@@ -189,7 +189,7 @@ void ViewerWidget::initializeGL() {
//}
void ViewerWidget::paintEvent(QPaintEvent *e) {
if (!rendering && context()->thread() == this->thread()) {
if (!rendering && context()->thread() == this->thread()) {
makeCurrent();
QOpenGLWidget::paintEvent(e);
}
@@ -429,7 +429,7 @@ void ViewerWidget::process_effect(Clip* c, Effect* e, double timecode, GLTexture
}
if (e->enable_shader || e->enable_superimpose) {
e->startEffect();
if (e->enable_shader) {
if (e->enable_shader && e->is_glsl_linked()) {
e->process_shader(timecode, coords);
composite_texture = draw_clip(c->fbo[fbo_switcher], composite_texture, true);
fbo_switcher = !fbo_switcher;