overte/libraries/render-utils/src/hmd_ui.slf
2018-10-23 10:40:12 -07:00

40 lines
No EOL
891 B
Text

<@include gpu/Config.slh@>
<$VERSION_HEADER$>
// Generated on <$_SCRIBE_DATE$>
//
// hmd_ui.frag
// fragment shader
//
// Created by Sam Gondelman on 9/28/17.
// Copyright 2017 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
<@include render-utils/ShaderConstants.h@>
LAYOUT(binding=0) uniform sampler2D hudTexture;
struct HUDData {
float alpha;
};
LAYOUT_STD140(binding=0) uniform hudBuffer {
HUDData hud;
};
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
#define _texCoord0 _texCoord01.xy
#define _texCoord1 _texCoord01.zw
layout(location=0) out vec4 fragColor0;
void main() {
vec4 color = texture(hudTexture, _texCoord0);
color.a *= hud.alpha;
if (color.a <= 0.0) {
discard;
}
fragColor0 = color;
}