summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauren Budorick <lauren@mapbox.com>2017-06-16 16:21:16 -0700
committerGitHub <noreply@github.com>2017-06-16 16:21:16 -0700
commit7b05606464ac4d57b59b64015629e9578cbebac2 (patch)
treed38ceeb44bdd056827f6b57da735a1658353bda0
parent79c986a04c1ef00b3f8eb2bd2251f07b55886702 (diff)
downloadqtlocation-mapboxgl-7b05606464ac4d57b59b64015629e9578cbebac2.tar.gz
[core] add DataDrivenPaintProperty uniform template class to generation script (#9297)
-rw-r--r--scripts/generate-style-code.js9
-rw-r--r--src/mbgl/style/layers/background_layer_properties.hpp1
-rw-r--r--src/mbgl/style/layers/layer_properties.hpp.ejs1
-rw-r--r--src/mbgl/style/layers/raster_layer_properties.hpp1
4 files changed, 8 insertions, 4 deletions
diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js
index c169c4ecd5..b1d0ed28ec 100644
--- a/scripts/generate-style-code.js
+++ b/scripts/generate-style-code.js
@@ -53,7 +53,7 @@ global.evaluatedType = function (property) {
}
};
-function attributeType(property, type) {
+function attributeUniformType(property, type) {
const attributeNameExceptions = {
'text-opacity': 'opacity',
'icon-opacity': 'opacity',
@@ -64,11 +64,12 @@ function attributeType(property, type) {
'text-halo-blur': 'halo_blur',
'icon-halo-blur': 'halo_blur',
'text-halo-width': 'halo_width',
- 'icon-halo-width': 'halo_width'
+ 'icon-halo-width': 'halo_width',
+ 'line-gap-width': 'gapwidth'
}
const name = attributeNameExceptions[property.name] ||
property.name.replace(type + '-', '').replace(/-/g, '_');
- return `attributes::a_${name}${name === 'offset' ? '<1>' : ''}`;
+ return `attributes::a_${name}${name === 'offset' ? '<1>' : ''}, uniforms::u_${name}`;
}
global.layoutPropertyType = function (property) {
@@ -81,7 +82,7 @@ global.layoutPropertyType = function (property) {
global.paintPropertyType = function (property, type) {
if (isDataDriven(property)) {
- return `DataDrivenPaintProperty<${evaluatedType(property)}, ${attributeType(property, type)}>`;
+ return `DataDrivenPaintProperty<${evaluatedType(property)}, ${attributeUniformType(property, type)}>`;
} else if (/-pattern$/.test(property.name) || property.name === 'line-dasharray') {
return `CrossFadedPaintProperty<${evaluatedType(property)}>`;
} else {
diff --git a/src/mbgl/style/layers/background_layer_properties.hpp b/src/mbgl/style/layers/background_layer_properties.hpp
index f9a67b214d..3a61392fb4 100644
--- a/src/mbgl/style/layers/background_layer_properties.hpp
+++ b/src/mbgl/style/layers/background_layer_properties.hpp
@@ -7,6 +7,7 @@
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
+#include <mbgl/programs/uniforms.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/layers/layer_properties.hpp.ejs b/src/mbgl/style/layers/layer_properties.hpp.ejs
index a271a27e8d..cde1b80b7b 100644
--- a/src/mbgl/style/layers/layer_properties.hpp.ejs
+++ b/src/mbgl/style/layers/layer_properties.hpp.ejs
@@ -12,6 +12,7 @@
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
+#include <mbgl/programs/uniforms.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/layers/raster_layer_properties.hpp b/src/mbgl/style/layers/raster_layer_properties.hpp
index 732f5b2aff..12df09f32c 100644
--- a/src/mbgl/style/layers/raster_layer_properties.hpp
+++ b/src/mbgl/style/layers/raster_layer_properties.hpp
@@ -7,6 +7,7 @@
#include <mbgl/style/paint_property.hpp>
#include <mbgl/style/properties.hpp>
#include <mbgl/programs/attributes.hpp>
+#include <mbgl/programs/uniforms.hpp>
namespace mbgl {
namespace style {