2023-08-24 10:54:59 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2018-2023 Blender Authors
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
|
2025-09-25 10:57:02 +02:00
|
|
|
#include "infos/gpu_shader_gpencil_stroke_infos.hh"
|
2024-11-12 18:53:34 +01:00
|
|
|
|
|
|
|
|
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke)
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
void main()
|
|
|
|
|
{
|
2025-04-15 11:36:53 +02:00
|
|
|
constexpr float2 center = float2(0, 0.5f);
|
2025-04-14 13:46:41 +02:00
|
|
|
float4 tColor = interp.mColor;
|
2018-07-31 10:22:19 +02:00
|
|
|
/* if alpha < 0, then encap */
|
2023-02-23 08:26:01 +01:00
|
|
|
if (tColor.a < 0) {
|
2025-04-11 18:28:45 +02:00
|
|
|
tColor.a = tColor.a * -1.0f;
|
2024-10-21 16:25:24 +02:00
|
|
|
float dist = length(interp.mTexCoord - center);
|
2025-04-11 18:28:45 +02:00
|
|
|
if (dist > 0.25f) {
|
2025-05-05 09:59:00 +02:00
|
|
|
gpu_discard_fragment();
|
2018-07-31 10:22:19 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* Solid */
|
|
|
|
|
fragColor = tColor;
|
|
|
|
|
}
|