nodes: removed XML infrastructure

This commit is contained in:
itsmattkc
2020-05-06 15:06:37 +10:00
parent fd30643204
commit fb625cb76e
37 changed files with 661 additions and 1090 deletions
+9 -1
View File
@@ -14,8 +14,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
file(GLOB_RECURSE SHADER_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.frag *.vert)
set(QRC_BODY "")
foreach(SHADER_FILE ${SHADER_RESOURCES})
string(APPEND QRC_BODY "<file>${SHADER_FILE}</file>\n")
configure_file(${SHADER_FILE} ${SHADER_FILE} COPYONLY)
endforeach()
configure_file(shaders.qrc.in shaders.qrc @ONLY)
set(OLIVE_RESOURCES
${OLIVE_RESOURCES}
shaders/shaders.qrc
${CMAKE_CURRENT_BINARY_DIR}/shaders.qrc
PARENT_SCOPE
)
-24
View File
@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect id="org.olivevideoeditor.Olive.alphaoverblend">
<!-- Effect Name -->
<name lang="en_US">Alpha Over</name>
<!-- Effect Category -->
<category>3</category>
<!-- Effect Description -->
<description lang="en_US">
A blending node that composites one texture over another using its alpha channel.
</description>
<!-- Blending Parameters -->
<param id="base_in" type="texture">
<name lang="en_US">Base</name>
</param>
<param id="blend_in" type="texture">
<name lang="en_US">Blend</name>
</param>
<!-- Qt Resource path to fragment shader -->
<fragment url=":/shaders/alphaover.frag" />
</effect>
-70
View File
@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect id="org.olivevideoeditor.Olive.blur">
<!-- Effect Name -->
<name lang="en_US">Blur</name>
<!-- Effect Category -->
<category>4</category>
<!-- Effect Description -->
<description lang="en_US">
Blurs an image.
</description>
<!-- Parameter: Texture Input -->
<param id="tex_in" type="texture" iterative_input="1">
<name lang="en_US">Input</name>
</param>
<!-- Parameter: Method Input -->
<param id="method_in" type="combo">
<name lang="en_US">Method</name>
<option>
<name lang="en_US">Box</name>
<description lang="en_US">A fast blur calculated by averaging a square of pixels around each pixel. Fast, but can have a "striated" look to it.</description>
</option>
<option>
<name lang="en_US">Gaussian</name>
<description lang="en_US">A smooth blur using the gaussian function. Slower than box blur but much prettier.</description>
</option>
</param>
<!-- Parameter: Radius Input -->
<param id="radius_in" type="float">
<name lang="en_US">Radius</name>
<min>0</min>
<default>
<value>10</value>
</default>
</param>
<!-- Parameter: Horizontal Enable -->
<param id="horiz_in" type="bool">
<name lang="en_US">Horizontal</name>
<default>
<value>1</value>
</default>
</param>
<!-- Parameter: Vertical Enable -->
<param id="vert_in" type="bool">
<name lang="en_US">Vertical</name>
<default>
<value>1</value>
</default>
</param>
<!-- Parameter: Repeat Edge Pixels -->
<param id="repeat_edge_pixels_in" type="bool">
<name lang="en_US">Repeat Edge Pixels</name>
<default>
<value>0</value>
</default>
</param>
<!-- Qt Resource path to fragment shader -->
<fragment url=":/shaders/blur.frag"/>
<!-- Blur uses two iterations for horizontal and vertical since calculating 2*radius is faster than radius^2 -->
<iterations>2</iterations>
</effect>
-16
View File
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect id="org.olivevideoeditor.Olive.crossdissolve">
<!-- Effect Name -->
<name lang="en_US">Cross Dissolve</name>
<!-- Effect Category -->
<category></category>
<!-- Effect Description -->
<description lang="en_US">
A smooth fade transition from one video clip to another.
</description>
<!-- Qt Resource path to fragment shader -->
<fragment url=":/shaders/crossdissolve.frag"/>
</effect>
-16
View File
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect id="org.olivevideoeditor.Olive.diptoblack">
<!-- Effect Name -->
<name lang="en_US">Dip to Black</name>
<!-- Effect Category -->
<category></category>
<!-- Effect Description -->
<description lang="en_US">
A smooth dip to transparency and back into another clip.
</description>
<!-- Qt Resource path to fragment shader -->
<fragment url=":/shaders/diptoblack.frag"/>
</effect>
-62
View File
@@ -1,62 +0,0 @@
#version 150
#define M_PI 3.1415926535897932384626433832795
uniform sampler2D tex_in;
uniform vec3 color_in;
uniform float softness_in;
uniform float opacity_in;
uniform float distance_in;
uniform float direction_in;
uniform vec2 ove_resolution;
in vec2 ove_texcoord;
out vec4 fragColor;
void main(void) {
// Use pythagoras with the distance (hypotenuse) to find the shadow offset
float direction_radians = direction_in * (M_PI / 180.0);
float opposite = sin(direction_radians) * distance_in;
float adjacent = cos(direction_radians) * distance_in;
vec2 angle = vec2(adjacent, opposite);
// Convert distance from pixels to 0.0 - 1.0 texture coordinates
angle /= ove_resolution;
float shadow_alpha;
// For a soft shadow, we use a box blur-like formula
if (softness_in > 0.0) {
float radius = ceil(softness_in);
float divider = 1.0 / pow(softness_in, 2.0);
shadow_alpha = 0.0;
for (float x = -radius + 0.5; x <= radius; x += 2.0) {
for (float y = -radius + 0.5; y <= radius; y += 2.0) {
vec2 pixel_coord = ove_texcoord - angle;
pixel_coord.x += x / ove_resolution.x;
pixel_coord.y += y / ove_resolution.y;
vec4 pixel_color = texture(tex_in, pixel_coord);
shadow_alpha += pixel_color.a * divider;
}
}
} else {
// Perfectly hard shadow
vec4 src_color = texture(tex_in, ove_texcoord - angle);
shadow_alpha = src_color.a;
}
vec4 shadow_px = vec4(color_in, shadow_alpha * opacity_in * 0.01);
// Get current pixel and perform an alpha over for it over the shadow we've made
vec4 dst_color = texture(tex_in, ove_texcoord);
shadow_px *= (1.0 - dst_color.a);
shadow_px += dst_color;
fragColor = shadow_px;
}
-64
View File
@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect id="org.olivevideoeditor.Olive.dropshadow">
<!-- Effect Name -->
<name lang="en_US">Drop Shadow</name>
<!-- Effect Category -->
<category lang="en_US">Stylize</category>
<category lang="en_GB">Stylise</category>
<!-- Effect Description -->
<description lang="en_US">
Generate a drop shadow of a clip.
</description>
<!-- Parameter: Texture Input -->
<param id="tex_in" type="texture">
<name lang="en_US">Input</name>
</param>
<!-- Parameter: Color Input -->
<param id="color_in" type="color">
<name lang="en_US">Color</name>
<name lang="en_GB">Colour</name>
</param>
<!-- Parameter: Softness Input -->
<param id="softness_in" type="float">
<name lang="en_US">Softness</name>
<min>0</min>
<default>
<value>10</value>
</default>
</param>
<!-- Parameter: Opacity Input -->
<param id="opacity_in" type="float">
<name lang="en_US">Opacity</name>
<min>0</min>
<default>
<value>80</value>
</default>
<max>100</max>
</param>
<!-- Parameter: Distance Input -->
<param id="distance_in" type="float">
<name lang="en_US">Distance</name>
<min>0</min>
<default>
<value>10</value>
</default>
</param>
<!-- Parameter: Direction Input -->
<param id="direction_in" type="float">
<name lang="en_US">Direction</name>
<default>
<value>45</value>
</default>
</param>
<!-- Qt Resource path to fragment shader -->
<fragment url=":/shaders/dropshadow.frag"/>
</effect>
-22
View File
@@ -1,22 +0,0 @@
<RCC>
<qresource prefix="/shaders">
<file>alphaover.frag</file>
<file>alphaover.xml</file>
<file>blur.frag</file>
<file>blur.xml</file>
<file>colorgradient.frag</file>
<file>colorwheel.frag</file>
<file>crossdissolve.frag</file>
<file>crossdissolve.xml</file>
<file>dropshadow.frag</file>
<file>dropshadow.xml</file>
<file>diptoblack.frag</file>
<file>diptoblack.xml</file>
<file>rgbwaveform.frag</file>
<file>solid.frag</file>
<file>solid.xml</file>
<file>stroke.frag</file>
<file>stroke.xml</file>
<file>matrix.vert</file>
</qresource>
</RCC>
+5
View File
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/shaders">
@QRC_BODY@
</qresource>
</RCC>
-31
View File
@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect id="org.olivevideoeditor.Olive.solidgenerator">
<!-- Effect Name -->
<name lang="en_US">Solid</name>
<!-- Effect Category -->
<category lang="en_US">Generator</category>
<!-- Effect Description -->
<description lang="en_US">
Generate a solid color.
</description>
<description lang="en_GB">
Generate a solid colour.
</description>
<!-- Parameter: Color Value -->
<param id="color_in" type="color">
<name lang="en_US">Color</name>
<name lang="en_GB">Colour</name>
<default>
<value>1.0</value>
<value>0.0</value>
<value>0.0</value>
<value>1.0</value>
</default>
</param>
<!-- Qt Resource path to fragment shader -->
<fragment url=":/shaders/solid.frag" />
</effect>
+3 -4
View File
@@ -2,7 +2,7 @@
// Node parameter inputs
uniform sampler2D tex_in;
uniform vec3 color_in;
uniform vec4 color_in;
uniform float radius_in;
uniform float opacity_in;
uniform bool inner_in;
@@ -61,15 +61,14 @@ void main(void) {
}
}
stroke_weight *= opacity_in * 0.01;
stroke_weight *= opacity_in;
if (inner_in) {
stroke_weight *= pixel_here.a;
}
// Make RGBA color
vec4 stroke_col = vec4(vec3(1.0) * stroke_weight, stroke_weight);
//vec4 stroke_col = vec4(color_in * stroke_weight, stroke_weight);
vec4 stroke_col = color_in * stroke_weight;
if (inner_in) {
// Alpha over the stroke over the texture
-55
View File
@@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect id="org.olivevideoeditor.Olive.stroke">
<!-- Effect Name -->
<name lang="en_US">Stroke</name>
<!-- Effect Category -->
<category lang="en_US">Stylize</category>
<category lang="en_GB">Stylise</category>
<!-- Effect Description -->
<description lang="en_US">
Creates a stroke outline around an image.
</description>
<!-- Parameter: Texture Input -->
<param id="tex_in" type="texture">
<name lang="en_US">Input</name>
</param>
<!-- Parameter: Color Value -->
<param id="color_in" type="color">
<name lang="en_US">Color</name>
<name lang="en_GB">Colour</name>
</param>
<!-- Parameter: Radius Value -->
<param id="radius_in" type="float">
<name lang="en_US">Radius</name>
<min>0</min>
<default>
<value>10</value>
</default>
</param>
<!-- Parameter: Opacity Value -->
<param id="opacity_in" type="float">
<name lang="en_US">Opacity</name>
<min>0</min>
<default>
<value>100</value>
</default>
<max>100</max>
</param>
<!-- Parameter: Inner Value -->
<param id="inner_in" type="bool">
<name lang="en_US">Inner</name>
<default>
<value>false</value>
</default>
</param>
<!-- Qt Resource path to fragment shader -->
<fragment url=":/shaders/stroke.frag" />
</effect>