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:
itsmattkc
2019-12-09 23:49:44 +11:00
parent 5819b451fd
commit daafcbfc95
5 changed files with 77 additions and 5 deletions
+5 -5
View File
@@ -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}
+21
View File
@@ -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
)
+6
View File
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/shaders">
<file>videoinput.frag</file>
<file>videoinput.vert</file>
</qresource>
</RCC>
+8
View File
@@ -0,0 +1,8 @@
#version 110
varying vec2 ove_texcoord;
uniform sampler2D footage_in;
void main(void) {
gl_FragColor = texture2D(footage_in, ove_texcoord);
}
+37
View File
@@ -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;
}