maps-api-for-javascript-examples
maps-api-for-javascript-examples copied to clipboard
Tangram: Style: error compiling program
Thanks for such great library 🙂
We recently upgraded the heremaps version from 1.23.0
to 1.30.7
and we started to see this error Tangram [error]: Style: error compiling program for style '1_translucent-pattern-lines'
in production logs.
I saw the release notes from 1.23.0
upto 1.30.7
to see if missed any breaking changes but there is nothing caught my eyes.
When there is an error the user will see the below image 👇
I cannot able to reproduce this locally with : Chrome 97.0.4692.71 (Official Build) (x86_64) macOS 11.4
OR Chrome 97 Windows 10
Affected users are with version :
- Chrome 97, 96 and Windows 10 & 7 combinations.
- Edge 97 & Window 10
- FF 96 & Window 10
- Safari 15 & macOS 10
Open question:
From the release notes I see there is no version for 1.23.0
but when installed it installs the exact version. I assume heremaps 3 has this preceding 3
in front of every release.
This is what we used in our package.json "@here/maps-api-for-javascript": "^1.23.0"
Full Log:
console error: Tangram [error]: Style: error compiling program for style '1_translucent-pattern-lines' (program key 'program') <error: unable to serialize object> Error: Error: WebGL program error:
VALIDATE_STATUS: false
ERROR: 0
--- Vertex Shader ---
precision highp float;
#define TANGRAM_EPSILON 0.00001
#define TANGRAM_LAYER_DELTA 0.00006103515625
#define TANGRAM_TILE_SCALE vec3(4096., 4096., u_meters_per_pixel * 256.)
#define TANGRAM_HEIGHT_SCALE 16.0
#define TANGRAM_ALPHA_TEST 0.1
#define TANGRAM_WORLD_POSITION_WRAP 100000.0
#define TANGRAM_BLEND_TRANSLUCENT
#define TANGRAM_MATERIAL_AMBIENT
#define TANGRAM_MATERIAL_DIFFUSE
#define TANGRAM_LIGHTING_FRAGMENT
#define TANGRAM_LAYER_ORDER
#define TANGRAM_CROP_BY_TILE
#define TANGRAM_BLOCK_CAMERA
#define TANGRAM_BLOCK_GLOBAL
#define TANGRAM_BLOCK_SETUP
#define TANGRAM_BLOCK_UTILS
#define TANGRAM_BLOCK_LIGHTING
#define TANGRAM_BLOCK_MATERIAL
#define TANGRAM_VERTEX_SHADER
uniform vec2 u_resolution;uniform vec4 u_tile_origin;uniform float u_tile_proxy_depth;uniform float u_meters_per_pixel;uniform float u_device_pixel_ratio;uniform sampler2D u_uniforms;uniform mat4 u_model;uniform mat4 u_modelView;uniform mat3 u_normalMatrix;uniform mat3 u_inverseNormalMatrix;uniform vec3 u_map_position;uniform float u_antialias;uniform vec2 u_linecaps;uniform float u_linejoin;uniform float u_miter_limit;uniform float u_dash_index;uniform vec2 u_dash_caps;uniform float u_dash_phase;uniform float u_dash_period;attribute vec4 a_position;attribute vec4 a_color;attribute float a_width;
#ifdef TANGRAM_DEBUG_TRIANGLES
attribute vec3 a_barycentric;
#endif
attribute vec2 a_normal;attribute float a_length;attribute vec2 a_segment;attribute vec2 a_texcoord;attribute vec2 a_angles;attribute vec4 a_tangents;attribute float a_closed;varying vec4 v_position;varying vec4 v_local_space_position;varying vec3 v_normal;varying vec4 v_color;varying vec4 v_world_position;
#ifdef TANGRAM_DEBUG_TRIANGLES
varying vec3 v_barycentric;
#endif
varying vec2 v_segment;varying vec2 v_angles;varying vec2 v_texcoord;varying vec2 v_distances;varying vec2 v_miter;varying float v_length;varying float v_linewidth_and_closed;varying float v_joinIndicator;
#define TANGRAM_NORMAL vec3(0., 0., 1.)
#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING
varying vec4 v_modelpos_base_zoom;
#endif
#if defined(TANGRAM_LIGHTING_VERTEX)
varying vec4 v_lighting;
#endif
#ifndef TANGRAM_HEIGHT_SCALE
float TANGRAM_HEIGHT_SCALE=16.0;
#endif
#define UNPACK_SCALING(x) (x / 1024.)
// tangram-block-start: ShaderProgram, camera, 0
uniform mat4 u_projection;
uniform vec3 u_eye;
uniform vec2 u_center_offset;
void cameraProjection (inout vec4 position) {
position = u_projection * position;
}
// tangram-block-end: ShaderProgram, camera, 0
// tangram-block-start: Material, material, 0
/*Defines globals:materiallight_accumulator_**/struct Material{
#ifdef TANGRAM_MATERIAL_EMISSION
vec4 emission;
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE
vec3 emissionScale;
#endif
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT
vec4 ambient;
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE
vec3 ambientScale;
#endif
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE
vec4 diffuse;
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE
vec3 diffuseScale;
#endif
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR
vec4 specular;float shininess;
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE
vec3 specularScale;
#endif
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE
vec3 normalScale;float normalAmount;
#endif
};uniform Material u_material;Material material;
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE
uniform sampler2D u_material_emission_texture;
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE
uniform sampler2D u_material_ambient_texture;
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE
uniform sampler2D u_material_diffuse_texture;
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE
uniform sampler2D u_material_specular_texture;
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE
uniform sampler2D u_material_normal_texture;
#endif
vec4 light_accumulator_ambient=vec4(vec3(0.0),1.);vec4 light_accumulator_diffuse=vec4(vec3(0.0),1.);
#ifdef TANGRAM_MATERIAL_SPECULAR
vec4 light_accumulator_specular=vec4(vec3(0.0),1.);
#endif
#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP
vec4 getSphereMap(in sampler2D _tex,in vec3 _eyeToPoint,in vec3 _normal,in vec2 _skew){vec3 eye=normalize(_eyeToPoint);eye.xy-=_skew;eye=normalize(eye);vec3 r=reflect(eye,_normal);r.z+=1.0;float m=2.*length(r);vec2 uv=r.xy/m+.5;return texture2D(_tex,uv);}
#endif
#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR
vec3 getTriPlanarBlend(in vec3 _normal){vec3 blending=abs(_normal);blending=normalize(max(blending,0.00001));float b=(blending.x+blending.y+blending.z);return blending/b;}vec4 getTriPlanar(in sampler2D _tex,in vec3 _pos,in vec3 _normal,in vec3 _scale){vec3 blending=getTriPlanarBlend(_normal);vec4 xaxis=texture2D(_tex,fract(_pos.yz*_scale.x));vec4 yaxis=texture2D(_tex,fract(_pos.xz*_scale.y));vec4 zaxis=texture2D(_tex,fract(_pos.xy*_scale.z));return xaxis*blending.x+yaxis*blending.y+zaxis*blending.z;}
#endif
#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR
vec4 getPlanar(in sampler2D _tex,in vec3 _pos,in vec2 _scale){return texture2D(_tex,fract(_pos.xy*_scale.x));}
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE
void calculateNormal(inout vec3 _normal){
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV
_normal+=texture2D(u_material_normal_texture,fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR
vec3 normalTex=getPlanar(u_material_normal_texture,v_world_position.xyz,material.normalScale.xy).rgb*2.0-1.0;_normal+=normalTex;
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR
vec3 normalTex=getTriPlanar(u_material_normal_texture,v_world_position.xyz,_normal,material.normalScale).rgb*2.0-1.0;_normal+=normalTex;
#endif
_normal=normalize(_normal);}
#endif
void calculateMaterial(in vec3 _eyeToPoint,inout vec3 _normal){
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV
material.emission*=texture2D(u_material_emission_texture,v_texcoord);
#endif
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR
material.emission*=getPlanar(u_material_emission_texture,v_world_position.xyz,material.emissionScale.xy);
#endif
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR
material.emission*=getTriPlanar(u_material_emission_texture,v_world_position.xyz,_normal,material.emissionScale);
#endif
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP
material.emission*=getSphereMap(u_material_emission_texture,_eyeToPoint,_normal,u_center_offset);
#endif
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV
material.ambient*=texture2D(u_material_ambient_texture,v_texcoord);
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR
material.ambient*=getPlanar(u_material_ambient_texture,v_world_position.xyz,material.ambientScale.xy);
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR
material.ambient*=getTriPlanar(u_material_ambient_texture,v_world_position.xyz,_normal,material.ambientScale);
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP
material.ambient*=getSphereMap(u_material_ambient_texture,_eyeToPoint,_normal,u_center_offset);
#endif
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV
material.diffuse*=texture2D(u_material_diffuse_texture,v_texcoord);
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR
material.diffuse*=getPlanar(u_material_diffuse_texture,v_world_position.xyz,material.diffuseScale.xy);
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR
material.diffuse*=getTriPlanar(u_material_diffuse_texture,v_world_position.xyz,_normal,material.diffuseScale);
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP
material.diffuse*=getSphereMap(u_material_diffuse_texture,_eyeToPoint,_normal,u_center_offset);
#endif
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV
material.specular*=texture2D(u_material_specular_texture,v_texcoord);
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR
material.specular*=getPlanar(u_material_specular_texture,v_world_position.xyz,material.specularScale.xy);
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR
material.specular*=getTriPlanar(u_material_specular_texture,v_world_position.xyz,_normal,material.specularScale);
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP
material.specular*=getSphereMap(u_material_specular_texture,_eyeToPoint,_normal,u_center_offset);
#endif
#endif
}
// tangram-block-end: Material, material, 0
// tangram-block-start: ShaderProgram, lighting, 0
/*Expected globals:materiallight_accumulator_**/struct DirectionalLight{vec3 ambient;vec3 diffuse;vec3 specular;vec3 direction;};void calculateLight(in DirectionalLight _light,in vec3 _eyeToPoint,in vec3 _normal){light_accumulator_ambient.rgb+=_light.ambient;float nDotVP=clamp(dot(_normal,-_light.direction),0.0,1.0);
#ifdef TANGRAM_MATERIAL_DIFFUSE
light_accumulator_diffuse.rgb+=_light.diffuse*nDotVP;
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR
float pf=0.0;if(nDotVP>0.0){vec3 reflectVector=reflect(_light.direction,_normal);float eyeDotR=max(dot(normalize(_eyeToPoint),reflectVector),0.0);pf=pow(eyeDotR,material.shininess);}light_accumulator_specular.rgb+=_light.specular*pf;
#endif
}
// tangram-block-end: ShaderProgram, lighting, 0
// tangram-block-start: ShaderProgram, lighting, 1
uniform DirectionalLight u_default_light;
DirectionalLight default_light;
// tangram-block-end: ShaderProgram, lighting, 1
// tangram-block-start: ShaderProgram, lighting, 2
vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {
// Do initial material calculations over normal, emission, ambient, diffuse and specular values
calculateMaterial(_eyeToPoint,_normal);
// Un roll the loop of individual ligths to calculate
calculateLight(default_light, _eyeToPoint, _normal);
// Final light intensity calculation
vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha
#ifdef TANGRAM_MATERIAL_EMISSION
color.rgb = material.emission.rgb;
color.a *= material.emission.a;
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT
color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;
color.a *= material.ambient.a;
#else
#ifdef TANGRAM_MATERIAL_DIFFUSE
color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;
#endif
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE
color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;
color.a *= material.diffuse.a;
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR
color.rgb += light_accumulator_specular.rgb * material.specular.rgb;
color.a *= material.specular.a;
#endif
// Clamp final color
color = clamp(color, 0.0, 1.0);
return color;
}
// tangram-block-end: ShaderProgram, lighting, 2
// tangram-block-start: ShaderProgram, global, 0
#ifdef TANGRAM_VERTEX_SHADER
vec4 modelPosition(){return vec4(a_position.xyz/TANGRAM_TILE_SCALE*exp2(u_tile_origin.z-u_tile_origin.w),1.)+vec4(0.,1.,0.,0.);}vec4 modelPositionBaseZoom(){return vec4(a_position.xyz/TANGRAM_TILE_SCALE,1.)+vec4(0.,1.,0.,0.);}
#endif
vec4 worldPosition(){return v_world_position;}
#ifdef TANGRAM_VERTEX_SHADER
vec4 wrapWorldPosition(vec4 world_position){
#if defined(TANGRAM_WORLD_POSITION_WRAP)
vec2 anchor=u_tile_origin.xy-mod(u_tile_origin.xy,TANGRAM_WORLD_POSITION_WRAP);world_position.xy-=anchor;
#endif
return world_position;}
#endif
#if defined(TANGRAM_VERTEX_SHADER)
vec3 worldNormal(){return TANGRAM_NORMAL;}
#elif defined(TANGRAM_FRAGMENT_SHADER)
vec3 worldNormal(){return u_inverseNormalMatrix*TANGRAM_NORMAL;}
#endif
// tangram-block-end: ShaderProgram, global, 0
// tangram-block-start: ShaderProgram, global, 1
void applyLayerOrder(float layer,inout vec4 position){position.z-=layer*TANGRAM_LAYER_DELTA*position.w;}
// tangram-block-end: ShaderProgram, global, 1
// tangram-block-start: ShaderProgram, global, 2
#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)
attribute vec4 a_selection_color;varying vec4 v_selection_color;uniform vec4 u_selection_discard0;uniform vec4 u_selection_discard1;uniform vec4 u_selection_discard2;uniform vec4 u_selection_discard3;uniform vec4 u_selection_discard4;uniform vec4 u_selection_discard5;uniform vec4 u_selection_discard6;uniform vec4 u_selection_discard7;uniform vec4 u_selection_discard8;uniform vec4 u_selection_discard9;
#endif
// tangram-block-end: ShaderProgram, global, 2
// tangram-block-start: ShaderProgram, global, 3
uniform float u_view_pan_snap_timer;void snapToPixelGrid(inout vec4 position){vec2 position_fract=fract((((position.xy/position.w)+1.)*.5)*u_resolution);vec2 position_snap=position.xy+((step(0.5,position_fract)-position_fract)*position.w*2./u_resolution);
#ifdef TANGRAM_VIEW_PAN_SNAP_RATE
position.xy=mix(position.xy,position_snap,clamp(u_view_pan_snap_timer*TANGRAM_VIEW_PAN_SNAP_RATE,0.,1.));
#else
position.xy=position_snap;
#endif
}
// tangram-block-end: ShaderProgram, global, 3
const float PI=3.141592653589793;const float THETA=15.0*PI/180.0;float cross(in vec2 v1,in vec2 v2){return v1.x*v2.y-v1.y*v2.x;}float signed_distance(in vec2 v1,in vec2 v2,in vec2 v3){return cross(v2-v1,v1-v3)/length(v2-v1);}void rotate(in vec2 v,in float angle,out vec2 result){float cosine=cos(angle);float sine=sin(angle);result=vec2(cosine*v.x-sine*v.y,sine*v.x+cosine*v.y);}void main(){
// tangram-block-start: ShaderProgram, setup, 0
#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)
if(a_selection_color.rgb==vec3(0.)||a_selection_color==u_selection_discard0||a_selection_color==u_selection_discard1||a_selection_color==u_selection_discard2||a_selection_color==u_selection_discard3||a_selection_color==u_selection_discard4||a_selection_color==u_selection_discard5||a_selection_color==u_selection_discard6||a_selection_color==u_selection_discard7||a_selection_color==u_selection_discard8||a_selection_color==u_selection_discard9){gl_Position=vec4(0.,0.,0.,1.);return;}v_selection_color=a_selection_color;
#endif
// tangram-block-end: ShaderProgram, setup, 0
// tangram-block-start: ShaderProgram, setup, 1
default_light = u_default_light;
// tangram-block-end: ShaderProgram, setup, 1
// tangram-block-start: Material, setup, 0
material = u_material;
// tangram-block-end: Material, setup, 0
#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING
v_modelpos_base_zoom=modelPositionBaseZoom();
#endif
float linewidth=a_width*2.0;v_angles=a_angles;v_segment=a_segment;v_color=a_color;v_length=a_length;v_texcoord=a_texcoord;
#ifdef TANGRAM_DEBUG_TRIANGLES
v_barycentric=a_barycentric;
#endif
v_color.a=min(linewidth,v_color.a);linewidth=max(linewidth,1.0);linewidth/=exp2(u_map_position.z-u_tile_origin.w);v_linewidth_and_closed=linewidth*(a_closed>0.0 ?-1.0 : 1.0);if(v_color.a<=0.0){gl_Position=vec4(0.0,0.0,0.0,1.0);return;}float width=ceil(1.25*u_antialias+linewidth)/2.0;vec2 t1=normalize(a_tangents.xy);vec2 t2=normalize(a_tangents.zw);float u=a_texcoord.x;u*=-1.0;float v=a_texcoord.y;vec4 position=vec4(a_position.xy,a_position.z/TANGRAM_HEIGHT_SCALE,1.0);if(t1!=t2){float angle=a_texcoord.x==1.0 ? a_angles.x : a_angles.y;vec2 t=normalize(t1+t2);vec2 o=vec2(+t.y,-t.x);float segmentLength=a_segment.y-a_segment.x;float magnitude=width/cos(angle/2.0);float sqMagnitude=magnitude*magnitude;float seg1SqMagnitude=dot(a_tangents.xy,a_tangents.xy);float seg2SqMagnitude=dot(a_tangents.zw,a_tangents.zw);if((abs(magnitude)>linewidth)&&(sqMagnitude>=min(seg1SqMagnitude,seg2SqMagnitude))){if(u==1.0){o=vec2(-t2.y,+t2.x);}else{o=vec2(-t1.y,+t1.x);}magnitude=width;angle=0.0;v_angles.x=0.0;v_angles.y=0.0;}if(u_dash_index>0.0){if((abs(angle)>THETA)){position.xy+=v*width*o/cos(angle/2.0);float s=sign(angle);if(angle<0.0){if(u==+1.0){u=v_segment.y+v*width*tan(angle/2.0);if(v==1.0){position.xy-=2.0*width*t1/sin(angle);u-=2.0*width/sin(angle);}}else{u=v_segment.x-v*width*tan(angle/2.0);if(v==1.0){position.xy+=2.0*width*t2/sin(angle);u+=2.0*width/sin(angle);}}}else{if(u==+1.0){u=v_segment.y+v*width*tan(angle/2.0);if(v==-1.0){position.xy+=2.0*width*t1/sin(angle);u+=2.0*width/sin(angle);}}else{u=v_segment.x-v*width*tan(angle/2.0);if(v==-1.0){position.xy-=2.0*width*t2/sin(angle);u-=2.0*width/sin(angle);}}}}else{position.xy+=v*width*o/cos(angle/2.0);if(u==+1.0){u=v_segment.y;}else{u=v_segment.x;}}}else{position.xy+=v*o*magnitude;if(u==+1.0){u=v_segment.y+v*width*tan(angle/2.0);}else{u=v_segment.x-v*width*tan(angle/2.0);}}v_joinIndicator=(segmentLength+v*width*tan(angle/2.0))/segmentLength;}else{v_joinIndicator=-1.0;vec2 o=vec2(+t1.y,-t1.x);position.xy+=v*width*o;if(u==-1.0){u=v_segment.x-width;position.xy-=width*t1;}else{u=v_segment.y+width;position.xy+=width*t2;}}vec2 t;vec2 curr=a_position.xy;if(a_texcoord.x>=0.0){vec2 next=curr+t2*(v_segment.y-v_segment.x);rotate(t1,+a_angles.x/2.0,t);v_miter.x=signed_distance(curr,curr+t,position.xy);rotate(t2,+a_angles.y/2.0,t);v_miter.y=signed_distance(next,next+t,position.xy);}else{vec2 prev=curr-t1*(v_segment.y-v_segment.x);rotate(t1,-a_angles.x/2.0,t);v_miter.x=signed_distance(prev,prev+t,position.xy);rotate(t2,-a_angles.y/2.0,t);v_miter.y=signed_distance(curr,curr+t,position.xy);}v_distances=vec2(u,v*width);v_world_position=wrapWorldPosition(u_model*position);v_local_space_position=position;position=u_modelView*position;
v_position=position;v_normal=normalize(u_normalMatrix*TANGRAM_NORMAL);
#if defined(TANGRAM_LIGHTING_VERTEX)
vec3 normal=v_normal;
v_lighting=calculateLighting(position.xyz-u_eye,normal,vec4(1.));
#endif
cameraProjection(position);
#ifdef TANGRAM_LAYER_ORDER
applyLayerOrder(a_position.w+u_tile_proxy_depth+1.,position);
#endif
gl_Position=position;}
--- Fragment Shader ---
precision highp float;
#define TANGRAM_EPSILON 0.00001
#define TANGRAM_LAYER_DELTA 0.00006103515625
#define TANGRAM_TILE_SCALE vec3(4096., 4096., u_meters_per_pixel * 256.)
#define TANGRAM_HEIGHT_SCALE 16.0
#define TANGRAM_ALPHA_TEST 0.1
#define TANGRAM_WORLD_POSITION_WRAP 100000.0
#define TANGRAM_BLEND_TRANSLUCENT
#define TANGRAM_MATERIAL_AMBIENT
#define TANGRAM_MATERIAL_DIFFUSE
#define TANGRAM_LIGHTING_FRAGMENT
#define TANGRAM_LAYER_ORDER
#define TANGRAM_CROP_BY_TILE
#define TANGRAM_BLOCK_CAMERA
#define TANGRAM_BLOCK_GLOBAL
#define TANGRAM_BLOCK_SETUP
#define TANGRAM_BLOCK_UTILS
#define TANGRAM_BLOCK_LIGHTING
#define TANGRAM_BLOCK_MATERIAL
#define TANGRAM_FRAGMENT_SHADER
uniform vec2 u_resolution;uniform vec4 u_tile_origin;uniform float u_meters_per_pixel;uniform float u_device_pixel_ratio;uniform mat3 u_normalMatrix;uniform mat3 u_inverseNormalMatrix;uniform sampler2D u_dash_atlas;uniform float u_antialias;uniform vec2 u_linecaps;uniform float u_linejoin;uniform float u_miter_limit;uniform float u_dash_phase;uniform float u_dash_period;uniform float u_dash_index;uniform vec2 u_dash_caps;varying vec4 v_position;varying vec4 v_local_space_position;varying vec3 v_normal;varying vec4 v_color;varying vec4 v_world_position;
#ifdef TANGRAM_DEBUG_TRIANGLES
varying vec3 v_barycentric;
#endif
varying vec2 v_segment;varying vec2 v_angles;varying vec2 v_texcoord;varying vec2 v_distances;varying vec2 v_miter;varying float v_length;varying float v_linewidth_and_closed;varying float v_joinIndicator;
#define TANGRAM_NORMAL v_normal
#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING
varying vec4 v_modelpos_base_zoom;
#endif
#if defined(TANGRAM_LIGHTING_VERTEX)
varying vec4 v_lighting;
#endif
// tangram-block-start: ShaderProgram, camera, 0
uniform mat4 u_projection;
uniform vec3 u_eye;
uniform vec2 u_center_offset;
void cameraProjection (inout vec4 position) {
position = u_projection * position;
}
// tangram-block-end: ShaderProgram, camera, 0
// tangram-block-start: Material, material, 0
/*Defines globals:materiallight_accumulator_**/struct Material{
#ifdef TANGRAM_MATERIAL_EMISSION
vec4 emission;
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE
vec3 emissionScale;
#endif
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT
vec4 ambient;
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE
vec3 ambientScale;
#endif
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE
vec4 diffuse;
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE
vec3 diffuseScale;
#endif
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR
vec4 specular;float shininess;
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE
vec3 specularScale;
#endif
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE
vec3 normalScale;float normalAmount;
#endif
};uniform Material u_material;Material material;
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE
uniform sampler2D u_material_emission_texture;
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE
uniform sampler2D u_material_ambient_texture;
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE
uniform sampler2D u_material_diffuse_texture;
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE
uniform sampler2D u_material_specular_texture;
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE
uniform sampler2D u_material_normal_texture;
#endif
vec4 light_accumulator_ambient=vec4(vec3(0.0),1.);vec4 light_accumulator_diffuse=vec4(vec3(0.0),1.);
#ifdef TANGRAM_MATERIAL_SPECULAR
vec4 light_accumulator_specular=vec4(vec3(0.0),1.);
#endif
#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP
vec4 getSphereMap(in sampler2D _tex,in vec3 _eyeToPoint,in vec3 _normal,in vec2 _skew){vec3 eye=normalize(_eyeToPoint);eye.xy-=_skew;eye=normalize(eye);vec3 r=reflect(eye,_normal);r.z+=1.0;float m=2.*length(r);vec2 uv=r.xy/m+.5;return texture2D(_tex,uv);}
#endif
#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR
vec3 getTriPlanarBlend(in vec3 _normal){vec3 blending=abs(_normal);blending=normalize(max(blending,0.00001));float b=(blending.x+blending.y+blending.z);return blending/b;}vec4 getTriPlanar(in sampler2D _tex,in vec3 _pos,in vec3 _normal,in vec3 _scale){vec3 blending=getTriPlanarBlend(_normal);vec4 xaxis=texture2D(_tex,fract(_pos.yz*_scale.x));vec4 yaxis=texture2D(_tex,fract(_pos.xz*_scale.y));vec4 zaxis=texture2D(_tex,fract(_pos.xy*_scale.z));return xaxis*blending.x+yaxis*blending.y+zaxis*blending.z;}
#endif
#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR
vec4 getPlanar(in sampler2D _tex,in vec3 _pos,in vec2 _scale){return texture2D(_tex,fract(_pos.xy*_scale.x));}
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE
void calculateNormal(inout vec3 _normal){
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV
_normal+=texture2D(u_material_normal_texture,fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR
vec3 normalTex=getPlanar(u_material_normal_texture,v_world_position.xyz,material.normalScale.xy).rgb*2.0-1.0;_normal+=normalTex;
#endif
#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR
vec3 normalTex=getTriPlanar(u_material_normal_texture,v_world_position.xyz,_normal,material.normalScale).rgb*2.0-1.0;_normal+=normalTex;
#endif
_normal=normalize(_normal);}
#endif
void calculateMaterial(in vec3 _eyeToPoint,inout vec3 _normal){
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV
material.emission*=texture2D(u_material_emission_texture,v_texcoord);
#endif
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR
material.emission*=getPlanar(u_material_emission_texture,v_world_position.xyz,material.emissionScale.xy);
#endif
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR
material.emission*=getTriPlanar(u_material_emission_texture,v_world_position.xyz,_normal,material.emissionScale);
#endif
#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP
material.emission*=getSphereMap(u_material_emission_texture,_eyeToPoint,_normal,u_center_offset);
#endif
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV
material.ambient*=texture2D(u_material_ambient_texture,v_texcoord);
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR
material.ambient*=getPlanar(u_material_ambient_texture,v_world_position.xyz,material.ambientScale.xy);
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR
material.ambient*=getTriPlanar(u_material_ambient_texture,v_world_position.xyz,_normal,material.ambientScale);
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP
material.ambient*=getSphereMap(u_material_ambient_texture,_eyeToPoint,_normal,u_center_offset);
#endif
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV
material.diffuse*=texture2D(u_material_diffuse_texture,v_texcoord);
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR
material.diffuse*=getPlanar(u_material_diffuse_texture,v_world_position.xyz,material.diffuseScale.xy);
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR
material.diffuse*=getTriPlanar(u_material_diffuse_texture,v_world_position.xyz,_normal,material.diffuseScale);
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP
material.diffuse*=getSphereMap(u_material_diffuse_texture,_eyeToPoint,_normal,u_center_offset);
#endif
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV
material.specular*=texture2D(u_material_specular_texture,v_texcoord);
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR
material.specular*=getPlanar(u_material_specular_texture,v_world_position.xyz,material.specularScale.xy);
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR
material.specular*=getTriPlanar(u_material_specular_texture,v_world_position.xyz,_normal,material.specularScale);
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP
material.specular*=getSphereMap(u_material_specular_texture,_eyeToPoint,_normal,u_center_offset);
#endif
#endif
}
// tangram-block-end: Material, material, 0
// tangram-block-start: ShaderProgram, lighting, 0
/*Expected globals:materiallight_accumulator_**/struct DirectionalLight{vec3 ambient;vec3 diffuse;vec3 specular;vec3 direction;};void calculateLight(in DirectionalLight _light,in vec3 _eyeToPoint,in vec3 _normal){light_accumulator_ambient.rgb+=_light.ambient;float nDotVP=clamp(dot(_normal,-_light.direction),0.0,1.0);
#ifdef TANGRAM_MATERIAL_DIFFUSE
light_accumulator_diffuse.rgb+=_light.diffuse*nDotVP;
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR
float pf=0.0;if(nDotVP>0.0){vec3 reflectVector=reflect(_light.direction,_normal);float eyeDotR=max(dot(normalize(_eyeToPoint),reflectVector),0.0);pf=pow(eyeDotR,material.shininess);}light_accumulator_specular.rgb+=_light.specular*pf;
#endif
}
// tangram-block-end: ShaderProgram, lighting, 0
// tangram-block-start: ShaderProgram, lighting, 1
uniform DirectionalLight u_default_light;
DirectionalLight default_light;
// tangram-block-end: ShaderProgram, lighting, 1
// tangram-block-start: ShaderProgram, lighting, 2
vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {
// Do initial material calculations over normal, emission, ambient, diffuse and specular values
calculateMaterial(_eyeToPoint,_normal);
// Un roll the loop of individual ligths to calculate
calculateLight(default_light, _eyeToPoint, _normal);
// Final light intensity calculation
vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha
#ifdef TANGRAM_MATERIAL_EMISSION
color.rgb = material.emission.rgb;
color.a *= material.emission.a;
#endif
#ifdef TANGRAM_MATERIAL_AMBIENT
color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;
color.a *= material.ambient.a;
#else
#ifdef TANGRAM_MATERIAL_DIFFUSE
color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;
#endif
#endif
#ifdef TANGRAM_MATERIAL_DIFFUSE
color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;
color.a *= material.diffuse.a;
#endif
#ifdef TANGRAM_MATERIAL_SPECULAR
color.rgb += light_accumulator_specular.rgb * material.specular.rgb;
color.a *= material.specular.a;
#endif
// Clamp final color
color = clamp(color, 0.0, 1.0);
return color;
}
// tangram-block-end: ShaderProgram, lighting, 2
// tangram-block-start: ShaderProgram, global, 0
#ifdef TANGRAM_VERTEX_SHADER
vec4 modelPosition(){return vec4(a_position.xyz/TANGRAM_TILE_SCALE*exp2(u_tile_origin.z-u_tile_origin.w),1.)+vec4(0.,1.,0.,0.);}vec4 modelPositionBaseZoom(){return vec4(a_position.xyz/TANGRAM_TILE_SCALE,1.)+vec4(0.,1.,0.,0.);}
#endif
vec4 worldPosition(){return v_world_position;}
#ifdef TANGRAM_VERTEX_SHADER
vec4 wrapWorldPosition(vec4 world_position){
#if defined(TANGRAM_WORLD_POSITION_WRAP)
vec2 anchor=u_tile_origin.xy-mod(u_tile_origin.xy,TANGRAM_WORLD_POSITION_WRAP);world_position.xy-=anchor;
#endif
return world_position;}
#endif
#if defined(TANGRAM_VERTEX_SHADER)
vec3 worldNormal(){return TANGRAM_NORMAL;}
#elif defined(TANGRAM_FRAGMENT_SHADER)
vec3 worldNormal(){return u_inverseNormalMatrix*TANGRAM_NORMAL;}
#endif
// tangram-block-end: ShaderProgram, global, 0
// tangram-block-start: ShaderProgram, global, 1
void applyLayerOrder(float layer,inout vec4 position){position.z-=layer*TANGRAM_LAYER_DELTA*position.w;}
// tangram-block-end: ShaderProgram, global, 1
// tangram-block-start: ShaderProgram, global, 2
#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)
attribute vec4 a_selection_color;varying vec4 v_selection_color;uniform vec4 u_selection_discard0;uniform vec4 u_selection_discard1;uniform vec4 u_selection_discard2;uniform vec4 u_selection_discard3;uniform vec4 u_selection_discard4;uniform vec4 u_selection_discard5;uniform vec4 u_selection_discard6;uniform vec4 u_selection_discard7;uniform vec4 u_selection_discard8;uniform vec4 u_selection_discard9;
#endif
// tangram-block-end: ShaderProgram, global, 2
// tangram-block-start: ShaderProgram, global, 3
uniform float u_view_pan_snap_timer;void snapToPixelGrid(inout vec4 position){vec2 position_fract=fract((((position.xy/position.w)+1.)*.5)*u_resolution);vec2 position_snap=position.xy+((step(0.5,position_fract)-position_fract)*position.w*2./u_resolution);
#ifdef TANGRAM_VIEW_PAN_SNAP_RATE
position.xy=mix(position.xy,position_snap,clamp(u_view_pan_snap_timer*TANGRAM_VIEW_PAN_SNAP_RATE,0.,1.));
#else
position.xy=position_snap;
#endif
}
// tangram-block-end: ShaderProgram, global, 3
// tangram-block-start: ShaderProgram, utils, 0
#ifndef UTILS
#define UTILS
bool isLocalSpacePixelOutsideTile(vec4 pixel_local_space_position,float tile_scale){return pixel_local_space_position.x<0.||pixel_local_space_position.x>=tile_scale||pixel_local_space_position.y>0.||pixel_local_space_position.y<=-tile_scale;}
#endif
// tangram-block-end: ShaderProgram, utils, 0
const float PI=3.141592653589793;const float HALF_PI=PI/2.0;const float THETA=15.0*PI/180.0;/***Compute distance to cap.*@param{int}type The Type of the cap(see CAP_TYPE in pattern_lines)*@param{float}dx The distance of the pixel from the beginning of the line(not straight distance,but along the legs)*@param{float}dy The distance of the pixel from the midline(see v_distances in vertex shader,aka ±1*half_line_width)*@param{float}aa_radius The distance from the mid-line from where antialiasing starts.*For example for a linewidth 10px width and 2px filter radius it is 10px/2-2px=3px.*@return{float}distance*/float cap(int type,float dx,float dy,float aa_radius){float dist=0.0;dx=abs(dx);dy=abs(dy);if(type==1)dist=sqrt(dx*dx+dy*dy);else if(type==3)dist=(dx+abs(dy));else if(type==2)dist=max(abs(dy),(aa_radius+dx-abs(dy)));else if(type==4)dist=max(dx,dy);else if(type==5)dist=max(dx+aa_radius,dy);return dist;}/***Compute distance to join.*@param{int}type The type of the join(see JOIN_TYPE in pattern_lines)*@param{vec2}segment Interpolated a_segment attribute from the vertex shader*@param{vec2}texcoord Pair of u/v coordinates to identify the 4 different extruded points of the segment.*@param{vec2}distances 2 component vector where:*x is the distance of the pixel from the beginning of the line(along the legs)*y is the distance of the pixel from the midline(see v_distances in vertex shader,±1*half_line_width)*@param{vec2}miter Miter point coordiante*@param{float}miter_limit The miter limit*@param{float}linewidth The width of the line*@return{float}computed distance*/float join(in int type,in vec2 segment,in vec2 texcoord,in vec2 distances,in vec2 miter,in float miter_limit,in float linewidth){float dx=distances.x;float result=abs(distances.y);if((dx<segment.x)||(dx>segment.y)){if(type==1){float s=dx<segment.x ? segment.x : segment.y;result=max(result,length(distances-vec2(s,0.0)));}else{float m=abs(texcoord.x>=0.0 ? miter.x : miter.y);if(type==2){result=max(result,m);}else if(type==0){result=max(result,m-miter_limit*linewidth/2.0);}}}return result;}void main(void){
// tangram-block-start: ShaderProgram, setup, 0
#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)
if(a_selection_color.rgb==vec3(0.)||a_selection_color==u_selection_discard0||a_selection_color==u_selection_discard1||a_selection_color==u_selection_discard2||a_selection_color==u_selection_discard3||a_selection_color==u_selection_discard4||a_selection_color==u_selection_discard5||a_selection_color==u_selection_discard6||a_selection_color==u_selection_discard7||a_selection_color==u_selection_discard8||a_selection_color==u_selection_discard9){gl_Position=vec4(0.,0.,0.,1.);return;}v_selection_color=a_selection_color;
#endif
// tangram-block-end: ShaderProgram, setup, 0
// tangram-block-start: ShaderProgram, setup, 1
default_light = u_default_light;
// tangram-block-end: ShaderProgram, setup, 1
// tangram-block-start: Material, setup, 0
material = u_material;
// tangram-block-end: Material, setup, 0
vec4 color=v_color;vec3 normal=TANGRAM_NORMAL;
#ifdef TANGRAM_CROP_BY_TILE
if(isLocalSpacePixelOutsideTile(v_local_space_position,TANGRAM_TILE_SCALE.x)){discard;}
#endif
#if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)
calculateNormal(normal);
#endif
#if !defined(TANGRAM_LIGHTING_VERTEX)
#endif
#if defined(TANGRAM_LIGHTING_FRAGMENT)
color=calculateLighting(v_position.xyz-u_eye,normal,color);
#elif defined(TANGRAM_LIGHTING_VERTEX)
color*=v_lighting;
#endif
if(v_color.a<=0.0){discard;}bool solid=(u_dash_index==0.0);bool closed=v_linewidth_and_closed<0.0;float dx=v_distances.x;float dy=v_distances.y;float linewidth=abs(v_linewidth_and_closed);float aa_radius=linewidth/2.0-u_antialias;float dist=0.0;vec2 linecaps=u_linecaps;vec2 dash_caps=u_dash_caps;float line_start=0.0;float line_stop=v_length;if(solid){dist=abs(dy);bool potentialCap=!closed&&v_joinIndicator<0.0;if(potentialCap&&dx<line_start){dist=cap(int(u_linecaps.x),abs(dx),abs(dy),aa_radius);}else if(potentialCap&&dx>line_stop){dist=cap(int(u_linecaps.y),abs(dx)-line_stop,abs(dy),aa_radius);}else{dist=join(int(u_linejoin),v_segment,v_texcoord,v_distances,v_miter,u_miter_limit,linewidth);}}else{float segment_start=v_segment.x;float segment_stop=v_segment.y;float segment_center=(segment_start+segment_stop)/2.0;float freq=u_dash_period*linewidth;float dash_phase=u_dash_phase-1e-5;float u=mod(dx+dash_phase*linewidth,freq);vec4 tex=texture2D(u_dash_atlas,vec2(u/freq,u_dash_index));float dash_center=float(tex.x)*255.0*linewidth;float dash_type=floor(float(tex.y)*255.0+0.5);float _start=float(tex.z)*255.0*linewidth;float _stop=float(tex.a)*255.0*linewidth;float dash_start=dx-u+_start;float dash_stop=dx-u+_stop;if((dash_stop<segment_start)&&(dash_caps.x!=5.0)){float u=mod(segment_start+dash_phase*linewidth,freq);vec4 tex=texture2D(u_dash_atlas,vec2(u/freq,u_dash_index));dash_center=float(tex.x)*255.0*linewidth;float _start=float(tex.z)*255.0*linewidth;float _stop=float(tex.a)*255.0*linewidth;dash_start=segment_start-u+_start;dash_stop=segment_start-u+_stop;}else if((dash_start>segment_stop)&&(dash_caps.y!=5.0)){float u=mod(segment_stop+dash_phase*linewidth,freq);vec4 tex=texture2D(u_dash_atlas,vec2(u/freq,u_dash_index));dash_center=float(tex.x)*255.0*linewidth;float _start=float(tex.z)*255.0*linewidth;float _stop=float(tex.a)*255.0*linewidth;dash_start=segment_stop-u+_start;dash_stop=segment_stop-u+_stop;}bool discontinuous=((dx<segment_center)&&abs(v_angles.x)>THETA)||((dx>=segment_center)&&abs(v_angles.y)>THETA);float d_join=join(int(u_linejoin),v_segment,v_texcoord,v_distances,v_miter,u_miter_limit,linewidth);if(closed){line_start+=linewidth/2.0;line_stop-=linewidth/2.0;}if(dash_stop<=line_start){discard;}if(dash_start>=line_stop){discard;}if(discontinuous){if((dash_start>segment_stop)){discard;}if((dash_stop<segment_start)){discard;}if(dash_caps.x==1.0){if((u>_stop)&&(dash_stop>segment_stop)&&(abs(v_angles.y)<HALF_PI)){discard;}}if(dash_caps.y==1.0){if((u<_start)&&(dash_start<segment_start)&&(abs(v_angles.x)<HALF_PI)){discard;}}if((dash_caps.x!=1.0)&&(dash_caps.x!=5.0)){if((dash_start<segment_start)&&(abs(v_angles.x)<HALF_PI)){float a=v_angles.x/2.0;float cos_a=cos(a);float sin_a=sin(a);float x=(segment_start-dx)*cos_a-dy*sin_a;float y=(segment_start-dx)*sin_a+dy*cos_a;if(x>0.0){discard;}dash_caps.x=4.0;}}if((dash_caps.y!=1.0)&&(dash_caps.y!=5.0)){if((dash_stop>segment_stop)&&(abs(v_angles.y)<HALF_PI)){float a=v_angles.y/2.0;float cos_a=cos(a);float sin_a=sin(a);float x=(dx-segment_stop)*cos_a-dy*sin_a;float y=(dx-segment_stop)*sin_a+dy*cos_a;if(x>0.0){discard;}dash_caps.y=4.0;}}}if((dx<line_start)&&(dash_start<=line_start)&&(dash_stop>line_start)){dist=cap(int(linecaps.x),dx-line_start,dy,aa_radius);}else if((dx>line_stop)&&(dash_stop>line_stop)&&(dash_start<line_stop)){dist=cap(int(linecaps.y),dx-line_stop,dy,aa_radius);}else if(dash_type==1.0){dist=cap(int(dash_caps.x),abs(dash_center-u),dy,aa_radius);if((dx>line_start)&&(dx<line_stop)){dist=max(dist,d_join);}}else if(dash_type==0.0){dist=abs(dy);}else if(dash_type==2.0){dist=cap(int(dash_caps.y),abs(u-dash_center),dy,aa_radius);if((dx>line_start)&&(dx<line_stop)){dist=max(dist,d_join);}}if((dx>line_start)&&(dx<line_stop)){if((dx<=segment_start)&&(dash_start<=segment_start)&&(dash_stop>=segment_start)){dist=d_join;float angle=HALF_PI+v_angles.x;float f=abs((segment_start-dx)*cos(angle)-dy*sin(angle));dist=max(f,dist);}else if((dx>segment_stop)&&(dash_start<=segment_stop)&&(dash_stop>=segment_stop)){dist=d_join;float angle=HALF_PI+v_angles.y;float f=abs((dx-segment_stop)*cos(angle)-dy*sin(angle));dist=max(f,dist);}else if(dx<(segment_start-linewidth/2.)){discard;}else if(dx>(segment_stop+linewidth/2.)){discard;}}else if(dx<(segment_start-linewidth/2.)){discard;}else if(dx>(segment_stop+linewidth/2.)){discard;}}dist=dist-aa_radius;if(dist>=0.0){if(u_antialias==0.0){discard;}else{color=vec4(color.rgb,exp(-dist*dist)*color.a);}}
#ifdef TANGRAM_DEBUG_TRIANGLES
if(any(lessThan(v_barycentric,vec3(0.0085)))){color=vec4(0.0,1.0,0.0,1.0);}
#endif
gl_FragColor=color;}
at Function.Qo.updateProgram (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:654951)
at t.value (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:647861)
at Object.getProgram (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:690422)
at t.value (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:1025234)
at https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:1024997
at t.value (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:1025131)
at t.value (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:1024071)
at t.value (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:1022496)
at t.value (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:1022078)
at t.value (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:1021380)
at Cl.V (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:175228)
at S.n.ci (https://<PROD_URL>/js/chunk.heremaps.cadf2092.js:1:203958)
at i (https://<PROD_URL>/js/chunk-vendors.d14c51b3.js:31:387261)
Possibly related to https://github.com/heremaps/maps-api-for-javascript-examples/issues/63 ?