began external shader files that can be compiled into the program
Helps write shaders rather than embedding them into the C++ code.
This commit is contained in:
@@ -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}
|
||||
shaders/shaders.qrc
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/shaders">
|
||||
<file>videoinput.frag</file>
|
||||
<file>videoinput.vert</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -0,0 +1,8 @@
|
||||
#version 110
|
||||
|
||||
varying vec2 ove_texcoord;
|
||||
uniform sampler2D footage_in;
|
||||
|
||||
void main(void) {
|
||||
gl_FragColor = texture2D(footage_in, ove_texcoord);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user