diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 2370e85d7..42aaa323e 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -21,6 +21,10 @@ set(OLIVE_SOURCES main.cpp ) +set(OLIVE_RESOURCES + ${OLIVE_RESOURCES} +) + add_subdirectory(audio) add_subdirectory(common) add_subdirectory(config) @@ -30,6 +34,7 @@ add_subdirectory(node) add_subdirectory(panel) add_subdirectory(project) add_subdirectory(render) +add_subdirectory(shaders) add_subdirectory(task) add_subdirectory(timeline) add_subdirectory(tool) @@ -43,11 +48,6 @@ if(APPLE) set(OLIVE_TARGET "Olive") endif() -set(OLIVE_RESOURCES - ${OLIVE_RESOURCES} - #effects/internal/internalshaders.qrc -) - add_executable(${OLIVE_TARGET} ${OLIVE_SOURCES} ${OLIVE_RESOURCES} diff --git a/app/shaders/CMakeLists.txt b/app/shaders/CMakeLists.txt new file mode 100644 index 000000000..762945e1b --- /dev/null +++ b/app/shaders/CMakeLists.txt @@ -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 . + +set(OLIVE_RESOURCES + ${OLIVE_RESOURCES} + shaders/shaders.qrc + PARENT_SCOPE +) diff --git a/app/shaders/shaders.qrc b/app/shaders/shaders.qrc new file mode 100644 index 000000000..3d9cc079e --- /dev/null +++ b/app/shaders/shaders.qrc @@ -0,0 +1,6 @@ + + + videoinput.frag + videoinput.vert + + diff --git a/app/shaders/videoinput.frag b/app/shaders/videoinput.frag new file mode 100644 index 000000000..7e7f15b4f --- /dev/null +++ b/app/shaders/videoinput.frag @@ -0,0 +1,8 @@ +#version 110 + +varying vec2 ove_texcoord; +uniform sampler2D footage_in; + +void main(void) { + gl_FragColor = texture2D(footage_in, ove_texcoord); +} diff --git a/app/shaders/videoinput.vert b/app/shaders/videoinput.vert new file mode 100644 index 000000000..f648adbc5 --- /dev/null +++ b/app/shaders/videoinput.vert @@ -0,0 +1,37 @@ +#version 110 + +uniform mat4 matrix_in; + +attribute vec4 a_position; +attribute vec2 a_texcoord; + +varying vec2 ove_texcoord; + +uniform vec2 footage_in_resolution; +uniform vec2 ove_resolution; + +mat4 scale_mat4(vec3 scale) { + return mat4( + scale.x, 0.0, 0.0, 0.0, + 0.0, scale.y, 0.0, 0.0, + 0.0, 0.0, scale.z, 0.0, + 0.0, 0.0, 0.0, 1.0 + ); +} + +void main() { + // Create identity matrix + mat4 transform = mat4(1.0); + + // Scale to square + transform *= scale_mat4(vec3(1.0/ove_resolution, 1.0)); + + // Multiply by received matrix + transform *= matrix_in; + + // Scale back out to footage size + transform *= scale_mat4(vec3(footage_in_resolution, 1.0)); + + gl_Position = transform * a_position; + ove_texcoord = a_texcoord; +}