reimplemented opacity without blending modes
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "debug.h"
|
||||
|
||||
Config config;
|
||||
RuntimeConfig runtime_config;
|
||||
|
||||
Config::Config()
|
||||
: saved_layout(false),
|
||||
@@ -262,3 +263,8 @@ void Config::save(QString path) {
|
||||
stream.writeEndDocument(); // doc
|
||||
f.close();
|
||||
}
|
||||
|
||||
RuntimeConfig::RuntimeConfig() :
|
||||
shaders_are_enabled(true),
|
||||
disable_blending(false)
|
||||
{}
|
||||
|
||||
+10
@@ -26,6 +26,7 @@
|
||||
|
||||
struct Config {
|
||||
Config();
|
||||
|
||||
bool saved_layout;
|
||||
bool show_track_lines;
|
||||
bool scroll_zooms;
|
||||
@@ -74,6 +75,15 @@ struct Config {
|
||||
void save(QString path);
|
||||
};
|
||||
|
||||
struct RuntimeConfig {
|
||||
RuntimeConfig();
|
||||
|
||||
bool shaders_are_enabled;
|
||||
bool disable_blending;
|
||||
QString external_translation_file;
|
||||
};
|
||||
|
||||
extern Config config;
|
||||
extern RuntimeConfig runtime_config;
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
// importing classes for certain command line args
|
||||
#include "project/effect.h"
|
||||
#include "ui/renderfunctions.h"
|
||||
#include "io/config.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
@@ -35,36 +33,36 @@ int main(int argc, char *argv[]) {
|
||||
printf("%s\n", appName.toUtf8().constData());
|
||||
return 0;
|
||||
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
|
||||
printf("Usage: %s [options] [filename]\n\n"
|
||||
"[filename] is the file to open on startup.\n\n"
|
||||
"Options:\n"
|
||||
"\t-v, --version\t\tShow version information\n"
|
||||
"\t-h, --help\t\tShow this help\n"
|
||||
"\t-f, --fullscreen\tStart in full screen mode\n"
|
||||
"\t--disable-shaders\tDisable OpenGL shaders (for debugging)\n"
|
||||
"\t--no-debug\t\tDisable internal debug log and output directly to console\n"
|
||||
"\t--disable-blend-modes\tDisable shader-based blending for older GPUs\n"
|
||||
"\t--translation <file>\tSet an external language file to use\n"
|
||||
"\n", argv[0]);
|
||||
printf("Usage: %s [options] [filename]\n\n"
|
||||
"[filename] is the file to open on startup.\n\n"
|
||||
"Options:\n"
|
||||
"\t-v, --version\t\tShow version information\n"
|
||||
"\t-h, --help\t\tShow this help\n"
|
||||
"\t-f, --fullscreen\tStart in full screen mode\n"
|
||||
"\t--disable-shaders\tDisable OpenGL shaders (for debugging)\n"
|
||||
"\t--no-debug\t\tDisable internal debug log and output directly to console\n"
|
||||
"\t--disable-blend-modes\tDisable shader-based blending for older GPUs\n"
|
||||
"\t--translation <file>\tSet an external language file to use\n"
|
||||
"\n", argv[0]);
|
||||
return 0;
|
||||
} else if (!strcmp(argv[i], "--fullscreen") || !strcmp(argv[i], "-f")) {
|
||||
launch_fullscreen = true;
|
||||
} else if (!strcmp(argv[i], "--disable-shaders")) {
|
||||
shaders_are_enabled = false;
|
||||
runtime_config.shaders_are_enabled = false;
|
||||
} else if (!strcmp(argv[i], "--no-debug")) {
|
||||
use_internal_logger = false;
|
||||
} else if (!strcmp(argv[i], "--disable-blend-modes")) {
|
||||
disable_blending = true;
|
||||
} else if (!strcmp(argv[i], "--translation")) {
|
||||
if (i + 1 < argc && argv[i + 1][0] != '-') {
|
||||
// load translation file
|
||||
external_translation_file = argv[i + 1];
|
||||
runtime_config.disable_blending = true;
|
||||
} else if (!strcmp(argv[i], "--translation")) {
|
||||
if (i + 1 < argc && argv[i + 1][0] != '-') {
|
||||
// load translation file
|
||||
runtime_config.external_translation_file = argv[i + 1];
|
||||
|
||||
i++;
|
||||
} else {
|
||||
printf("[ERROR] No translation file specified\n");
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
printf("[ERROR] No translation file specified\n");
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
printf("[ERROR] Unknown argument '%s'\n", argv[1]);
|
||||
return 1;
|
||||
|
||||
+2
-5
@@ -57,9 +57,6 @@ MainWindow* mainWindow;
|
||||
#define DEFAULT_CSS "QPushButton::checked { background: rgb(25, 25, 25); }"
|
||||
#define OLIVE_FILE_FILTER "Olive Project (*.ove)"
|
||||
|
||||
// load external translation file
|
||||
QString external_translation_file;
|
||||
|
||||
QTimer autorecovery_timer;
|
||||
QString config_fn;
|
||||
bool demoNoticeShown = false;
|
||||
@@ -205,9 +202,9 @@ MainWindow::MainWindow(QWidget *parent, const QString &an) :
|
||||
}
|
||||
|
||||
// load preferred language from file
|
||||
QString language_file = external_translation_file.isEmpty() ?
|
||||
QString language_file = runtime_config.external_translation_file.isEmpty() ?
|
||||
config.language_file :
|
||||
external_translation_file;
|
||||
runtime_config.external_translation_file;
|
||||
|
||||
if (!language_file.isEmpty()
|
||||
&& QFileInfo::exists(language_file)) {
|
||||
|
||||
+4
-7
@@ -78,7 +78,7 @@ private slots:
|
||||
void prev_cut();
|
||||
void next_cut();
|
||||
|
||||
void maximize_panel();
|
||||
void maximize_panel();
|
||||
void reset_layout();
|
||||
|
||||
void preferences();
|
||||
@@ -86,7 +86,7 @@ private slots:
|
||||
void zoom_in_tracks();
|
||||
void zoom_out_tracks();
|
||||
|
||||
void full_screen_viewer();
|
||||
void full_screen_viewer();
|
||||
|
||||
void fileMenu_About_To_Be_Shown();
|
||||
void fileMenu_About_To_Hide();
|
||||
@@ -207,13 +207,10 @@ private:
|
||||
|
||||
QString appName;
|
||||
|
||||
// used to store the panel state when one panel is maximized
|
||||
QByteArray temp_panel_state;
|
||||
// used to store the panel state when one panel is maximized
|
||||
QByteArray temp_panel_state;
|
||||
};
|
||||
|
||||
extern MainWindow* mainWindow;
|
||||
|
||||
// load external translation file
|
||||
extern QString external_translation_file;
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
+3
-3
@@ -17,6 +17,7 @@
|
||||
#include "mainwindow.h"
|
||||
#include "io/math.h"
|
||||
#include "io/clipboard.h"
|
||||
#include "io/config.h"
|
||||
#include "transition.h"
|
||||
|
||||
#include "effects/internal/transformeffect.h"
|
||||
@@ -45,7 +46,6 @@
|
||||
#include <QMenu>
|
||||
#include <QApplication>
|
||||
|
||||
bool shaders_are_enabled = true;
|
||||
QVector<EffectMeta> effects;
|
||||
|
||||
Effect* create_effect(Clip* c, const EffectMeta* em) {
|
||||
@@ -627,7 +627,7 @@ void Effect::open() {
|
||||
qWarning() << "Tried to open an effect that was already open";
|
||||
close();
|
||||
}
|
||||
if (shaders_are_enabled && enable_shader) {
|
||||
if (runtime_config.shaders_are_enabled && enable_shader) {
|
||||
if (QOpenGLContext::currentContext() == nullptr) {
|
||||
qWarning() << "No current context to create a shader program for - will retry next repaint";
|
||||
} else {
|
||||
@@ -685,7 +685,7 @@ void Effect::startEffect() {
|
||||
open();
|
||||
qWarning() << "Tried to start a closed effect - opening";
|
||||
}
|
||||
if (shaders_are_enabled
|
||||
if (runtime_config.shaders_are_enabled
|
||||
&& enable_shader
|
||||
&& glslProgram->isLinked()) {
|
||||
bound = glslProgram->bind();
|
||||
|
||||
@@ -34,8 +34,6 @@ struct EffectMeta {
|
||||
int type;
|
||||
int subtype;
|
||||
};
|
||||
|
||||
extern bool shaders_are_enabled;
|
||||
extern QVector<EffectMeta> effects;
|
||||
|
||||
double log_volume(double linear);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "panels/panels.h"
|
||||
#include "panels/effectcontrols.h"
|
||||
#include "io/crossplatformlib.h"
|
||||
#include "io/config.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QXmlStreamReader>
|
||||
@@ -18,7 +19,7 @@ typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info);
|
||||
#endif
|
||||
|
||||
void load_internal_effects() {
|
||||
if (!shaders_are_enabled) qWarning() << "Shaders are disabled, some effects may be nonfunctional";
|
||||
if (!runtime_config.shaders_are_enabled) qWarning() << "Shaders are disabled, some effects may be nonfunctional";
|
||||
|
||||
EffectMeta em;
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include "panels/timeline.h"
|
||||
#include "panels/viewer.h"
|
||||
|
||||
bool disable_blending = false;
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
@@ -95,7 +93,7 @@ void process_effect(Clip* c,
|
||||
if (e->enable_coords) {
|
||||
e->process_coords(timecode, coords, data);
|
||||
}
|
||||
bool can_process_shaders = (e->enable_shader && shaders_are_enabled);
|
||||
bool can_process_shaders = (e->enable_shader && runtime_config.shaders_are_enabled);
|
||||
if (can_process_shaders || e->enable_superimpose) {
|
||||
e->startEffect();
|
||||
if (can_process_shaders && e->is_glsl_linked()) {
|
||||
@@ -489,7 +487,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
|
||||
// copy front buffer to back buffer (only if we're using blending modes - which we usually will be)
|
||||
if (!disable_blending) {
|
||||
if (!runtime_config.disable_blending) {
|
||||
if (params.nests.size() > 0) {
|
||||
draw_clip(params.ctx, params.nests.last()->fbo[2]->handle(), params.nests.last()->fbo[0]->texture(), true);
|
||||
} else {
|
||||
@@ -506,13 +504,17 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// bind front buffer as draw buffer
|
||||
params.ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, final_fbo);
|
||||
|
||||
if (disable_blending) {
|
||||
if (runtime_config.disable_blending) {
|
||||
// some GPUs don't like the blending shader, so we provide a pure GL fallback here
|
||||
|
||||
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, backend_tex_1);
|
||||
|
||||
glColor4f(coords.opacity, coords.opacity, coords.opacity, coords.opacity);
|
||||
|
||||
full_blit();
|
||||
|
||||
// glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, 0);
|
||||
} else {
|
||||
// load background texture into texture unit 0
|
||||
|
||||
@@ -10,8 +10,6 @@ class QOpenGLShaderProgram;
|
||||
struct Sequence;
|
||||
struct Clip;
|
||||
|
||||
extern bool disable_blending;
|
||||
|
||||
struct ComposeSequenceParams {
|
||||
Viewer* viewer;
|
||||
QOpenGLContext* ctx;
|
||||
|
||||
@@ -20,6 +20,9 @@ ViewerContainer::ViewerContainer(QWidget *parent) :
|
||||
horizontal_scrollbar = new QScrollBar(Qt::Horizontal, this);
|
||||
vertical_scrollbar = new QScrollBar(Qt::Vertical, this);
|
||||
|
||||
horizontal_scrollbar->setVisible(false);
|
||||
vertical_scrollbar->setVisible(false);
|
||||
|
||||
horizontal_scrollbar->setSingleStep(20);
|
||||
vertical_scrollbar->setSingleStep(20);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user