Files
MapLibreParticleLab/shaders/drawable.collision_box.fragment.glsl
mwilsnd 642903fdb4 Merge branch 'topic/drawable-fixes' into topic/drawable (#1560)
Co-authored-by: Stefan Karschti <stefan.karschti@gmail.com>
Co-authored-by: Alex Cristici <alex.cristici@gmail.com>
Co-authored-by: Tim Sylvester <tim@wetdogweather.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-31 15:36:19 +02:00

27 lines
568 B
GLSL

layout (std140) uniform CollisionBoxUBO {
highp mat4 u_matrix;
highp vec2 u_extrude_scale;
highp float u_camera_to_center_distance;
highp float pad1;
};
in float v_placed;
in float v_notUsed;
void main() {
float alpha = 0.5;
// Red = collision, hide label
fragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;
// Blue = no collision, label is showing
if (v_placed > 0.5) {
fragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;
}
if (v_notUsed > 0.5) {
// This box not used, fade it out
fragColor *= .1;
}
}