-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: WebFreak001 <[email protected]>
- Loading branch information
1 parent
d5d0c3c
commit 069aa20
Showing
2 changed files
with
37 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
#include "sh_CustomizedShaderGlobalUniforms.h" | ||
#include "sh_Utils.h" | ||
|
||
varying mediump vec2 v_TexCoord; | ||
layout(location = 2) in highp vec2 v_TexCoord; | ||
|
||
uniform lowp sampler2D m_Sampler; | ||
layout(std140, set = 2, binding = 0) uniform m_ShadowParameters | ||
{ | ||
mediump vec4 g_Colour; | ||
mediump vec2 g_Offset; | ||
}; | ||
|
||
layout(set = 1, binding = 0) uniform lowp texture2D m_Texture; | ||
layout(set = 1, binding = 1) uniform lowp sampler m_Sampler; | ||
|
||
uniform mediump vec2 g_TexSize; | ||
uniform vec4 g_Colour; | ||
uniform vec2 g_Offset; | ||
uniform float g_InflationPercentage; | ||
layout(location = 0) out vec4 o_Colour; | ||
|
||
lowp vec4 shadow(sampler2D tex, mediump vec2 texCoord, mediump vec2 texSize, mediump vec4 colour, mediump vec2 offset) | ||
lowp vec4 shadow(texture2D tex, mediump vec2 texCoord, mediump vec2 texSize, mediump vec4 colour, mediump vec2 offset) | ||
{ | ||
return texture2D(tex, texCoord + offset / texSize).a * colour; | ||
return texture(sampler2D(tex, m_Sampler), texCoord + offset / texSize).a * colour; | ||
} | ||
|
||
void main(void) | ||
{ | ||
lowp vec4 texture = toSRGB(texture2D(m_Sampler, v_TexCoord)); | ||
lowp vec4 shadow = shadow(m_Sampler, v_TexCoord, g_TexSize, g_Colour, g_Offset * g_InflationPercentage); | ||
gl_FragColor = mix(shadow, texture, texture.a); | ||
lowp vec4 texture = toSRGB(texture(sampler2D(m_Texture, m_Sampler), v_TexCoord)); | ||
lowp vec4 shadow = shadow(m_Texture, v_TexCoord, g_TexSize, g_Colour, g_Offset * g_InflationPercentage); | ||
o_Colour = mix(shadow, texture, texture.a); | ||
} |