diff --git a/bin/style.js b/bin/style.js index 7cc24e4cd..33e25512f 100644 --- a/bin/style.js +++ b/bin/style.js @@ -2,10 +2,6 @@ module.exports = { "buckets": { - // "satellite": { - // "source": "satellite", - // "type": "raster" - // }, "admin_maritime": { "source": "outdoors", "layer": "admin", @@ -820,33 +816,6 @@ module.exports = { "alwaysVisible": true } }, - "constants": { - "land": "rgb(244,239,225)", - "water": "#cdd", - "water_dark": "#185869", - "crop": "#eeeed4", - "grass": "#e7ebd1", - "scrub": "#e0e8cd", - "wood": "#d4e2c6", - "snow": "#f4f8ff", - "rock": "#ddd", - "sand": "#ffd", - "cemetery": "#edf4ed", - "pitch": "#fff", - "park": "#d4e4bc", - "piste": "blue", - "school": "#e8dfe0", - "hospital": "#f8eee0", - "builtup": "#f6faff", - "case": "#fff", - "motorway": "#cda0a0", - "main": "#ddc0b9", - "street": "#fff", - "text": "#666", - "country_text": "#333", - "marine_text": "#a0bdc0", - "water_text": "#185869" - }, "structure": [ { "name": "background", @@ -872,10 +841,6 @@ module.exports = { "name": "landcover_grass", "bucket": "landcover_grass" }, - { - "name": "landcover_crop", - "bucket": "landcover_crop" - }, { "name": "landcover_snow", "bucket": "landcover_snow" @@ -892,6 +857,10 @@ module.exports = { "name": "landuse_grass", "bucket": "landuse_grass" }, + { + "name": "landcover_crop", + "bucket": "landcover_crop" + }, { "name": "landuse_crop", "bucket": "landuse_crop" @@ -1337,6 +1306,62 @@ module.exports = { "bucket": "poi_aerodrome" } ], + "constants": { + "land": "rgb(244,239,225)", + "water": "#cdd", + "water_dark": "#185869", + "crop": "#eeeed4", + "grass": "#e7ebd1", + "scrub": "#e0e8cd", + "wood": "#d4e2c6", + "snow": "#f4f8ff", + "rock": "#ddd", + "sand": "#ffd", + "cemetery": "#edf4ed", + "pitch": "#fff", + "park": "#d4e4bc", + "piste": "blue", + "school": "#e8dfe0", + "hospital": "#f8eee0", + "builtup": "#f6faff", + "case": "#fff", + "motorway": "#cda0a0", + "main": "#ddc0b9", + "street": "#fff", + "text": "#666", + "text_stroke": "rgba(255,255,255,0.8)", + "country_text": "#333", + "marine_text": "#a0bdc0", + "water_text": "#185869", + + "land_night": "#017293", + "water_night": "#103", + "water_dark_night": "#003366", + "crop_night": "#178d96", + "grass_night": "#23948a", + "scrub_night": "#31a186", + "wood_night": "#45b581", + "park_night": "#6ad0a1", + "snow_night": "#5ad9fe", + "rock_night": "#999", + "sand_night": "#437162", + "cemetery_night": "#218c96", + "pitch_night": "rgba(255,255,255,0.2)", + "school_night": "#01536a", + "hospital_night": "#015e7a", + "builtup_night": "#014b60", + + "text_night": "#fff", + "text_stroke_night": "#103", + + "case_night": "#026986", + "street_case_night": "#056585", + "motorway_night": "#eee", + "main_night": "#95ccdb", + "street_night": "#0291b5", + + "contour_night": "#ffff80" + }, "classes": [ { "name": "default", @@ -1667,7 +1692,8 @@ module.exports = { {"z": 14, "val": 4}, {"z": 15, "val": 5.5}, {"z": 16, "val": 9}, - {"z": 17, "val": 10} + {"z": 17, "val": 12}, + {"z": 18, "val": 14} ], "opacity": ["stops", {"z": 9, "val": 0}, @@ -1814,7 +1840,8 @@ module.exports = { {"z": 14, "val": 4}, {"z": 15, "val": 5.5}, {"z": 16, "val": 9}, - {"z": 17, "val": 10} + {"z": 17, "val": 12}, + {"z": 18, "val": 14} ], "opacity": ["stops", {"z": 9, "val": 0}, @@ -2048,7 +2075,8 @@ module.exports = { {"z": 14, "val": 4}, {"z": 15, "val": 5.5}, {"z": 16, "val": 9}, - {"z": 17, "val": 10} + {"z": 17, "val": 12}, + {"z": 18, "val": 14} ], "opacity": ["stops", {"z": 9, "val": 0}, @@ -2230,7 +2258,7 @@ module.exports = { "place_label_city": { "color": "#444", "strokeWidth": 0.4, - "stroke": "rgba(255,255,255,0.8)", + "stroke": "text_stroke", "size": [ "stops", {"z": 3.99, "val": 0}, @@ -2252,7 +2280,7 @@ module.exports = { "place_label_town": { "color": "#716656", "strokeWidth": 0.5, - "stroke": "rgba(255,255,255,0.8)", + "stroke": "text_stroke", "size": [ "stops", {"z": 9, "val": 10}, @@ -2264,7 +2292,7 @@ module.exports = { "place_label_village": { "color": "#635644", "strokeWidth": 0.5, - "stroke": "rgba(255,255,255,0.8)", + "stroke": "text_stroke", "size": [ "stops", {"z": 9, "val": 8}, @@ -2276,7 +2304,7 @@ module.exports = { }, "place_label_other": { "color": "#7d6c55", - "stroke": "rgba(255,255,255,0.8)", + "stroke": "text_stroke", "size": [ "stops", {"z": 0, "val": 10}, @@ -2306,7 +2334,7 @@ module.exports = { "color": "water_dark", "strokeWidth": 0.4, "strokeBlur": 2, - "stroke": "rgba(255,255,255,0.8)" + "stroke": "text_stroke" }, "poi": { "color": "rgba(50,50,50,0.9)", @@ -2322,40 +2350,990 @@ module.exports = { }, "poi_aerodrome": { "antialias": false - }, - // "satellite": { - // "type": "raster", - // "opacity": 0.25 - // } + } } }, { "name": "satellite", "layers": { "background": { - "color": "#017293" - }, - "water": { - "color": "#103", - "stroke": "#003366" - }, - "landcover_crop": { - "color": "#178d96" - }, - "landcover_grass": { - "color": "#23948a" - }, - "landcover_scrub": { - "color": "#31a186" - }, - "landcover_wood": { - "color": "#45b581" + "color": "land_night" }, "admin_maritime_cover": { - "color": "#103" + "color": "water_night", + "width": 5 }, "admin_maritime": { - "color": "#003366" + "color": "water_night", + "width": [ + "stops", + {"z": 6, "val": 1}, + {"z": 8, "val": 2}, + {"z": 12, "val": 3} + ] + }, + "admin_level_2": { + "color": "#88a", + "width": [ + "stops", + {"z": 2, "val": 0.5}, + {"z": 3, "val": 0.7}, + {"z": 4, "val": 0.7}, + {"z": 5, "val": 0.8}, + {"z": 6, "val": 1}, + {"z": 8, "val": 2}, + {"z": 10, "val": 3} + ] + }, + "admin_level_3": { + "color": "#88a", + "dasharray": [ + 60, + 20 + ], + "opacity": [ + "stops", + {"z": 4, "val": 0}, + {"z": 6, "val": 1} + ], + "width": [ + "stops", + {"z": 6, "val": 0.6}, + {"z": 8, "val": 1}, + {"z": 12, "val": 2} + ] + }, + "waterway_other": { + "color": "water_night", + "width": 0.5 + }, + "waterway_river_canal": { + "color": "#87abaf", + "width": [ + "stops", + {"z": 12, "val": 1}, + {"z": 14, "val": 2}, + {"z": 16, "val": 3} + ] + }, + "waterway_stream": { + "color": "#87abaf", + "width": [ + "stops", + {"z": 13, "val": 0.25}, + {"z": 14, "val": 0.5}, + {"z": 16, "val": 1.5}, + {"z": 18, "val": 2} + ] + }, + "landcover_wood": { + "color": "wood_night", + "opacity": 0.8 + }, + "landcover_scrub": { + "color": "scrub_night", + "opacity": 0.8 + }, + "landcover_grass": { + "color": "grass_night", + "opacity": 0.8 + }, + "landcover_crop": { + "color": "crop_night", + "opacity": 0.8 + }, + "landcover_snow": { + "color": "snow_night", + "opacity": 0.8 + }, + "landuse_wood": { + "color": "wood_night", + "opacity": 0.8 + }, + "landuse_scrub": { + "color": "scrub_night", + "opacity": 0.8 + }, + "landuse_grass": { + "color": "grass_night", + "opacity": 0.8 + }, + "landuse_crop": { + "color": "crop_night", + "opacity": 0.8 + }, + "landuse_snow": { + "color": "snow_night", + "opacity": 0.8 + }, + "landuse_rock": { + "color": "rock_night", + "opacity": 0.8 + }, + "landuse_sand": { + "color": "sand_night", + "opacity": 0.8 + }, + "landuse_park": { + "color": "park_night" + }, + "landuse_cemetery": { + "color": "cemetery_night" + }, + "landuse_hospital": { + "color": "hospital_night" + }, + "landuse_school": { + "color": "school_night" + }, + "landuse_pitch": { + "color": "pitch_night", + "stroke": "pitch" + }, + "landuse_industrial": { + "color": "builtup_night" + }, + "overlay_wetland": { + "color": "rgba(210,225,225,0.2)", + "image": "wetland_noveg_64" + }, + "overlay_breakwater_pier": { + "color": "land" + }, + "hillshade_full_shadow": { + "color": "#103", + "antialias": false, + "opacity": [ + "stops", + {"z": 15, "val": 0.3}, + {"z": 17, "val": 0.2}, + {"z": 18, "val": 0.1} + ] + }, + "hillshade_medium_shadow": { + "color": "#206", + "antialias": false, + "opacity": [ + "stops", + {"z": 15, "val": 0.3}, + {"z": 17, "val": 0.2}, + {"z": 18, "val": 0.1} + ] + }, + "hillshade_full_highlight": { + "color": "#fdfdad", + "antialias": false, + "opacity": [ + "stops", + {"z": 15, "val": 0.5}, + {"z": 17, "val": 0.3}, + {"z": 18, "val": 0.1} + ] + }, + "hillshade_medium_highlight": { + "color": "#ff9280", + "antialias": false, + "opacity": [ + "stops", + {"z": 15, "val": 0.5}, + {"z": 17, "val": 0.3}, + {"z": 18, "val": 0.1} + ] + }, + "contour_line_loud": { + "color": "contour_night", + "width": 0.9, + "opacity": [ + "stops", + {"z": 12, "val": 0.1}, + {"z": 13, "val": 0.4} + ] + }, + "contour_line_regular": { + "color": "contour_night", + "width": 0.5, + "opacity": [ + "stops", + {"z": 12, "val": 0.1}, + {"z": 13, "val": 0.4} + ] + }, + "water": { + "color": "water_night", + "stroke": "water_dark_night" + }, + "aeroway_fill": { + "color": "#ddd" + }, + "aeroway_runway": { + "color": "#ddd", + "width": [ + "stops", + {"z": 10, "val": 1}, + {"z": 11, "val": 2}, + {"z": 12, "val": 3}, + {"z": 13, "val": 5}, + {"z": 14, "val": 7}, + {"z": 15, "val": 11}, + {"z": 16, "val": 15}, + {"z": 17, "val": 19}, + {"z": 18, "val": 23} + ] + }, + "aeroway_taxiway": { + "color": "#ddd", + "width": [ + "stops", + {"z": 10, "val": 0.2}, + {"z": 12, "val": 0.2}, + {"z": 13, "val": 1}, + {"z": 14, "val": 1.5}, + {"z": 15, "val": 2}, + {"z": 16, "val": 3}, + {"z": 17, "val": 4}, + {"z": 18,"val": 5} + ] + }, + "building": { + "color": "#027797" + }, + "building_wall": { + "color": "#027797", + "stroke": "#026688", + "opacity": [ + "stops", + {"z": 16.5, "val": 0}, + {"z": 17, "val": 0.7} + ] + }, + "building_shadow": { + "color": "#026688", + "stroke": "#026688", + "translate": [ + 1, + 1 + ], + "opacity": [ + "stops", + {"z": 16.5, "val": 0}, + {"z": 17, "val": 1} + ] + }, + "tunnel_motorway_casing": { + "color": "case_night", + "dasharray": [ + 6, + 6 + ], + "width": [ + "stops", + {"z": 7.5, "val": 0.6}, + {"z": 8, "val": 0.8}, + {"z": 10, "val": 2.8}, + {"z": 11, "val": 3}, + {"z": 12, "val": 4}, + {"z": 13, "val": 5}, + {"z": 14, "val": 6.5}, + {"z": 15, "val": 9}, + {"z": 16, "val": 12}, + {"z": 17, "val": 15}, + {"z": 18, "val": 17} + ], + "opacity": [ + "stops", + {"z": 9.5, "val": 0}, + {"z": 10, "val": 1} + ] + }, + "tunnel_motorway": { + "color": "#83b9c8", + "width": [ + "stops", + {"z": 5, "val": 0}, + {"z": 6, "val": 0.5}, + {"z": 8, "val": 0.8}, + {"z": 10, "val": 1}, + {"z": 11, "val": 1.2}, + {"z": 12, "val": 2}, + {"z": 13, "val": 3}, + {"z": 14, "val": 4}, + {"z": 15, "val": 6}, + {"z": 16, "val": 9}, + {"z": 17, "val": 12}, + {"z": 18, "val": 14} + ], + "opacity": [ + "stops", + {"z": 6.5, "val": 0}, + {"z": 7, "val": 1} + ] + }, + "tunnel_main_casing": { + "color": "case_night", + "dasharray": [ + 6, + 6 + ], + "width": [ + "stops", + {"z": 9, "val": 2.9}, + {"z": 12, "val": 2.9}, + {"z": 13, "val": 3.5}, + {"z": 14, "val": 4}, + {"z": 15, "val": 5.5}, + {"z": 16, "val": 9}, + {"z": 17, "val": 12}, + {"z": 18, "val": 14} + ], + "opacity": ["stops", + {"z": 9, "val": 0}, + {"z": 10, "val": 1} + ] + }, + "tunnel_main": { + "color": "#e6cec7", + "width": [ + "stops", + {"z": 5, "val": 1}, + {"z": 12, "val": 1}, + {"z": 13, "val": 1.5}, + {"z": 14, "val": 2}, + {"z": 15, "val": 3}, + {"z": 16, "val": 6}, + {"z": 17, "val": 10}, + {"z": 18, "val": 12} + ], + "opacity": [ + "stops", + {"z": 6.5, "val": 0}, + {"z": 7, "val": 1} + ] + }, + "tunnel_motorway_link_casing": { + "color": "case_night", + "dasharray": [ + 6, + 6 + ], + "width": [ + "stops", + {"z": 12, "val": 2.8}, + {"z": 14, "val": 3.5}, + {"z": 16, "val": 5}, + {"z": 18, "val": 6} + ] + }, + "tunnel_motorway_link": { + "color": "#e6cec7", + "width": [ + "stops", + {"z": 12, "val": 1.2}, + {"z": 14, "val": 2}, + {"z": 16, "val": 3}, + {"z": 18, "val": 4} + ] + }, + "tunnel_street_casing": { + "color": "street_case_night", + "width": [ + "stops", + {"z": 13,"val": 0.4}, + {"z": 14, "val": 1}, + {"z": 15, "val": 2.5}, + {"z": 16, "val": 4}, + {"z": 17, "val": 10} + ] + }, + "tunnel_street": { + "color": "street_case_night", + "width": [ + "stops", + {"z": 14.5, "val": 0}, + {"z": 15, "val": 1.5}, + {"z": 16, "val": 3}, + {"z": 17, "val": 8} + ] + }, + "tunnel_service_casing": { + "color": "#000", + "opacity": 0.04, + "dasharray": [ + 6, + 6 + ], + "width": [ + "stops", + {"z": 14, "val": 0.5}, + {"z": 15, "val": 3}, + {"z": 16, "val": 3.5}, + {"z": 17, "val": 4}, + {"z": 18, "val": 5}, + {"z": 19, "val": 6} + ] + }, + "tunnel_service": { + "color": "#e6cec7", + "width": 2 + }, + "road_motorway_casing": { + "color": "case_night", + "width": [ + "stops", + {"z": 7.5, "val": 0.6}, + {"z": 8, "val": 0.8}, + {"z": 10, "val": 2.8}, + {"z": 11, "val": 3}, + {"z": 12, "val": 4}, + {"z": 13, "val": 5}, + {"z": 14, "val": 6.5}, + {"z": 15, "val": 9}, + {"z": 16, "val": 12}, + {"z": 17, "val": 15}, + {"z": 18, "val": 17} + ], + "opacity": [ + "stops", + {"z": 9.5, "val": 0}, + {"z": 10, "val": 1} + ] + }, + "road_motorway": { + "color": "motorway_night", + "width": [ + "stops", + {"z": 5, "val": 0}, + {"z": 6, "val": 0.5}, + {"z": 8, "val": 0.8}, + {"z": 10, "val": 1}, + {"z": 11, "val": 1.2}, + {"z": 12, "val": 2}, + {"z": 13, "val": 3}, + {"z": 14, "val": 4}, + {"z": 15, "val": 6}, + {"z": 16, "val": 9}, + {"z": 17, "val": 12}, + {"z": 18, "val": 14} + ], + "opacity": [ + "stops", + {"z": 6.5, "val": 0}, + {"z": 7, "val": 1} + ] + }, + "road_main_casing": { + "color": "case_night", + "width": [ + "stops", + {"z": 9, "val": 2.9}, + {"z": 12, "val": 2.9}, + {"z": 13, "val": 3.5}, + {"z": 14, "val": 4}, + {"z": 15, "val": 5.5}, + {"z": 16, "val": 9}, + {"z": 17, "val": 12}, + {"z": 18, "val": 14} + ], + "opacity": ["stops", + {"z": 9, "val": 0}, + {"z": 10, "val": 1} + ] + }, + "road_main": { + "color": "main_night", + "width": [ + "stops", + {"z": 5, "val": 1}, + {"z": 12, "val": 1}, + {"z": 13, "val": 1.5}, + {"z": 14, "val": 2}, + {"z": 15, "val": 3}, + {"z": 16, "val": 6}, + {"z": 17, "val": 10}, + {"z": 18, "val": 12} + ], + "opacity": [ + "stops", + {"z": 6.5, "val": 0}, + {"z": 7, "val": 1} + ] + }, + "road_motorway_link_casing": { + "color": "case_night", + "width": [ + "stops", + {"z": 12, "val": 2.8}, + {"z": 14, "val": 3.5}, + {"z": 16, "val": 5}, + {"z": 18, "val": 6} + ] + }, + "road_motorway_link": { + "color": "motorway_night", + "width": [ + "stops", + {"z": 12, "val": 1.2}, + {"z": 14, "val": 2}, + {"z": 16, "val": 3}, + {"z": 18, "val": 4} + ] + }, + "road_street_casing": { + "color": "street_case_night", + "width": [ + "stops", + {"z": 13,"val": 0.4}, + {"z": 14, "val": 1}, + {"z": 15, "val": 2.5}, + {"z": 16, "val": 4}, + {"z": 17, "val": 10} + ] + }, + "road_street": { + "color": "street_night", + "width": [ + "stops", + {"z": 14.5, "val": 0}, + {"z": 15, "val": 1.5}, + {"z": 16, "val": 3}, + {"z": 17, "val": 8} + ] + }, + "road_service_casing": { + "color": "#000", + "opacity": 0.04, + "width": [ + "stops", + {"z": 14, "val": 0.5}, + {"z": 15, "val": 3}, + {"z": 16, "val": 3.5}, + {"z": 17, "val": 4}, + {"z": 18, "val": 5}, + {"z": 19, "val": 6} + ] + }, + "road_service": { + "color": "street_night", + "width": 2 + }, + "road_path_case": { + "opacity": 0 + }, + "road_path_footway": { + "color": "#fff", + "dasharray": [ + 10, + 4 + ], + "width": [ + "stops", + {"z": 14, "val": 1.2}, + {"z": 15, "val": 1.5}, + {"z": 16, "val": 1.8} + ] + }, + "road_path_path": { + "color": "#fff", + "dasharray": [ + 10, + 4 + ], + "opacity": 0.8, + "width": [ + "stops", + {"z": 14, "val": 0.8}, + {"z": 15, "val": 0.9}, + {"z": 16, "val": 1.2} + ] + }, + "road_path_cycleway": { + "color": "#fff", + "dasharray": [ + 10, + 4 + ], + "width": [ + "stops", + {"z": 14, "val": 1.2}, + {"z": 15, "val": 1.5}, + {"z": 16, "val": 1.8} + ] + }, + "road_path_mtb": { + "color": "#fff", + "dasharray": [ + 12, + 4 + ], + "width": [ + "stops", + {"z": 14, "val": 1.2}, + {"z": 15, "val": 1.5}, + {"z": 16, "val": 1.8} + ] + }, + "road_path_piste": { + "color": "#fff", + "dasharray": [ + 8, + 4 + ], + "width": [ + "stops", + {"z": 14, "val": 1.2}, + {"z": 15, "val": 1.5}, + {"z": 16, "val": 1.8} + ] + }, + "road_path_steps": { + "color": "#fff", + "dasharray": [ + 10, + 4 + ], + "width": 4 + }, + "road_major_rail": { + "color": "#c8c4c0", + "width": 0.8 + }, + "road_major_rail_hatching": { + "color": "#c8c4c0", + "dasharray": [ + 2, + 31 + ], + "width": 5 + }, + "bridge_motorway_casing": { + "color": "case_night", + "width": [ + "stops", + {"z": 7.5, "val": 0.6}, + {"z": 8, "val": 0.8}, + {"z": 10, "val": 2.8}, + {"z": 11, "val": 3}, + {"z": 12, "val": 4}, + {"z": 13, "val": 5}, + {"z": 14, "val": 6.5}, + {"z": 15, "val": 9}, + {"z": 16, "val": 12}, + {"z": 17, "val": 15}, + {"z": 18, "val": 17} + ], + "opacity": [ + "stops", + {"z": 9.5, "val": 0}, + {"z": 10, "val": 1} + ] + }, + "bridge_motorway": { + "color": "motorway_night", + "width": [ + "stops", + {"z": 5, "val": 0}, + {"z": 6, "val": 0.5}, + {"z": 8, "val": 0.8}, + {"z": 10, "val": 1}, + {"z": 11, "val": 1.2}, + {"z": 12, "val": 2}, + {"z": 13, "val": 3}, + {"z": 14, "val": 4}, + {"z": 15, "val": 6}, + {"z": 16, "val": 9}, + {"z": 17, "val": 12}, + {"z": 18, "val": 14} + ], + "opacity": [ + "stops", + {"z": 6.5, "val": 0}, + {"z": 7, "val": 1} + ] + }, + "bridge_main_casing": { + "color": "case_night", + "width": [ + "stops", + {"z": 9, "val": 2.9}, + {"z": 12, "val": 2.9}, + {"z": 13, "val": 3.5}, + {"z": 14, "val": 4}, + {"z": 15, "val": 5.5}, + {"z": 16, "val": 9}, + {"z": 17, "val": 12}, + {"z": 18, "val": 14} + ], + "opacity": ["stops", + {"z": 9, "val": 0}, + {"z": 10, "val": 1} + ] + }, + "bridge_main": { + "color": "main_night", + "width": [ + "stops", + {"z": 5, "val": 1}, + {"z": 12, "val": 1}, + {"z": 13, "val": 1.5}, + {"z": 14, "val": 2}, + {"z": 15, "val": 3}, + {"z": 16, "val": 6}, + {"z": 17, "val": 10}, + {"z": 18, "val": 12} + ], + "opacity": [ + "stops", + {"z": 6.5, "val": 0}, + {"z": 7, "val": 1} + ] + }, + "bridge_motorway_link_casing": { + "color": "case_night", + "width": [ + "stops", + {"z": 12, "val": 2.8}, + {"z": 14, "val": 3.5}, + {"z": 16, "val": 5}, + {"z": 18, "val": 6} + ] + }, + "bridge_motorway_link": { + "color": "motorway_night", + "width": [ + "stops", + {"z": 12, "val": 1.2}, + {"z": 14, "val": 2}, + {"z": 16, "val": 3}, + {"z": 18, "val": 4} + ] + }, + "bridge_street_casing": { + "color": "street_case_night", + "width": [ + "stops", + {"z": 13,"val": 0.4}, + {"z": 14, "val": 1}, + {"z": 15, "val": 2.5}, + {"z": 16, "val": 4}, + {"z": 17, "val": 10} + ] + }, + "bridge_street": { + "color": "street_night", + "width": [ + "stops", + {"z": 14.5, "val": 0}, + {"z": 15, "val": 1.5}, + {"z": 16, "val": 3}, + {"z": 17, "val": 8} + ] + }, + "bridge_service_casing": { + "color": "#000", + "opacity": 0.04, + "width": [ + "stops", + {"z": 14, "val": 0.5}, + {"z": 15, "val": 3}, + {"z": 16, "val": 3.5}, + {"z": 17, "val": 4}, + {"z": 18, "val": 5}, + {"z": 19, "val": 6} + ] + }, + "bridge_service": { + "color": "street_night", + "width": 2 + }, + "bridge_aerialway_casing": { + "color": "white", + "opacity": 0.5, + "width": [ + "stops", + {"z": 13.5, "val": 2}, + {"z": 14, "val": 2.5}, + {"z": 15, "val": 3}, + {"z": 16, "val": 3.5}, + {"z": 17, "val": 4}, + {"z": 22, "val": 5} + ] + }, + "bridge_aerialway": { + "color": "#876", + "opacity": 0.5, + "width": [ + "stops", + {"z": 13.5, "val": 0.8}, + {"z": 14, "val": 1.4}, + {"z": 15, "val": 1.6}, + {"z": 16, "val": 2}, + {"z": 17, "val": 2.4}, + {"z": 18, "val": 3} + ] + }, + "country_label": { + "color": "text_night", + "stroke": "text_stroke_night", + "size": [ + "stops", + {"z": 6, "val": 14}, + {"z": 12, "val": 24} + ] + }, + "country_label_line": { + "color": "text_night", + "width": 0.5, + "opacity": 0.5 + }, + "marine_label_line": { + "color": "water_dark_night", + "stroke": "water_night" + }, + "marine_label_point_1": { + "color": "water_dark_night", + "size": ["stops", + {"z": 0, "val": 20}, + {"z": 3, "val": 20}, + {"z": 4, "val": 25}, + {"z": 5, "val": 30}, + {"z": 22, "val": 30} + ], + "stroke": "water_night" + }, + "marine_label_point_2": { + "color": "water_dark_night", + "size": ["stops", + {"z": 0, "val": 13}, + {"z": 3, "val": 13}, + {"z": 4, "val": 14}, + {"z": 5, "val": 20}, + {"z": 6, "val": 24}, + {"z": 22, "val": 24} + ], + "stroke": "water_night" + }, + "marine_label_point_other": { + "color": "#a9c4c7", + "size": ["stops", + {"z": 0, "val": 12}, + {"z": 3, "val": 12}, + {"z": 4, "val": 13}, + {"z": 5, "val": 15}, + {"z": 6, "val": 18}, + {"z": 22, "val": 18} + ], + "stroke": "water_night" + }, + "state_label": { + "color": "#fff", + "strokeWidth": 0.4, + "strokeBlur": 1, + "stroke": "land_night", + "size": [ + "stops", + {"z": 3.99, "val": 0}, + {"z": 4, "val": 10}, + {"z": 9.99, "val": 16}, + {"z": 10, "val": 0} + ] + }, + "place_label_city_point": { + "color": "#ddd" + }, + "place_label_city": { + "color": "#fff", + "strokeWidth": 0.4, + "stroke": "text_stroke_night", + "size": [ + "stops", + {"z": 3.99, "val": 0}, + {"z": 4, "val": 10}, + {"z": 7, "val": 14}, + {"z": 14.99, "val": 20}, + {"z": 15, "val": 0} + ], + "translate": [ + 0, + [ + "stops", + {"z": 4, "val": 10}, + {"z": 6, "val": 30}, + {"z": 7, "val": 0} + ] + ] + }, + "place_label_town": { + "color": "text_night", + "strokeWidth": 0.5, + "stroke": "text_stroke_night", + "size": [ + "stops", + {"z": 9, "val": 10}, + {"z": 12, "val": 13}, + {"z": 14, "val": 17}, + {"z": 16, "val": 22} + ] + }, + "place_label_village": { + "color": "text_night", + "strokeWidth": 0.5, + "stroke": "text_stroke_night", + "size": [ + "stops", + {"z": 9, "val": 8}, + {"z": 12, "val": 10}, + {"z": 14, "val": 14}, + {"z": 16, "val": 16}, + {"z": 17, "val": 20} + ] + }, + "place_label_other": { + "color": "text_night", + "stroke": "text_stroke_night", + "size": [ + "stops", + {"z": 0, "val": 10}, + {"z": 14, "val": 11}, + {"z": 15, "val": 12}, + {"z": 16, "val": 14} + ] + }, + "road_label": { + "color": "text_night", + "stroke": "text_stroke_night", + "strokeWidth": 0.6, + "strokeBlur": 2, + "size": [ + "stops", + {"z": 0, "val": 12}, + {"z": 14, "val": 12}, + {"z": 15, "val": 13}, + {"z": 22, "val": 13} + ] + }, + "water_label": { + "color": "water_dark_night", + "stroke": "text_stroke_night" + }, + "waterway_label": { + "color": "water_dark_night", + "strokeWidth": 0.4, + "strokeBlur": 2, + "stroke": "text_stroke_night" + }, + "poi": { + "color": "rgba(210,210,210,0.9)", + "antialias": false + }, + "poi_label": { + "color": "#ddd", + "size": 10, + "stroke": "land_night", + "strokeWidth": 0.6, + "strokeBlur": 2, + "translate": [0, 14] + }, + "poi_aerodrome": { + "antialias": false } } } diff --git a/src/shader/shaders_gl.cpp b/src/shader/shaders_gl.cpp index b053c3761..09508cec1 100644 --- a/src/shader/shaders_gl.cpp +++ b/src/shader/shaders_gl.cpp @@ -7,40 +7,40 @@ using namespace llmr; const shader_source llmr::shaders[SHADER_COUNT] = { { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform float u_size;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n}\n\n", - "#version 120\nuniform vec4 u_color;\nuniform float u_blur;\nvoid main ()\n{\n vec2 x_1;\n x_1 = (gl_PointCoord - 0.5);\n float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 0.5) / (\n (0.5 - u_blur)\n - 0.5)), 0.0, 1.0);\n gl_FragColor = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform float u_size;\n\nvoid main(void) {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n}\n", + "#version 120\nuniform vec4 u_color;\nuniform float u_blur;\n\nvoid main() {\n\tfloat dist = length(gl_PointCoord - 0.5);\n\tfloat t = smoothstep(0.5, 0.5 - u_blur, dist);\n\n gl_FragColor = u_color * t;\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_tex;\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\nvarying vec2 v_tex;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n v_tex = (a_tex * u_ratio);\n}\n\n", - "#version 120\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\nvarying vec2 v_tex;\nvoid main ()\n{\n gl_FragColor = (u_color * texture2D (u_image, ((v_tex + \n ((gl_PointCoord - 0.5) * u_size)\n ) / u_dimension)));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_tex;\n\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\n\nvarying vec2 v_tex;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n v_tex = a_tex * u_ratio;\n}\n", + "#version 120\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\n\nvarying vec2 v_tex;\n\nvoid main() {\n vec2 pos = (v_tex + (gl_PointCoord - 0.5) * u_size) / u_dimension;\n gl_FragColor = u_color * texture2D(u_image, pos);\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n vec2 normal_1;\n vec2 tmpvar_2;\n tmpvar_2 = (vec2(mod (a_pos, 2.0)));\n normal_1.x = tmpvar_2.x;\n normal_1.y = sign((tmpvar_2.y - 0.5));\n v_normal = normal_1;\n vec4 tmpvar_3;\n tmpvar_3.zw = vec2(0.0, 0.0);\n tmpvar_3.xy = ((u_linewidth.x * a_extrude) * 0.015873);\n vec4 tmpvar_4;\n tmpvar_4.zw = vec2(0.0, 1.0);\n tmpvar_4.xy = floor((a_pos * 0.5));\n gl_Position = ((u_matrix * tmpvar_4) + (u_exmatrix * tmpvar_3));\n v_linesofar = (a_linesofar * u_ratio);\n}\n\n", - "#version 120\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\nuniform vec2 u_dasharray;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n float tmpvar_1;\n tmpvar_1 = (sqrt(dot (v_normal, v_normal)) * u_linewidth.x);\n float tmpvar_2;\n tmpvar_2 = (float(mod (v_linesofar, (u_dasharray.x + u_dasharray.y))));\n gl_FragColor = (u_color * (clamp (\n min ((tmpvar_1 - (u_linewidth.y - 1.0)), (u_linewidth.x - tmpvar_1))\n , 0.0, 1.0) * max (\n float((-(u_dasharray.y) >= 0.0))\n , \n clamp (min (tmpvar_2, (u_dasharray.x - tmpvar_2)), 0.0, 1.0)\n )));\n}\n\n", + "#version 120\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\n\n// shared\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix. Add the extrusion vector *after* the model/view matrix\n // because we're extruding the line in pixel space, regardless of the current\n // tile's zoom level.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0.0, 1.0) + u_exmatrix * dist;\n v_linesofar = a_linesofar * u_ratio;\n}", + "#version 120\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nuniform vec2 u_dasharray;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n\n // Calculate the antialiasing fade factor based on distance to the dash.\n // Only affects alpha when line is dashed\n float pos = mod(v_linesofar, u_dasharray.x + u_dasharray.y);\n alpha *= max(step(0.0, -u_dasharray.y), clamp(min(pos, u_dasharray.x - pos), 0.0, 1.0));\n\n gl_FragColor = u_color * alpha;\n}", }, { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = floor((a_pos / 2.0));\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = ((tmpvar_2.xy + 1.0) * u_world);\n gl_PointSize = u_size;\n}\n\n", - "#version 120\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\nvarying vec2 v_pos;\nvoid main ()\n{\n float tmpvar_1;\n vec2 x_2;\n x_2 = (v_pos - gl_FragCoord.xy);\n tmpvar_1 = sqrt(dot (x_2, x_2));\n gl_FragColor = (u_color * clamp (min (\n (tmpvar_1 - (u_linewidth.y - 1.0))\n , \n (u_linewidth.x - tmpvar_1)\n ), 0.0, 1.0));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(floor(a_pos / 2.0), 0.0, 1.0);\n v_pos = (gl_Position.xy + 1.0) * u_world;\n gl_PointSize = u_size;\n}\n", + "#version 120\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = (((tmpvar_2.xy + 1.0) / 2.0) * u_world);\n}\n\n", - "#version 120\nuniform vec4 u_color;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec2 x_1;\n x_1 = (v_pos - gl_FragCoord.xy);\n float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 1.0) / -1.0), 0.0, 1.0);\n gl_FragColor = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy + 1.0) / 2.0 * u_world;\n}\n", + "#version 120\nuniform vec4 u_color;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "#version 120\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n v_pos = a_pos;\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "#version 120\nuniform vec4 u_color;\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec2 tmpvar_1;\n tmpvar_1 = (vec2(mod (((v_pos + u_offset) / u_pattern_size), 1.0)));\n vec4 tmpvar_2;\n tmpvar_2 = mix (texture2D (u_image, mix (u_pattern_tl, u_pattern_br, tmpvar_1)), texture2D (u_image, mix (u_pattern_tl, u_pattern_br, (vec2(mod (\n (tmpvar_1 * 2.0)\n , 1.0))))), u_mix);\n gl_FragColor = (tmpvar_2 + (u_color * (1.0 - tmpvar_2.w)));\n}\n\n", + "#version 120\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n v_pos = a_pos;\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "#version 120\nuniform vec4 u_color;\n\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\n\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos;\n\nvoid main() {\n\n vec2 imagecoord = mod((v_pos + u_offset) / u_pattern_size, 1.0);\n vec2 pos = mix(u_pattern_tl, u_pattern_br, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord2 = mod(imagecoord * 2.0, 1.0);\n vec2 pos2 = mix(u_pattern_tl, u_pattern_br, imagecoord2);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 color = mix(color1, color2, u_mix);\n gl_FragColor = color + u_color * (1.0 - color.a);\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "#version 120\nuniform vec4 u_color;\nvoid main ()\n{\n gl_FragColor = u_color;\n}\n\n", + "#version 120\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "#version 120\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", }, { - "#version 120\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n v_pos = (a_pos / 4096.0);\n}\n\n", - "#version 120\nuniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\nvoid main ()\n{\n gl_FragColor = (texture2D (u_image, v_pos) * u_opacity);\n}\n\n", + "#version 120\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_pos / 4096.0;\n}\n", + "#version 120\nuniform sampler2D u_image;\nuniform float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n}\n", }, { - "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\nuniform vec2 u_texsize;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float rev_1;\n rev_1 = 0.0;\n float tmpvar_2;\n tmpvar_2 = (float(mod ((a_data1.w + u_angle), 256.0)));\n if ((((u_flip > 0.0) && (tmpvar_2 >= 64.0)) && (tmpvar_2 < 192.0))) {\n rev_1 = 1.0;\n };\n float tmpvar_3;\n tmpvar_3 = (((2.0 - \n float((u_zoom >= a_data2.x))\n ) - (1.0 - \n float((u_zoom >= a_data2.y))\n )) + rev_1);\n float tmpvar_4;\n tmpvar_4 = clamp (((u_fadezoom - a_data1.z) / u_fadedist), 0.0, 1.0);\n if ((u_fadedist >= 0.0)) {\n v_alpha = tmpvar_4;\n } else {\n v_alpha = (1.0 - tmpvar_4);\n };\n if ((u_maxfadezoom < a_data1.z)) {\n v_alpha = 0.0;\n };\n if ((u_minfadezoom >= a_data1.z)) {\n v_alpha = 1.0;\n };\n vec4 tmpvar_5;\n tmpvar_5.zw = vec2(0.0, 1.0);\n tmpvar_5.xy = a_pos;\n vec4 tmpvar_6;\n tmpvar_6.w = 0.0;\n tmpvar_6.xy = (a_offset / 64.0);\n tmpvar_6.z = ((tmpvar_3 + float(\n (0.0 >= v_alpha)\n )) + (float(\n (u_angle >= a_data2.z)\n ) * (1.0 - \n float((u_angle >= a_data2.w))\n )));\n gl_Position = ((u_matrix * tmpvar_5) + (u_exmatrix * tmpvar_6));\n v_tex = ((a_data1.xy * 4.0) / u_texsize);\n}\n\n", - "#version 120\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float edge0_1;\n edge0_1 = (u_buffer - u_gamma);\n float tmpvar_2;\n tmpvar_2 = clamp (((texture2D (u_texture, v_tex).w - edge0_1) / (\n (u_buffer + u_gamma)\n - edge0_1)), 0.0, 1.0);\n gl_FragColor = (u_color * ((tmpvar_2 * \n (tmpvar_2 * (3.0 - (2.0 * tmpvar_2)))\n ) * v_alpha));\n}\n\n", + "#version 120\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n float a_labelminzoom = a_data1[2];\n float a_angle = a_data1[3];\n vec2 a_zoom = a_data2.st;\n vec2 a_range = a_data2.pq;\n\n float rev = 0.0;\n\n // u_angle is angle of the map, -128..128 representing 0..2PI\n // a_angle is angle of the label, 0..256 representing 0..2PI, where 0 is horizontal text\n float rotated = mod(a_angle + u_angle, 256.0);\n // if the label rotates with the map, and if the rotated label is upside down, hide it\n if (u_flip > 0.0 && rotated >= 64.0 && rotated < 192.0) rev = 1.0;\n\n // If the label should be invisible, we move the vertex outside\n // of the view plane so that the triangle gets clipped. This makes it easier\n // for us to create degenerate triangle strips.\n // u_zoom is the current zoom level adjusted for the change in font size\n float z = 2.0 - step(a_zoom[0], u_zoom) - (1.0 - step(a_zoom[1], u_zoom)) + rev;\n\n // fade out labels\n float alpha = clamp((u_fadezoom - a_labelminzoom) / u_fadedist, 0.0, 1.0);\n\n if (u_fadedist >= 0.0) {\n v_alpha = alpha;\n } else {\n v_alpha = 1.0 - alpha;\n }\n if (u_maxfadezoom < a_labelminzoom) {\n v_alpha = 0.0;\n }\n if (u_minfadezoom >= a_labelminzoom) {\n v_alpha = 1.0;\n }\n\n // if label has been faded out, clip it\n z += step(v_alpha, 0.0);\n\n // all the angles are 0..256 representing 0..2PI\n // hide if (angle >= a_rangeend && angle < rangestart)\n z += step(a_range[0], u_angle) * (1.0 - step(a_range[1], u_angle));\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + u_exmatrix * vec4(a_offset / 64.0, z, 0);\n v_tex = a_tex * 4.0 / u_texsize;\n}\n", + "#version 120\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n float dist = texture2D(u_texture, v_tex).a;\n float alpha = smoothstep(u_buffer - u_gamma, u_buffer + u_gamma, dist) * v_alpha;\n gl_FragColor = u_color * alpha;\n}\n", } }; #endif diff --git a/src/shader/shaders_gles2.cpp b/src/shader/shaders_gles2.cpp index 6baf95066..62ae593c3 100644 --- a/src/shader/shaders_gles2.cpp +++ b/src/shader/shaders_gles2.cpp @@ -7,40 +7,40 @@ using namespace llmr; const shader_source llmr::shaders[SHADER_COUNT] = { { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform float u_size;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nuniform float u_blur;\nvoid main ()\n{\n mediump vec2 x_1;\n x_1 = (gl_PointCoord - 0.5);\n mediump float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 0.5) / (\n (0.5 - u_blur)\n - 0.5)), 0.0, 1.0);\n gl_FragColor = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform float u_size;\n\nvoid main(void) {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n}\n", + "precision highp float;\nuniform vec4 u_color;\nuniform float u_blur;\n\nvoid main() {\n\tfloat dist = length(gl_PointCoord - 0.5);\n\tfloat t = smoothstep(0.5, 0.5 - u_blur, dist);\n\n gl_FragColor = u_color * t;\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_tex;\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\nvarying vec2 v_tex;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n gl_PointSize = u_size;\n v_tex = (a_tex * u_ratio);\n}\n\n", - "precision highp float;\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\nvarying vec2 v_tex;\nvoid main ()\n{\n mediump vec2 tmpvar_1;\n tmpvar_1 = ((v_tex + (\n (gl_PointCoord - 0.5)\n * u_size)) / u_dimension);\n lowp vec4 tmpvar_2;\n tmpvar_2 = (u_color * texture2D (u_image, tmpvar_1));\n gl_FragColor = tmpvar_2;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_tex;\n\nuniform mat4 u_matrix;\nuniform float u_size;\nuniform float u_ratio;\n\nvarying vec2 v_tex;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n gl_PointSize = u_size;\n v_tex = a_tex * u_ratio;\n}\n", + "precision highp float;\nuniform sampler2D u_image;\nuniform vec2 u_dimension;\nuniform vec4 u_color;\nuniform float u_size;\n\nvarying vec2 v_tex;\n\nvoid main() {\n vec2 pos = (v_tex + (gl_PointCoord - 0.5) * u_size) / u_dimension;\n gl_FragColor = u_color * texture2D(u_image, pos);\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n vec2 normal_1;\n vec2 tmpvar_2;\n tmpvar_2 = (vec2(mod (a_pos, 2.0)));\n normal_1.x = tmpvar_2.x;\n normal_1.y = sign((tmpvar_2.y - 0.5));\n v_normal = normal_1;\n vec4 tmpvar_3;\n tmpvar_3.zw = vec2(0.0, 0.0);\n tmpvar_3.xy = ((u_linewidth.x * a_extrude) * 0.015873);\n vec4 tmpvar_4;\n tmpvar_4.zw = vec2(0.0, 1.0);\n tmpvar_4.xy = floor((a_pos * 0.5));\n gl_Position = ((u_matrix * tmpvar_4) + (u_exmatrix * tmpvar_3));\n v_linesofar = (a_linesofar * u_ratio);\n}\n\n", - "precision highp float;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\nuniform vec2 u_dasharray;\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvoid main ()\n{\n float tmpvar_1;\n tmpvar_1 = (sqrt(dot (v_normal, v_normal)) * u_linewidth.x);\n float tmpvar_2;\n tmpvar_2 = (float(mod (v_linesofar, (u_dasharray.x + u_dasharray.y))));\n gl_FragColor = (u_color * (clamp (\n min ((tmpvar_1 - (u_linewidth.y - 1.0)), (u_linewidth.x - tmpvar_1))\n , 0.0, 1.0) * max (\n float((-(u_dasharray.y) >= 0.0))\n , \n clamp (min (tmpvar_2, (u_dasharray.x - tmpvar_2)), 0.0, 1.0)\n )));\n}\n\n", + "precision highp float;\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute float a_linesofar;\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\n\n// shared\nuniform float u_ratio;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix. Add the extrusion vector *after* the model/view matrix\n // because we're extruding the line in pixel space, regardless of the current\n // tile's zoom level.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0.0, 1.0) + u_exmatrix * dist;\n v_linesofar = a_linesofar * u_ratio;\n}", + "precision highp float;\nuniform vec2 u_linewidth;\nuniform vec4 u_color;\n\nuniform vec2 u_dasharray;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n\n // Calculate the antialiasing fade factor based on distance to the dash.\n // Only affects alpha when line is dashed\n float pos = mod(v_linesofar, u_dasharray.x + u_dasharray.y);\n alpha *= max(step(0.0, -u_dasharray.y), clamp(min(pos, u_dasharray.x - pos), 0.0, 1.0));\n\n gl_FragColor = u_color * alpha;\n}", }, { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\nvarying highp vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = floor((a_pos / 2.0));\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = ((tmpvar_2.xy + 1.0) * u_world);\n gl_PointSize = u_size;\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\nvarying vec2 v_pos;\nvoid main ()\n{\n highp float tmpvar_1;\n highp vec2 x_2;\n x_2 = (v_pos - gl_FragCoord.xy);\n tmpvar_1 = sqrt(dot (x_2, x_2));\n highp vec4 tmpvar_3;\n tmpvar_3 = (u_color * clamp (min (\n (tmpvar_1 - (u_linewidth.y - 1.0))\n , \n (u_linewidth.x - tmpvar_1)\n ), 0.0, 1.0));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform float u_size;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(floor(a_pos / 2.0), 0.0, 1.0);\n v_pos = (gl_Position.xy + 1.0) * u_world;\n gl_PointSize = u_size;\n}\n", + "precision highp float;\nuniform vec4 u_color;\nuniform vec2 u_linewidth;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float alpha = clamp(min(dist - (u_linewidth.t - 1.0), u_linewidth.s - dist), 0.0, 1.0);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\nvarying highp vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n vec4 tmpvar_2;\n tmpvar_2 = (u_matrix * tmpvar_1);\n gl_Position = tmpvar_2;\n v_pos = (((tmpvar_2.xy + 1.0) / 2.0) * u_world);\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nvarying vec2 v_pos;\nvoid main ()\n{\n highp vec2 x_1;\n x_1 = (v_pos - gl_FragCoord.xy);\n highp float tmpvar_2;\n tmpvar_2 = clamp (((\n sqrt(dot (x_1, x_1))\n - 1.0) / -1.0), 0.0, 1.0);\n highp vec4 tmpvar_3;\n tmpvar_3 = (u_color * (tmpvar_2 * (tmpvar_2 * \n (3.0 - (2.0 * tmpvar_2))\n )));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy + 1.0) / 2.0 * u_world;\n}\n", + "precision highp float;\nuniform vec4 u_color;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * alpha;\n}\n", }, { - "precision highp float;\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n v_pos = a_pos;\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec2 tmpvar_1;\n tmpvar_1 = (vec2(mod (((v_pos + u_offset) / u_pattern_size), 1.0)));\n lowp vec4 tmpvar_2;\n tmpvar_2 = mix (texture2D (u_image, mix (u_pattern_tl, u_pattern_br, tmpvar_1)), texture2D (u_image, mix (u_pattern_tl, u_pattern_br, (vec2(mod (\n (tmpvar_1 * 2.0)\n , 1.0))))), u_mix);\n lowp vec4 tmpvar_3;\n tmpvar_3 = (tmpvar_2 + (u_color * (1.0 - tmpvar_2.w)));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n v_pos = a_pos;\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "precision highp float;\nuniform vec4 u_color;\n\nuniform vec2 u_offset;\nuniform vec2 u_pattern_size;\nuniform vec2 u_pattern_tl;\nuniform vec2 u_pattern_br;\nuniform float u_mix;\n\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos;\n\nvoid main() {\n\n vec2 imagecoord = mod((v_pos + u_offset) / u_pattern_size, 1.0);\n vec2 pos = mix(u_pattern_tl, u_pattern_br, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord2 = mod(imagecoord * 2.0, 1.0);\n vec2 pos2 = mix(u_pattern_tl, u_pattern_br, imagecoord2);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 color = mix(color1, color2, u_mix);\n gl_FragColor = color + u_color * (1.0 - color.a);\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n}\n\n", - "precision highp float;\nuniform vec4 u_color;\nvoid main ()\n{\n gl_FragColor = u_color;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n", + "precision highp float;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n", }, { - "precision highp float;\nuniform mat4 u_matrix;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\nvoid main ()\n{\n vec4 tmpvar_1;\n tmpvar_1.zw = vec2(0.0, 1.0);\n tmpvar_1.xy = a_pos;\n gl_Position = (u_matrix * tmpvar_1);\n v_pos = (a_pos / 4096.0);\n}\n\n", - "precision highp float;\nuniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\nvoid main ()\n{\n lowp vec4 tmpvar_1;\n tmpvar_1 = (texture2D (u_image, v_pos) * u_opacity);\n gl_FragColor = tmpvar_1;\n}\n\n", + "precision highp float;\nuniform mat4 u_matrix;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_pos / 4096.0;\n}\n", + "precision highp float;\nuniform sampler2D u_image;\nuniform float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n}\n", }, { - "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\nuniform vec2 u_texsize;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float rev_1;\n rev_1 = 0.0;\n float tmpvar_2;\n tmpvar_2 = (float(mod ((a_data1.w + u_angle), 256.0)));\n if ((((u_flip > 0.0) && (tmpvar_2 >= 64.0)) && (tmpvar_2 < 192.0))) {\n rev_1 = 1.0;\n };\n float tmpvar_3;\n tmpvar_3 = (((2.0 - \n float((u_zoom >= a_data2.x))\n ) - (1.0 - \n float((u_zoom >= a_data2.y))\n )) + rev_1);\n float tmpvar_4;\n tmpvar_4 = clamp (((u_fadezoom - a_data1.z) / u_fadedist), 0.0, 1.0);\n if ((u_fadedist >= 0.0)) {\n v_alpha = tmpvar_4;\n } else {\n v_alpha = (1.0 - tmpvar_4);\n };\n if ((u_maxfadezoom < a_data1.z)) {\n v_alpha = 0.0;\n };\n if ((u_minfadezoom >= a_data1.z)) {\n v_alpha = 1.0;\n };\n vec4 tmpvar_5;\n tmpvar_5.zw = vec2(0.0, 1.0);\n tmpvar_5.xy = a_pos;\n vec4 tmpvar_6;\n tmpvar_6.w = 0.0;\n tmpvar_6.xy = (a_offset / 64.0);\n tmpvar_6.z = ((tmpvar_3 + float(\n (0.0 >= v_alpha)\n )) + (float(\n (u_angle >= a_data2.z)\n ) * (1.0 - \n float((u_angle >= a_data2.w))\n )));\n gl_Position = ((u_matrix * tmpvar_5) + (u_exmatrix * tmpvar_6));\n v_tex = ((a_data1.xy * 4.0) / u_texsize);\n}\n\n", - "precision highp float;\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\nvarying vec2 v_tex;\nvarying float v_alpha;\nvoid main ()\n{\n float edge0_1;\n edge0_1 = (u_buffer - u_gamma);\n lowp float tmpvar_2;\n tmpvar_2 = clamp (((texture2D (u_texture, v_tex).w - edge0_1) / (\n (u_buffer + u_gamma)\n - edge0_1)), 0.0, 1.0);\n lowp vec4 tmpvar_3;\n tmpvar_3 = (u_color * ((tmpvar_2 * \n (tmpvar_2 * (3.0 - (2.0 * tmpvar_2)))\n ) * v_alpha));\n gl_FragColor = tmpvar_3;\n}\n\n", + "precision highp float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// posmatrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform float u_angle;\nuniform float u_zoom;\nuniform float u_flip;\nuniform float u_fadedist;\nuniform float u_minfadezoom;\nuniform float u_maxfadezoom;\nuniform float u_fadezoom;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n float a_labelminzoom = a_data1[2];\n float a_angle = a_data1[3];\n vec2 a_zoom = a_data2.st;\n vec2 a_range = a_data2.pq;\n\n float rev = 0.0;\n\n // u_angle is angle of the map, -128..128 representing 0..2PI\n // a_angle is angle of the label, 0..256 representing 0..2PI, where 0 is horizontal text\n float rotated = mod(a_angle + u_angle, 256.0);\n // if the label rotates with the map, and if the rotated label is upside down, hide it\n if (u_flip > 0.0 && rotated >= 64.0 && rotated < 192.0) rev = 1.0;\n\n // If the label should be invisible, we move the vertex outside\n // of the view plane so that the triangle gets clipped. This makes it easier\n // for us to create degenerate triangle strips.\n // u_zoom is the current zoom level adjusted for the change in font size\n float z = 2.0 - step(a_zoom[0], u_zoom) - (1.0 - step(a_zoom[1], u_zoom)) + rev;\n\n // fade out labels\n float alpha = clamp((u_fadezoom - a_labelminzoom) / u_fadedist, 0.0, 1.0);\n\n if (u_fadedist >= 0.0) {\n v_alpha = alpha;\n } else {\n v_alpha = 1.0 - alpha;\n }\n if (u_maxfadezoom < a_labelminzoom) {\n v_alpha = 0.0;\n }\n if (u_minfadezoom >= a_labelminzoom) {\n v_alpha = 1.0;\n }\n\n // if label has been faded out, clip it\n z += step(v_alpha, 0.0);\n\n // all the angles are 0..256 representing 0..2PI\n // hide if (angle >= a_rangeend && angle < rangestart)\n z += step(a_range[0], u_angle) * (1.0 - step(a_range[1], u_angle));\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + u_exmatrix * vec4(a_offset / 64.0, z, 0);\n v_tex = a_tex * 4.0 / u_texsize;\n}\n", + "precision highp float;\nuniform sampler2D u_texture;\nuniform vec4 u_color;\nuniform float u_buffer;\nuniform float u_gamma;\n\nvarying vec2 v_tex;\nvarying float v_alpha;\n\nvoid main() {\n float dist = texture2D(u_texture, v_tex).a;\n float alpha = smoothstep(u_buffer - u_gamma, u_buffer + u_gamma, dist) * v_alpha;\n gl_FragColor = u_color * alpha;\n}\n", } }; #endif