{"action":"opened","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1626","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1626/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1626/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1626/events","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/1626","id":111891921,"number":1626,"title":"Data-Driven Styling Master Ticket","user":{"login":"lucaswoj","id":281306,"avatar_url":"https://avatars.githubusercontent.com/u/281306?v=3","gravatar_id":"","url":"https://api.github.com/users/lucaswoj","html_url":"https://github.com/lucaswoj","followers_url":"https://api.github.com/users/lucaswoj/followers","following_url":"https://api.github.com/users/lucaswoj/following{/other_user}","gists_url":"https://api.github.com/users/lucaswoj/gists{/gist_id}","starred_url":"https://api.github.com/users/lucaswoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucaswoj/subscriptions","organizations_url":"https://api.github.com/users/lucaswoj/orgs","repos_url":"https://api.github.com/users/lucaswoj/repos","events_url":"https://api.github.com/users/lucaswoj/events{/privacy}","received_events_url":"https://api.github.com/users/lucaswoj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-16T19:01:38Z","updated_at":"2015-10-16T19:01:38Z","closed_at":null,"body":"Implementing data-driven styling is as easy as 1-2-3-4-5-6-7-8-9\r\n\r\n## 1. Refactor `Buffer` to design buffer layouts at runtime\r\n\r\n#### Status :ship: \r\n\r\nmerged in #1526\r\n\r\n## 2. Introduce `LayerType` classes, move attribute calcuation to `value` funtions in `LayerType`\r\n\r\nWe are going to implement data-driven styling using disableable shader attributes. This refactoring implements an abstraction that will allow us to turn on and off attributes and use the same logic to calculate an attribute, whether it is disabled or enabled.\r\n\r\n#### Status :rocket: \r\n\r\npull request ready for review #1620\r\n\r\n## 3. Change shader `uniform`s to `attribute`s\r\n\r\nIn order to supply per-feature values to WebGL, we need to convert some shader `uniform`s to `attribute`s.\r\n\r\nThis could be challenging because, as we saw in #1336, IE has a big performance penalty for using a disabled attribute instead of a uniform.\r\n\r\n#### Status :thought_balloon: \r\n\r\npreviously implemented in #1257 but reverted in #1418 because of #1336\r\n\r\n## 4. Make attributes disableable\r\n\r\nAdd an `isDisabled` function to the `LayerType` attributes. If this function returns `false` the attribute will not be added to the buffer, disabled with `disableVertexAttribArray`, and set by `vertexAttrib*`.\r\n\r\ndepends on 2\r\n\r\n#### Status :thought_balloon: \r\n\r\n## 5. Refactor `StyleLayer` classes to be instantiate-able in the worker\r\n\r\nIn order to work with paint and layout properties within the worker, we need to make `StyleLayer`s easy to instantiate in the worker thread. Then we can replace the `layoutProperties` object on `BufferBuilder` with an instance of `StyleLayer`, with full support for paint properties and data-driven styling functions. \r\n\r\nThis might be easier after taking some time to refactor and simplify all the style classes (which should be done in a separate PR). \r\n\r\nWe probably won't support transitions on data-driven styles in the beginning.\r\n\r\n#### Status :thought_balloon: \r\n\r\n## 6. Refactor `StyleLayer` classes to work with data-driven styles\r\n\r\nWe need to support passing feature properties to style getters and add a method to determine if a given style property depends on feature properties.\r\n\r\ndepends on 7\r\n\r\n#### Status :thought_balloon: \r\n\r\n## 7. Add support for data-driven styles in `mapbox-gl-function`\r\n\r\ndepends on 8\r\n\r\n#### Status :thought_balloon: \r\n\r\npreviously implemented but not in `master`\r\n\r\n## 8. Add support for data-driven styles in `mapbox-gl-style-spec`\r\n\r\n#### Status :thought_balloon: \r\n\r\npreviously implemented but not in `master`"}}