-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrailDraw.frag
29 lines (22 loc) · 1 KB
/
trailDraw.frag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
uniform sampler2D segmentsColorTexture;
uniform sampler2D segmentsDepthTexture;
uniform sampler2D currentTrailsColor;
uniform sampler2D trailsDepthTexture;
uniform float fadeOpacity;
varying vec2 textureCoordinate;
void main() {
vec4 pointsColor = texture2D(segmentsColorTexture, textureCoordinate);
vec4 trailsColor = texture2D(currentTrailsColor, textureCoordinate);
trailsColor = floor(fadeOpacity * 255.0 * trailsColor) / 255.0; // make sure the trailsColor will be strictly decreased
float pointsDepth = texture2D(segmentsDepthTexture, textureCoordinate).r;
float trailsDepth = texture2D(trailsDepthTexture, textureCoordinate).r;
float globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, textureCoordinate));
gl_FragColor = vec4(0.0);
if (pointsDepth < globeDepth) {
gl_FragColor = gl_FragColor + pointsColor;
}
if (trailsDepth < globeDepth) {
gl_FragColor = gl_FragColor + trailsColor;
}
gl_FragDepthEXT = min(pointsDepth, trailsDepth);
}