Add data driven styling for circle-color and circle-radius#1932
Merged
Add data driven styling for circle-color and circle-radius#1932
Conversation
263def1 to
27e0443
Compare
666f7ca to
4e58abc
Compare
2b01616 to
4520a6f
Compare
Closed
4520a6f to
2da2bdb
Compare
b3e4975 to
c9b0d8f
Compare
44bd38e to
be1e88a
Compare
1072da4 to
ce7fc2b
Compare
Using macros and preprocessor directives is the glsl way of doing this. After this the .glsl files are now valid glsl. I think it's clearer to have both variations explicitly written in glsl than having string replacement.
This replaces a per-attribute `isDisabled` function with paint property key. All data-driven attributes must now depend on only a single paint property. The `a_color` attribute used to depend on both the `circle-color` and `circle-opacity` paint properties. This splits them up into two attributes/uniforms, each of which only depends on one paint property. I think it will be simpler to have all attributes be based on a single style property. We will need to split up: - a_color, which depends on -color and -opacity - u_linewidth, which depends on line-width and line-width-gap
This prepares the shaders for the switch to data driven styling where opacity and color need to be passed to the shader independent of eachotehr. remove the `additionalOpacity` parameter from `util.premultiply`
A function of the layer, globalProperties, featureProperties is simpler
than a string of code that gets joined into a function.
This separates the vertex push method for core attributes from the push
methods for data-driven attributes. This will let us:
- use a regular function for adding core attributes to buffers
- and either:
- generate a separate method for data driven attributes
- or optimize adding attributes without code generation
Data driven properties need to be evaluated once per feature, not once
per vertex. This means we can evaluate them outside the main vertex loop
and then add the same value for every vertex.
The hot loop for lines, fills and symbols will be:
for (var i = startIndex; i < endIndex; i++) {
...
}
If it's too slow in the current implementation we could add new
StructArray methods for setting a single value for a range of elements.
If we need to generate code it would be nice to contain that to
StructArray.
Now that paint attributes are added separately, we can switch to using regular functions instead of code strings that are joined into a method. This removes more code generation and it reduces the responsibility of the `Bucket` parent class.
It's simpler to just add directly to the arrays.
- avoids the need to namespace attribute names with string concatenation - this let's us use attribute.name as the shader attribute name - this will let us use instanced rendering (#1898) with a shorter buffer when that extension is available.
since it no longer needs access to anything in Bucket Set attribute pointers using info from the array type.
b35ddd0 to
31dc4ac
Compare
This was referenced Apr 12, 2016
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch adds data-driven styling for
circle-color.Follow Up Tasks
mapbox-gl-functionbranchmapbox-gl-style-specbranchmapbox-gl-test-suitebranchBucketclass into smaller units