Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rectalogic committed Jan 7, 2024
1 parent e57bd85 commit 4e2d5a6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 91 deletions.
2 changes: 2 additions & 0 deletions src/MediaFX/qml/effects/LumaMixer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ MediaMixer {
id: root

default required property Item luma
property real transitionWidth: root.width
readonly property real timeMulTransitionWidthPlusOne: root.time * transitionWidth + 1.0

fragmentShader: "qrc:/shaders/qml/effects/luma.frag.qsb"
state: "default"
Expand Down
17 changes: 14 additions & 3 deletions src/MediaFX/qml/effects/luma.frag
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float qt_Opacity;
float time;
float transitionWidth;
float timeMulTransitionWidthPlusOne;
};
layout(binding = 1) uniform sampler2D source;
layout(binding = 2) uniform sampler2D dest;
Expand All @@ -27,10 +29,19 @@ void main() {
vec4 sp = texture(source, qt_TexCoord0);
vec4 dp = texture(dest, qt_TexCoord0);
vec4 lp = texture(luma, qt_TexCoord0);
vec4 m = clamp((lp * time), vec4(0.0), vec4(1.0));


vec4 m = clamp((lp * vec4(transitionWidth) - vec4(transitionWidth)) + vec4(timeMulTransitionWidthPlusOne), vec4(0.0), vec4(1.0));
fragColor = mix(sp, dp, m) * qt_Opacity;


/*
float m = clamp((lp.r * transitionWidth - transitionWidth) + (timeMulTransitionWidthPlusOne), 0.0, 1.0);
fragColor = mix(sp, dp, m) * qt_Opacity;
fragColor = vec4(lp.rgb, 1.0);
fragColor = vec4(mix(sp.rgb, dp.rgb, m.rgb), 1.0) * qt_Opacity;
*/

//fragColor = vec4(lp.rgb, 1.0);
//fragColor = vec4(mix(sp.rgb, dp.rgb, m.rgb), 1.0) * qt_Opacity;
//fragColor = vec4(1.0, 0.0, 0.0, 1.0);

/*XXX
Expand Down
87 changes: 0 additions & 87 deletions tests/qml/MediaMixerHarness.qml

This file was deleted.

1 change: 1 addition & 0 deletions tools/viewer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ int main(int argc, char* argv[])
QUrl url(args.at(0));

QQuickView quickView(url);
quickView.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
// qCritical() << quickView.errors();
quickView.show();

Expand Down
2 changes: 1 addition & 1 deletion tools/viewer/qml/MediaMixerHarness.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import MediaFX
Item {
id: root

default property alias mixer: mixerContainer.children
default property alias mixer: mixerContainer.data

height: 400
state: "default"
Expand Down

0 comments on commit 4e2d5a6

Please sign in to comment.