mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-31 10:11:20 +00:00
Fix: clamp frame to black when outside texture boundaries.
This commit is contained in:
parent
dc8061a0a4
commit
0594668387
@ -61,6 +61,7 @@ Item{
|
|||||||
sourceItem: frameimage
|
sourceItem: frameimage
|
||||||
hideSource: true
|
hideSource: true
|
||||||
textureSize: Qt.size(parent.width, parent.height)
|
textureSize: Qt.size(parent.width, parent.height)
|
||||||
|
sourceRect: Qt.rect(-1, -1, frameimage.width + 2, frameimage.height + 2)
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
ShaderEffectSource{
|
ShaderEffectSource{
|
||||||
@ -68,6 +69,7 @@ Item{
|
|||||||
sourceItem: framenormals
|
sourceItem: framenormals
|
||||||
hideSource: true
|
hideSource: true
|
||||||
textureSize: Qt.size(parent.width, parent.height)
|
textureSize: Qt.size(parent.width, parent.height)
|
||||||
|
sourceRect: Qt.rect(-1, -1, framenormals.width + 2, framenormals.height + 2)
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +148,7 @@ Item{
|
|||||||
|
|
||||||
vec3 normal = normalize(txtNormal.rgb * 2.0 - 1.0);
|
vec3 normal = normalize(txtNormal.rgb * 2.0 - 1.0);
|
||||||
vec2 lightDirection = normalize(vec2(0.5, 0.5) - coords);
|
vec2 lightDirection = normalize(vec2(0.5, 0.5) - coords);
|
||||||
float dotProd = dot(normal, vec3(lightDirection, 0.0)) * diffuseComponent;
|
float dotProd = dot(normal, vec3(lightDirection, 0.0)) * diffuseComponent * txtNormal.a;
|
||||||
|
|
||||||
vec3 darkColor = dotProd * reflectionColor.rgb;
|
vec3 darkColor = dotProd * reflectionColor.rgb;
|
||||||
gl_FragColor = vec4(mix(darkColor, txtColor.rgb, ambient_light), dotProd);
|
gl_FragColor = vec4(mix(darkColor, txtColor.rgb, ambient_light), dotProd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user