You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
927 B
GLSL
30 lines
927 B
GLSL
uniform vec4 color;
|
|
uniform vec4 outlineColor;
|
|
uniform float outlineWidth;
|
|
|
|
varying float v_width;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec2 st = materialInput.st;
|
|
float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;
|
|
float b = step(0.5 - halfInteriorWidth, st.t);
|
|
b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);
|
|
|
|
// Find the distance from the closest separator (region between two colors)
|
|
float d1 = abs(st.t - (0.5 - halfInteriorWidth));
|
|
float d2 = abs(st.t - (0.5 + halfInteriorWidth));
|
|
float dist = min(d1, d2);
|
|
|
|
vec4 currentColor = mix(outlineColor, color, b);
|
|
vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);
|
|
outColor = czm_gammaCorrect(outColor);
|
|
|
|
material.diffuse = outColor.rgb;
|
|
material.alpha = outColor.a;
|
|
|
|
return material;
|
|
}
|