further development on rewrite
@@ -16,12 +16,15 @@
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
core.h
|
||||
core.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_subdirectory(panel)
|
||||
add_subdirectory(project)
|
||||
add_subdirectory(render)
|
||||
add_subdirectory(ui)
|
||||
add_subdirectory(widget)
|
||||
add_subdirectory(window)
|
||||
|
||||
@@ -30,6 +33,11 @@ if(APPLE)
|
||||
set(OLIVE_TARGET "Olive")
|
||||
endif()
|
||||
|
||||
set(OLIVE_RESOURCES
|
||||
${OLIVE_RESOURCES}
|
||||
#effects/internal/internalshaders.qrc
|
||||
)
|
||||
|
||||
add_executable(${OLIVE_TARGET}
|
||||
${OLIVE_SOURCES}
|
||||
${OLIVE_RESOURCES}
|
||||
@@ -39,7 +47,7 @@ add_executable(${OLIVE_TARGET}
|
||||
|
||||
target_compile_definitions(${OLIVE_TARGET} PRIVATE ${OLIVE_DEFINITIONS})
|
||||
|
||||
target_compile_options(${OLIVE_TARGET} PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Wno-reorder>)
|
||||
target_compile_options(${OLIVE_TARGET} PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Werror -pedantic-errors -Wall -Wextra -Wconversion -Wsign-conversion>)
|
||||
|
||||
target_link_libraries(${OLIVE_TARGET}
|
||||
PRIVATE
|
||||
@@ -59,12 +67,6 @@ target_link_libraries(${OLIVE_TARGET}
|
||||
OpenColorIO
|
||||
)
|
||||
|
||||
set(OLIVE_RESOURCES
|
||||
cursors/cursors.qrc
|
||||
effects/internal/internalshaders.qrc
|
||||
icons/icons.qrc
|
||||
)
|
||||
|
||||
set(OLIVE_EFFECTS
|
||||
effects/internal/cornerpin.frag
|
||||
effects/internal/dropshadow.frag
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#include "core.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDebug>
|
||||
|
||||
#include "ui/icons/icons.h"
|
||||
#include "ui/style/style.h"
|
||||
|
||||
Core olive::core;
|
||||
|
||||
Core::Core() :
|
||||
main_window_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Start()
|
||||
{
|
||||
//
|
||||
// Parse command line arguments
|
||||
//
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
|
||||
// Project from command line option
|
||||
// FIXME: What's the correct way to make an "optional" positional argument?
|
||||
parser.addPositionalArgument("[project]", tr("Project to open on startup"));
|
||||
|
||||
// Create fullscreen option
|
||||
QCommandLineOption fullscreen_option({"f", "fullscreen"}, tr("Start in full screen mode"));
|
||||
parser.addOption(fullscreen_option);
|
||||
|
||||
// Parse options
|
||||
parser.process(*QApplication::instance());
|
||||
|
||||
QStringList args = parser.positionalArguments();
|
||||
|
||||
// Detect project to load on startup
|
||||
if (!args.isEmpty()) {
|
||||
startup_project_ = args.first();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Start GUI
|
||||
//
|
||||
|
||||
// Load all icons
|
||||
olive::icon::LoadAll();
|
||||
|
||||
// Set UI style
|
||||
olive::style::SetDefault();
|
||||
|
||||
// Create main window and open it
|
||||
main_window_ = new olive::MainWindow();
|
||||
if (parser.isSet(fullscreen_option)) {
|
||||
main_window_->showFullScreen();
|
||||
} else {
|
||||
main_window_->showMaximized();
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Stop()
|
||||
{
|
||||
delete main_window_;
|
||||
}
|
||||
|
||||
olive::MainWindow *Core::main_window()
|
||||
{
|
||||
return main_window_;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef CORE_H
|
||||
#define CORE_H
|
||||
|
||||
#include "window/mainwindow/mainwindow.h"
|
||||
|
||||
class Core : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Core();
|
||||
|
||||
void Start();
|
||||
void StartGUI();
|
||||
void Stop();
|
||||
|
||||
olive::MainWindow* main_window();
|
||||
private:
|
||||
olive::MainWindow* main_window_;
|
||||
|
||||
QString startup_project_;
|
||||
};
|
||||
|
||||
namespace olive {
|
||||
extern Core core;
|
||||
}
|
||||
|
||||
#endif // CORE_H
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <QApplication>
|
||||
#include <QSurfaceFormat>
|
||||
|
||||
#include "window/mainwindow/mainwindow.h"
|
||||
#include "core.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// Create application instance
|
||||
@@ -43,11 +43,11 @@ int main(int argc, char *argv[]) {
|
||||
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||
QSurfaceFormat::setDefaultFormat(format);
|
||||
|
||||
// Create main window instance
|
||||
olive::MainWindow w;
|
||||
olive::core.Start();
|
||||
|
||||
// Show main window
|
||||
w.showMaximized();
|
||||
int exit_code = a.exec();
|
||||
|
||||
return a.exec();
|
||||
olive::core.Stop();
|
||||
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(project)
|
||||
add_subdirectory(timeline)
|
||||
add_subdirectory(viewer)
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2019 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
panel/project/project.h
|
||||
panel/project/project.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,41 @@
|
||||
#include "project.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "widget/projecttoolbar/projecttoolbar.h"
|
||||
|
||||
ProjectPanel::ProjectPanel(QWidget *parent) :
|
||||
PanelWidget(parent)
|
||||
{
|
||||
// Create main widget and its layout
|
||||
QWidget* central_widget = new QWidget(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(central_widget);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
setWidget(central_widget);
|
||||
|
||||
// Set up project toolbar
|
||||
ProjectToolbar* toolbar = new ProjectToolbar(this);
|
||||
layout->addWidget(toolbar);
|
||||
|
||||
// Set up main explorer object
|
||||
ProjectExplorer* explorer = new ProjectExplorer(this);
|
||||
layout->addWidget(explorer);
|
||||
|
||||
// Set strings
|
||||
Retranslate();
|
||||
}
|
||||
|
||||
void ProjectPanel::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
Retranslate();
|
||||
}
|
||||
QDockWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
void ProjectPanel::Retranslate()
|
||||
{
|
||||
SetTitle(tr("Project"));
|
||||
SetSubtitle(tr("(untitled)"));
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef PROJECT_H
|
||||
#define PROJECT_H
|
||||
|
||||
#include "widget/panel/panel.h"
|
||||
#include "widget/projectexplorer/projectexplorer.h"
|
||||
|
||||
class ProjectPanel : public PanelWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProjectPanel(QWidget* parent);
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* e) override;
|
||||
|
||||
private:
|
||||
void Retranslate();
|
||||
};
|
||||
|
||||
#endif // PROJECT_H
|
||||
@@ -0,0 +1,22 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2019 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
panel/timeline/timeline.h
|
||||
panel/timeline/timeline.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "timeline.h"
|
||||
|
||||
TimelinePanel::TimelinePanel(QWidget *parent) :
|
||||
PanelWidget(parent)
|
||||
{
|
||||
Retranslate();
|
||||
}
|
||||
|
||||
void TimelinePanel::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
Retranslate();
|
||||
}
|
||||
QDockWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
void TimelinePanel::Retranslate()
|
||||
{
|
||||
SetTitle(tr("Timeline"));
|
||||
SetSubtitle(tr("(none)"));
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef TIMELINE_H
|
||||
#define TIMELINE_H
|
||||
|
||||
#include "widget/panel/panel.h"
|
||||
|
||||
class TimelinePanel : public PanelWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimelinePanel(QWidget* parent);
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* e) override;
|
||||
|
||||
private:
|
||||
void Retranslate();
|
||||
};
|
||||
|
||||
#endif // TIMELINE_H
|
||||
@@ -13,4 +13,21 @@ ViewerPanel::ViewerPanel(QWidget *parent) :
|
||||
|
||||
// Set ViewerWidget as the central widget
|
||||
setWidget(viewer);
|
||||
|
||||
// Set strings
|
||||
Retranslate();
|
||||
}
|
||||
|
||||
void ViewerPanel::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
Retranslate();
|
||||
}
|
||||
QDockWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
void ViewerPanel::Retranslate()
|
||||
{
|
||||
SetTitle(tr("Viewer"));
|
||||
SetSubtitle(tr("(none)"));
|
||||
}
|
||||
|
||||
@@ -12,7 +12,12 @@ class ViewerPanel : public PanelWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ViewerPanel(QWidget* parent);
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* e) override;
|
||||
|
||||
private:
|
||||
void Retranslate();
|
||||
};
|
||||
|
||||
#endif // VIEWER_PANEL_H
|
||||
|
||||
@@ -14,10 +14,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(gl)
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
render/glfunc.h
|
||||
render/glfunc.cpp
|
||||
render/qopenglshaderprogramptr.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2019 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
render/gl/glfunc.h
|
||||
render/gl/glfunc.cpp
|
||||
render/gl/shadergenerators.h
|
||||
render/gl/shadergenerators.cpp
|
||||
render/gl/shaderptr.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -35,8 +35,13 @@ const GLfloat flipped_blit_texcoords[] = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Set up texture mipmaps
|
||||
* @brief Set up texture parameters and mipmap for drawing
|
||||
*
|
||||
* Internal function used just before drawing to allow mipmapped bilinear filtering when drawing textures small.
|
||||
*
|
||||
* @param f
|
||||
*
|
||||
* Currently active QOpenGLFunctions object (use context()->functions() if unsure).
|
||||
*/
|
||||
void PrepareToDraw(QOpenGLFunctions* f) {
|
||||
f->glGenerateMipmap(GL_TEXTURE_2D);
|
||||
@@ -46,9 +51,10 @@ void PrepareToDraw(QOpenGLFunctions* f) {
|
||||
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
}
|
||||
|
||||
void olive::gl::Blit(QOpenGLShaderProgram* pipeline, bool flipped, QMatrix4x4 matrix) {
|
||||
|
||||
void olive::gl::Blit(ShaderPtr pipeline, bool flipped, QMatrix4x4 matrix) {
|
||||
// FIXME: is currentContext() reliable here?
|
||||
QOpenGLFunctions* func = QOpenGLContext::currentContext()->functions();
|
||||
|
||||
PrepareToDraw(func);
|
||||
|
||||
QOpenGLVertexArrayObject m_vao;
|
||||
@@ -72,16 +78,16 @@ void olive::gl::Blit(QOpenGLShaderProgram* pipeline, bool flipped, QMatrix4x4 ma
|
||||
pipeline->setUniformValue("mvp_matrix", matrix);
|
||||
pipeline->setUniformValue("texture", 0);
|
||||
|
||||
GLuint vertex_location = pipeline->attributeLocation("a_position");
|
||||
GLuint vertex_location = static_cast<GLuint>(pipeline->attributeLocation("a_position"));
|
||||
m_vbo.bind();
|
||||
func->glEnableVertexAttribArray(vertex_location);
|
||||
func->glVertexAttribPointer(vertex_location, 3, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
func->glVertexAttribPointer(vertex_location, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
|
||||
m_vbo.release();
|
||||
|
||||
GLuint tex_location = pipeline->attributeLocation("a_texcoord");
|
||||
GLuint tex_location = static_cast<GLuint>(pipeline->attributeLocation("a_texcoord"));
|
||||
m_vbo2.bind();
|
||||
func->glEnableVertexAttribArray(tex_location);
|
||||
func->glVertexAttribPointer(tex_location, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
func->glVertexAttribPointer(tex_location, 2, GL_FLOAT, GL_FALSE, 0, nullptr);
|
||||
m_vbo2.release();
|
||||
|
||||
func->glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
@@ -1,9 +1,10 @@
|
||||
#ifndef GLFUNC_H
|
||||
#define GLFUNC_H
|
||||
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QMatrix4x4>
|
||||
|
||||
#include "shaderptr.h"
|
||||
|
||||
namespace olive {
|
||||
namespace gl {
|
||||
|
||||
@@ -22,7 +23,7 @@ namespace gl {
|
||||
*
|
||||
* Transformation matrix to use when drawing (defaults to no transform)
|
||||
*/
|
||||
void Blit(QOpenGLShaderProgram* pipeline, bool flipped = false, QMatrix4x4 matrix = QMatrix4x4());
|
||||
void Blit(ShaderPtr pipeline, bool flipped = false, QMatrix4x4 matrix = QMatrix4x4());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
#include "shadergenerators.h"
|
||||
|
||||
#include <QOpenGLExtraFunctions>
|
||||
|
||||
ShaderPtr olive::gl::GetDefaultPipeline(const QString& function_name, const QString& shader_code)
|
||||
{
|
||||
ShaderPtr program = std::make_shared<QOpenGLShaderProgram>();
|
||||
|
||||
// Generate vertex shader
|
||||
QString vert_shader = "#version 110\n"
|
||||
"\n"
|
||||
"#ifdef GL_ES\n"
|
||||
"precision mediump int;\n"
|
||||
"precision mediump float;\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"uniform mat4 mvp_matrix;\n"
|
||||
"\n"
|
||||
"attribute vec4 a_position;\n"
|
||||
"attribute vec2 a_texcoord;\n"
|
||||
"\n"
|
||||
"varying vec2 v_texcoord;\n"
|
||||
"\n"
|
||||
"void main() {\n"
|
||||
" gl_Position = mvp_matrix * a_position;\n"
|
||||
" v_texcoord = a_texcoord;\n"
|
||||
"}\n";
|
||||
|
||||
// Generate fragment shader
|
||||
QString frag_shader = "#version 110\n"
|
||||
"\n"
|
||||
"#ifdef GL_ES\n"
|
||||
"precision mediump int;\n"
|
||||
"precision mediump float;\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"uniform sampler2D texture;\n"
|
||||
"uniform float opacity;\n"
|
||||
"uniform bool color_only;\n"
|
||||
"uniform vec4 color_only_color;\n"
|
||||
"varying vec2 v_texcoord;\n"
|
||||
"\n";
|
||||
|
||||
// Finish the function with the main function
|
||||
|
||||
// Check if additional code was passed to this function, add it here
|
||||
if (shader_code.isEmpty()) {
|
||||
|
||||
// If not, just add a pure main() function
|
||||
|
||||
frag_shader.append("\n"
|
||||
"void main() {\n"
|
||||
" if (color_only) {\n"
|
||||
" gl_FragColor = color_only_color;"
|
||||
" } else {\n"
|
||||
" vec4 color = texture2D(texture, v_texcoord)*opacity;\n"
|
||||
" gl_FragColor = color;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
|
||||
} else {
|
||||
|
||||
// If additional code was passed, add it and reference it in main().
|
||||
//
|
||||
// The function in the additional code is expected to be `vec4 function_name(vec4 color)`. The texture coordinate can be
|
||||
// acquired through `v_texcoord`.
|
||||
|
||||
frag_shader.append(shader_code);
|
||||
|
||||
frag_shader.append(QString("\n"
|
||||
"void main() {\n"
|
||||
" vec4 color = %1(texture2D(texture, v_texcoord))*opacity;\n"
|
||||
" gl_FragColor = color;\n"
|
||||
"}\n").arg(function_name));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Add shaders to program
|
||||
program->addShaderFromSourceCode(QOpenGLShader::Vertex, vert_shader);
|
||||
program->addShaderFromSourceCode(QOpenGLShader::Fragment, frag_shader);
|
||||
program->link();
|
||||
|
||||
// Set opacity default to 100%
|
||||
program->bind();
|
||||
program->setUniformValue("opacity", 1.0f);
|
||||
program->release();
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
QString olive::gl::GetAlphaDisassociateFunction(const QString &function_name)
|
||||
{
|
||||
return QString("vec4 %1(vec4 col) {\n"
|
||||
" if (col.a > 0.0) {\n"
|
||||
" return vec4(col.rgb / col.a, col.a);"
|
||||
" }\n"
|
||||
" return col;\n"
|
||||
"}\n").arg(function_name);
|
||||
}
|
||||
|
||||
QString olive::gl::GetAlphaReassociateFunction(const QString &function_name)
|
||||
{
|
||||
return QString("vec4 %1(vec4 col) {\n"
|
||||
" if (col.a > 0.0) {\n"
|
||||
" return vec4(col.rgb * col.a, col.a);"
|
||||
" }\n"
|
||||
" return col;\n"
|
||||
"}\n").arg(function_name);
|
||||
}
|
||||
|
||||
QString olive::gl::GetAlphaAssociateFunction(const QString &function_name)
|
||||
{
|
||||
return QString("vec4 %1(vec4 col) {\n"
|
||||
" return vec4(col.rgb * col.a, col.a);\n"
|
||||
"}\n").arg(function_name);
|
||||
}
|
||||
|
||||
// copied from source code to OCIODisplay
|
||||
const int OCIO_LUT3D_EDGE_SIZE = 32;
|
||||
|
||||
// copied from source code to OCIODisplay, expanded from 3*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE
|
||||
const int OCIO_NUM_3D_ENTRIES = 98304;
|
||||
|
||||
ShaderPtr olive::gl::GetOCIOPipeline(QOpenGLContext* ctx,
|
||||
GLuint& lut_texture,
|
||||
OCIO::ConstProcessorRcPtr processor,
|
||||
bool alpha_is_associated)
|
||||
{
|
||||
|
||||
QOpenGLExtraFunctions* xf = ctx->extraFunctions();
|
||||
|
||||
// Create LUT texture
|
||||
xf->glGenTextures(1, &lut_texture);
|
||||
|
||||
// Bind LUT
|
||||
xf->glBindTexture(GL_TEXTURE_3D, lut_texture);
|
||||
|
||||
// Set texture parameters
|
||||
xf->glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
xf->glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
xf->glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
xf->glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
xf->glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
|
||||
// Allocate storage for texture
|
||||
xf->glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB16F_ARB,
|
||||
OCIO_LUT3D_EDGE_SIZE, OCIO_LUT3D_EDGE_SIZE, OCIO_LUT3D_EDGE_SIZE,
|
||||
0, GL_RGB,GL_FLOAT, nullptr);
|
||||
|
||||
//
|
||||
// SET UP GLSL SHADER
|
||||
//
|
||||
|
||||
OCIO::GpuShaderDesc shaderDesc;
|
||||
const char* ocio_func_name = "OCIODisplay";
|
||||
shaderDesc.setLanguage(OCIO::GPU_LANGUAGE_GLSL_1_0);
|
||||
shaderDesc.setFunctionName(ocio_func_name);
|
||||
shaderDesc.setLut3DEdgeLen(OCIO_LUT3D_EDGE_SIZE);
|
||||
|
||||
//
|
||||
// COMPUTE 3D LUT
|
||||
//
|
||||
|
||||
GLfloat* ocio_lut_data = new GLfloat[OCIO_NUM_3D_ENTRIES];
|
||||
processor->getGpuLut3D(ocio_lut_data, shaderDesc);
|
||||
|
||||
// Upload LUT data to texture
|
||||
xf->glTexSubImage3D(GL_TEXTURE_3D, 0,
|
||||
0, 0, 0,
|
||||
OCIO_LUT3D_EDGE_SIZE, OCIO_LUT3D_EDGE_SIZE, OCIO_LUT3D_EDGE_SIZE,
|
||||
GL_RGB, GL_FLOAT, ocio_lut_data);
|
||||
|
||||
delete [] ocio_lut_data;
|
||||
|
||||
// Create OCIO shader code
|
||||
QString shader_text(processor->getGpuShaderText(shaderDesc));
|
||||
|
||||
QString shader_call;
|
||||
|
||||
// Enforce alpha association
|
||||
if (alpha_is_associated) {
|
||||
|
||||
// If alpha is already associated, we'll need to disassociate and reassociate
|
||||
shader_text.append("\n");
|
||||
|
||||
QString disassociate_func_name = "disassoc";
|
||||
shader_text.append(GetAlphaDisassociateFunction(disassociate_func_name));
|
||||
|
||||
QString reassociate_func_name = "reassoc";
|
||||
shader_text.append(GetAlphaReassociateFunction(reassociate_func_name));
|
||||
|
||||
// Make OCIO call pass through disassociate and reassociate function
|
||||
shader_call = QString("%3(%1(%2(col), tex2));").arg(ocio_func_name,
|
||||
disassociate_func_name,
|
||||
reassociate_func_name);
|
||||
|
||||
} else {
|
||||
|
||||
// If alpha is not already associated, we can just associate after OCIO
|
||||
|
||||
// Add associate function
|
||||
QString associate_func_name = "assoc";
|
||||
shader_text.append(GetAlphaAssociateFunction(associate_func_name));
|
||||
|
||||
// Make OCIO call pass through associate function
|
||||
shader_call = QString("%2(%1(col, tex2));").arg(ocio_func_name, associate_func_name);
|
||||
|
||||
}
|
||||
|
||||
// Add process() function, which GetPipeline() will call if specified
|
||||
QString process_function_name = "process";
|
||||
shader_text.append(QString("\n"
|
||||
"uniform sampler3D tex2;\n"
|
||||
"\n"
|
||||
"vec4 %2(vec4 col) {\n"
|
||||
" return %1\n"
|
||||
"}\n").arg(shader_call, process_function_name));
|
||||
|
||||
|
||||
// Get pipeline-based shader to inject OCIO shader into
|
||||
ShaderPtr shader = olive::gl::GetDefaultPipeline(process_function_name, shader_text);
|
||||
|
||||
// Release LUT
|
||||
xf->glBindTexture(GL_TEXTURE_3D, 0);
|
||||
|
||||
return shader;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef SHADERGENERATORS_H
|
||||
#define SHADERGENERATORS_H
|
||||
|
||||
#include <OpenColorIO/OpenColorIO.h>
|
||||
namespace OCIO = OCIO_NAMESPACE::v1;
|
||||
|
||||
#include "shaderptr.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* Olive standardizes on OpenGL 3.2 Core which has no fixed pipeline. Instead, the pipeline is provided by the
|
||||
* programmer in the form of a shader. This is a collection of OpenGL shader pipeline generators for use throughout
|
||||
* Olive.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace olive {
|
||||
namespace gl {
|
||||
|
||||
ShaderPtr GetDefaultPipeline(const QString &function_name = QString(), const QString &shader_code = QString());
|
||||
|
||||
ShaderPtr GetOCIOPipeline(QOpenGLContext *ctx,
|
||||
GLuint &lut_texture,
|
||||
OCIO::ConstProcessorRcPtr processor,
|
||||
bool alpha_is_associated);
|
||||
|
||||
QString GetAlphaDisassociateFunction(const QString& function_name);
|
||||
QString GetAlphaReassociateFunction(const QString& function_name);
|
||||
QString GetAlphaAssociateFunction(const QString& function_name);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SHADERGENERATORS_H
|
||||
@@ -24,6 +24,6 @@
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <memory>
|
||||
|
||||
using QOpenGLShaderProgramPtr = std::shared_ptr<QOpenGLShaderProgram>;
|
||||
using ShaderPtr = std::shared_ptr<QOpenGLShaderProgram>;
|
||||
|
||||
#endif // QOPENGLSHADERPROGRAMPTR_H
|
||||
@@ -0,0 +1,30 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2019 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(cursors)
|
||||
add_subdirectory(graphics)
|
||||
add_subdirectory(icons)
|
||||
add_subdirectory(style)
|
||||
|
||||
set(OLIVE_RESOURCES
|
||||
${OLIVE_RESOURCES}
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 358 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 358 KiB |
|
Before Width: | Height: | Size: 359 KiB After Width: | Height: | Size: 359 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 358 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 358 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 358 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 358 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 358 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 358 KiB |
@@ -0,0 +1,21 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2019 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_RESOURCES
|
||||
${OLIVE_RESOURCES}
|
||||
ui/cursors/cursors.qrc
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2019 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_RESOURCES
|
||||
${OLIVE_RESOURCES}
|
||||
ui/graphics/graphics.qrc
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/graphics">
|
||||
<file>throbber.png</file>
|
||||
<file>olive-splash.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,28 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2019 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
ui/icons/icons.h
|
||||
ui/icons/icons.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
set(OLIVE_RESOURCES
|
||||
${OLIVE_RESOURCES}
|
||||
ui/icons/icons.qrc
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 412 B |
|
After Width: | Height: | Size: 510 B |
|
After Width: | Height: | Size: 806 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 431 B |
|
After Width: | Height: | Size: 573 B |
|
After Width: | Height: | Size: 1023 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 465 B |
|
After Width: | Height: | Size: 641 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 375 B |
|
After Width: | Height: | Size: 176 B |
|
After Width: | Height: | Size: 192 B |
|
After Width: | Height: | Size: 256 B |
|
After Width: | Height: | Size: 364 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 193 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 361 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 189 B |
|
After Width: | Height: | Size: 248 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 429 B |
|
After Width: | Height: | Size: 625 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 371 B |
|
After Width: | Height: | Size: 506 B |
|
After Width: | Height: | Size: 872 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 349 B |
|
After Width: | Height: | Size: 422 B |
|
After Width: | Height: | Size: 658 B |
|
After Width: | Height: | Size: 217 B |
|
After Width: | Height: | Size: 149 B |
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 584 B |
|
After Width: | Height: | Size: 969 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 380 B |
|
After Width: | Height: | Size: 498 B |
|
After Width: | Height: | Size: 777 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 423 B |
|
After Width: | Height: | Size: 530 B |
|
After Width: | Height: | Size: 813 B |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 614 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 383 B |
|
After Width: | Height: | Size: 569 B |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 818 B |
|
After Width: | Height: | Size: 349 B |
|
After Width: | Height: | Size: 388 B |