mirror of
https://github.com/overte-org/overte.git
synced 2025-08-17 04:27:13 +02:00
40 lines
1.1 KiB
Text
40 lines
1.1 KiB
Text
<@include gpu/Config.slh@>
|
|
<$VERSION_HEADER$>
|
|
// Generated on <$_SCRIBE_DATE$>
|
|
//
|
|
// paintStroke.frag
|
|
// fragment shader
|
|
//
|
|
// Created by Eric Levin on 8/10/2015
|
|
// Copyright 2015 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 DeferredBufferWrite.slh@>
|
|
|
|
<@include paintStroke.slh@>
|
|
<$declarePolyLineBuffers()$>
|
|
|
|
LAYOUT(binding=0) uniform sampler2D _texture;
|
|
|
|
layout(location=0) in vec3 _normalWS;
|
|
layout(location=1) in vec2 _texCoord;
|
|
layout(location=2) in vec4 _color;
|
|
layout(location=3) in float _distanceFromCenter;
|
|
|
|
void main(void) {
|
|
vec4 texel = texture(_texture, _texCoord);
|
|
int frontCondition = 1 - 2 * int(gl_FrontFacing);
|
|
vec3 color = _color.rgb * texel.rgb;
|
|
float alpha = texel.a * _color.a;
|
|
|
|
alpha *= mix(1.0, pow(1.0 - abs(_distanceFromCenter), 10.0), _polylineData.faceCameraGlow.y);
|
|
|
|
packDeferredFragmentTranslucent(
|
|
float(frontCondition) * _normalWS,
|
|
alpha,
|
|
color,
|
|
DEFAULT_ROUGHNESS);
|
|
}
|