fix shader: resolvedUrl path, vec4 for std140 alignment, color type
This commit is contained in:
parent
2e1789ba7d
commit
9804ed2287
2 changed files with 9 additions and 9 deletions
|
|
@ -29,15 +29,15 @@ PanelWindow {
|
|||
ShaderEffect {
|
||||
id: fx
|
||||
anchors.fill: parent
|
||||
fragmentShader: "hex_wave.frag.qsb"
|
||||
fragmentShader: Qt.resolvedUrl("hex_wave.frag.qsb")
|
||||
|
||||
// Uniforms
|
||||
property size uResolution: Qt.size(width, height)
|
||||
property real uSize: 50.0
|
||||
property real uWavePhase: -200
|
||||
property vector3d uC0: Qt.vector3d(M.Theme.base0C.r, M.Theme.base0C.g, M.Theme.base0C.b)
|
||||
property vector3d uC1: Qt.vector3d(M.Theme.base0E.r, M.Theme.base0E.g, M.Theme.base0E.b)
|
||||
property vector3d uC2: Qt.vector3d(M.Theme.base09.r, M.Theme.base09.g, M.Theme.base09.b)
|
||||
property color uC0: M.Theme.base0C
|
||||
property color uC1: M.Theme.base0E
|
||||
property color uC2: M.Theme.base09
|
||||
|
||||
// 12 spinner uniforms
|
||||
property vector4d uSpinners0: Qt.vector4d(0, 0, 0, 0)
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ layout(std140, binding = 0) uniform buf {
|
|||
vec2 uResolution;
|
||||
float uSize;
|
||||
float uWavePhase;
|
||||
vec3 uC0;
|
||||
vec3 uC1;
|
||||
vec3 uC2;
|
||||
vec4 uC0;
|
||||
vec4 uC1;
|
||||
vec4 uC2;
|
||||
|
||||
vec4 uSpinners0;
|
||||
vec4 uSpinners1;
|
||||
|
|
@ -84,8 +84,8 @@ void main() {
|
|||
// Gradient color
|
||||
float fx = clamp(center.x / uResolution.x, 0.0, 1.0);
|
||||
vec3 rgb = fx < 0.5
|
||||
? mix(uC0, uC1, fx * 2.0)
|
||||
: mix(uC1, uC2, (fx - 0.5) * 2.0);
|
||||
? mix(uC0.rgb, uC1.rgb, fx * 2.0)
|
||||
: mix(uC1.rgb, uC2.rgb, (fx - 0.5) * 2.0);
|
||||
|
||||
// Alpha from distance to center
|
||||
float fy = clamp(center.y / uResolution.y, 0.0, 1.0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue