summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2019-04-24 16:27:40 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2019-05-02 07:15:45 +0000
commit6945d224433d731aaff1f83bf4d05ba812c8c36c (patch)
tree85fabc0db2ec0764bb1e26882f8ec56645589dc0 /tests
parent0e5bbcb7de19e3b32658089e20ddf05493442cda (diff)
Support alpha channel on color properties
Layer backgrounds are to use the alpha channel. This is also implemented in the editor (and RT1). Also update the VignetteEffect.effect to work correctly with the vec4 vegnette color and removed 3 duplicated test checks. Change-Id: I709629855f3172d65f359525e90cd5c91000f548 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/q3dslancelot/data/effects/effects/VignetteEffect.effect10
-rw-r--r--tests/auto/uipparser/tst_q3dsuipparser.cpp4
-rw-r--r--tests/scenes/effectgallery/VignetteEffect.effect10
3 files changed, 8 insertions, 16 deletions
diff --git a/tests/auto/q3dslancelot/data/effects/effects/VignetteEffect.effect b/tests/auto/q3dslancelot/data/effects/effects/VignetteEffect.effect
index a459120..ab649e1 100644
--- a/tests/auto/q3dslancelot/data/effects/effects/VignetteEffect.effect
+++ b/tests/auto/q3dslancelot/data/effects/effects/VignetteEffect.effect
@@ -15,20 +15,18 @@
void frag()
{
- float radius = vig_radius;
vec4 origColor = texture2D_0(TexCoord);
vec2 uv = TexCoord.xy;
vec2 center = vec2(0.5);
vec4 bg = origColor;
- uv *= 1.0 - uv.yx;
- float vig = uv.x*uv.y * vig_strenght;
+ uv *= 1.0 - uv.yx;
+ float vig = uv.x * uv.y * vig_strenght;
vig = pow(vig, vig_radius);
- vec4 vigmixcolor = vec4(vig_color,vig) * vec4(vig);
- gl_FragColor = vec4(mix(origColor,vigmixcolor,1.0-vig));
-
+ vec4 vigColor = vec4(vig_color.xyz, vig) * vig;
+ gl_FragColor = mix(origColor, vigColor, 1.0 - vig);
}
]]></FragmentShader>
</Shader>
diff --git a/tests/auto/uipparser/tst_q3dsuipparser.cpp b/tests/auto/uipparser/tst_q3dsuipparser.cpp
index b9e8a02..486c028 100644
--- a/tests/auto/uipparser/tst_q3dsuipparser.cpp
+++ b/tests/auto/uipparser/tst_q3dsuipparser.cpp
@@ -730,13 +730,11 @@ void tst_Q3DSUipParser::customMaterial()
Q3DSPropertyChangeList tilingChange = mat->applyDynamicProperties({{tilingKey, QVector3D(1, 2, 3)}});
QCOMPARE(tilingChange.cbegin()->nameStr(), tilingKey);
QCOMPARE(mat->dynamicProperties().value(tilingKey).value<QVector3D>(), QVector3D(1, 2, 3));
- QCOMPARE(mat->dynamicProperties().value(tilingKey).value<QVector3D>(), QVector3D(1, 2, 3));
// "dynamic" custom property setting
tilingChange = {Q3DSPropertyChange::fromVariant(tilingKey, QVector3D(4, 5, 6))};
mat->applyPropertyChanges({ tilingChange });
QCOMPARE(mat->dynamicProperties().value(tilingKey).value<QVector3D>(), QVector3D(4, 5, 6));
- QCOMPARE(mat->dynamicProperties().value(tilingKey).value<QVector3D>(), QVector3D(4, 5, 6));
}
void tst_Q3DSUipParser::effect()
@@ -759,13 +757,11 @@ void tst_Q3DSUipParser::effect()
Q3DSPropertyChangeList focusDistanceChange = e->applyDynamicProperties({{focusDistanceKey, 50.0f}});
QCOMPARE(focusDistanceChange.cbegin()->nameStr(), focusDistanceKey);
QCOMPARE(e->dynamicProperties().value(focusDistanceKey).toFloat(), 50.0f);
- QCOMPARE(e->dynamicProperties().value(focusDistanceKey).toFloat(), 50.0f);
// "dynamic" custom property setting
focusDistanceChange = {Q3DSPropertyChange::fromVariant(focusDistanceKey, 20.0f)};
e->applyPropertyChanges({ focusDistanceChange });
QCOMPARE(e->dynamicProperties().value(focusDistanceKey).toFloat(), 20.0f);
- QCOMPARE(e->dynamicProperties().value(focusDistanceKey).toFloat(), 20.0f);
}
void tst_Q3DSUipParser::primitiveMeshes()
diff --git a/tests/scenes/effectgallery/VignetteEffect.effect b/tests/scenes/effectgallery/VignetteEffect.effect
index a459120..ab649e1 100644
--- a/tests/scenes/effectgallery/VignetteEffect.effect
+++ b/tests/scenes/effectgallery/VignetteEffect.effect
@@ -15,20 +15,18 @@
void frag()
{
- float radius = vig_radius;
vec4 origColor = texture2D_0(TexCoord);
vec2 uv = TexCoord.xy;
vec2 center = vec2(0.5);
vec4 bg = origColor;
- uv *= 1.0 - uv.yx;
- float vig = uv.x*uv.y * vig_strenght;
+ uv *= 1.0 - uv.yx;
+ float vig = uv.x * uv.y * vig_strenght;
vig = pow(vig, vig_radius);
- vec4 vigmixcolor = vec4(vig_color,vig) * vec4(vig);
- gl_FragColor = vec4(mix(origColor,vigmixcolor,1.0-vig));
-
+ vec4 vigColor = vec4(vig_color.xyz, vig) * vig;
+ gl_FragColor = mix(origColor, vigColor, 1.0 - vig);
}
]]></FragmentShader>
</Shader>