-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP data-driven line-dasharray / line-cap (not working yet) * WIP pass the per-tile line atlas through * WIP switch to integer coords for line atlas * add a dds dasharray debug page (temp) * fix debug page * use different attribute names for dashes to avoid collision The attribute names used for dashes were the same as those used for patterns. This was leading to incorrectly generated shaders. Since there was no pattern set for the dash layer it was setting the defines that generate the shader without those attributes. The line atlas texture is now bound with gl.REPEAT to render more than one dash. * fix DDS dasharray rendering * refactor to support constant patterns * fix constant dasharrays * dasharray fixes * more dasharray fixes * fix line atlas unit tests * more unit test fixes * fix remaining render test * one more unit test fix * optimize dash buffer layout * fixup line pattern * fix constant dash + dds line-cap * fixup * fix dasharray + composite line-cap * fix dasharray flickering when crossing zoom stops * dasharray perf optimizations * clean up leftovers * minor optimization in program_configuration * add data-driven dash/cap render tests * add a render test for solid line data-driven line-cap * make shaders more consistent for easier porting * rename conflicting shader constant * fix out of atlas space warning in some cases Co-authored-by: Ansis Brammanis <[email protected]>
- Loading branch information
Showing
33 changed files
with
827 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Mapbox GL JS debug page</title> | ||
<meta charset='utf-8'> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | ||
<link rel='stylesheet' href='../dist/mapbox-gl.css' /> | ||
<style> | ||
body { margin: 0; padding: 0; } | ||
html, body, #map { height: 100%; } | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id='map'></div> | ||
|
||
<script src='../dist/mapbox-gl-dev.js'></script> | ||
<script src='../debug/access_token_generated.js'></script> | ||
<script> | ||
|
||
var map = window.map = new mapboxgl.Map({ | ||
container: 'map', | ||
zoom: 4, | ||
center: [0, 0], | ||
style: {sources: {}, version: 8, layers: []} | ||
}); | ||
|
||
map.on('load', () => { | ||
map.addSource('geojson', { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [{ | ||
"type": "Feature", | ||
"properties": {"property": 1}, | ||
"geometry": {"type": "LineString", "coordinates": [[-10, -5], [10, -5]]} | ||
}, { | ||
"type": "Feature", | ||
"properties": {"property": 2}, | ||
"geometry": {"type": "LineString", "coordinates": [[-10, 0], [10, 0]]} | ||
}, { | ||
"type": "Feature", | ||
"properties": {"property": 3}, | ||
"geometry": {"type": "LineString", "coordinates": [[-10, 5], [10, 5]]} | ||
}] | ||
} | ||
}); | ||
|
||
map.addLayer({ | ||
"id": "dash-dds", | ||
"type": "line", | ||
"source": "geojson", | ||
"paint": { | ||
"line-width": 10, | ||
// "line-dasharray": [1, 2], | ||
"line-dasharray": [ | ||
"match", ["get", "property"], | ||
1, ["literal", [1, 2]], | ||
2, ["literal", [2, 2]], | ||
3, ["literal", [3, 2]], | ||
["literal", [1, 1]] | ||
] | ||
}, | ||
"layout": { | ||
"line-cap": ["match", ["get", "property"], 2, "round", "butt"] | ||
} | ||
}); | ||
}); | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @flow | ||
import {createLayout} from '../../util/struct_array.js'; | ||
|
||
const dashAttributes = createLayout([ | ||
{name: 'a_dash_to', components: 4, type: 'Uint16'}, // [x, y, width, unused] | ||
{name: 'a_dash_from', components: 4, type: 'Uint16'} | ||
]); | ||
|
||
export default dashAttributes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.