Subpixel rendering (#186)
Reviewed-on: https://git.madvoxel.net/OpenVulkano/OpenVulkano/pulls/186 Reviewed-by: Georg Hagen <georg.hagen@madvoxel.com> Co-authored-by: ohyzha <oleksii.hyzha.ext@madvoxel.com> Co-committed-by: ohyzha <oleksii.hyzha.ext@madvoxel.com>
This commit is contained in:
20
openVulkanoCpp/Shader/subpixelText.frag
Normal file
20
openVulkanoCpp/Shader/subpixelText.frag
Normal file
@@ -0,0 +1,20 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec4 color;
|
||||
layout(location = 1) in vec4 bgColor;
|
||||
layout(location = 2) in vec2 texCoord;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
layout(set = 2, binding = 0) uniform sampler2D texSampler;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 sampled = texture(texSampler, texCoord);
|
||||
float alpha = max(sampled.r, max(sampled.g, sampled.b));
|
||||
outColor = vec4(color) * vec4(sampled.rgb, alpha);
|
||||
if (bgColor.a != 0)
|
||||
{
|
||||
outColor = mix(bgColor, outColor, alpha);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user