jacekpoz
97ca8319c3
uses stb to load the image, currently all images have their texture replaced with the texture of the first image gonna try to fix that soon
27 lines
725 B
GLSL
27 lines
725 B
GLSL
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
|
|
|
|
#version 450
|
|
|
|
layout(constant_id = 0) const int PTK_COMPONENT_TYPE_ELLIPSE = 0;
|
|
layout(constant_id = 1) const int PTK_COMPONENT_TYPE_IMAGE = 0;
|
|
|
|
layout(location = 0) in vec3 fragColor;
|
|
layout(location = 1) flat in int shapeType;
|
|
layout(location = 2) in vec2 uv;
|
|
|
|
layout(location = 0) out vec4 outColor;
|
|
|
|
layout(binding = 1) uniform sampler2D texSampler;
|
|
|
|
void main() {
|
|
if (shapeType == PTK_COMPONENT_TYPE_ELLIPSE) {
|
|
if (length(uv - vec2(0.5)) > 0.5) {
|
|
discard;
|
|
}
|
|
}
|
|
if (shapeType == PTK_COMPONENT_TYPE_IMAGE) {
|
|
outColor = texture(texSampler, uv);
|
|
} else {
|
|
outColor = vec4(fragColor, 1.0);
|
|
}
|
|
}
|