summaryrefslogtreecommitdiff
path: root/src/renderer
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2014-09-04 13:55:03 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2014-09-04 16:22:25 -0700
commit1fedf0918aa5c529207ba8f2f1312d403a8ba7fc (patch)
treeb33bbb21744719b2f4b159051bcbe614caddd191 /src/renderer
parentc14ae3c477617d284d50daff668ab5716ff9a771 (diff)
downloadqtlocation-mapboxgl-1fedf0918aa5c529207ba8f2f1312d403a8ba7fc.tar.gz
Less shader boilerplate
Diffstat (limited to 'src/renderer')
-rw-r--r--src/renderer/painter.cpp4
-rw-r--r--src/renderer/painter_clipping.cpp2
-rw-r--r--src/renderer/painter_debug.cpp16
-rw-r--r--src/renderer/painter_fill.cpp34
-rw-r--r--src/renderer/painter_line.cpp56
-rw-r--r--src/renderer/painter_prerender.cpp19
-rw-r--r--src/renderer/painter_raster.cpp31
-rw-r--r--src/renderer/painter_symbol.cpp71
-rw-r--r--src/renderer/prerendered_texture.cpp8
-rw-r--r--src/renderer/raster_bucket.cpp4
10 files changed, 131 insertions, 114 deletions
diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp
index 938bd5bd84..5f75287dbb 100644
--- a/src/renderer/painter.cpp
+++ b/src/renderer/painter.cpp
@@ -195,8 +195,8 @@ void Painter::renderBackground(std::shared_ptr<StyleLayer> layer_desc) {
if ((color[3] >= 1.0f) == (pass == RenderPass::Opaque)) {
useProgram(plainShader->program);
- plainShader->setMatrix(identityMatrix);
- plainShader->setColor(color);
+ plainShader->u_matrix = identityMatrix;
+ plainShader->u_color = color;
backgroundArray.bind(*plainShader, backgroundBuffer, BUFFER_OFFSET(0));
glDisable(GL_STENCIL_TEST);
diff --git a/src/renderer/painter_clipping.cpp b/src/renderer/painter_clipping.cpp
index d8fa3693bd..45b14a2f78 100644
--- a/src/renderer/painter_clipping.cpp
+++ b/src/renderer/painter_clipping.cpp
@@ -28,7 +28,7 @@ void Painter::drawClippingMasks(const std::set<std::shared_ptr<StyleSource>> &so
}
void Painter::drawClippingMask(const mat4& matrix, const ClipID &clip) {
- plainShader->setMatrix(matrix);
+ plainShader->u_matrix = matrix;
const GLint ref = (GLint)(clip.reference.to_ulong());
const GLuint mask = (GLuint)(clip.mask.to_ulong());
diff --git a/src/renderer/painter_debug.cpp b/src/renderer/painter_debug.cpp
index eae655f1f5..f120533838 100644
--- a/src/renderer/painter_debug.cpp
+++ b/src/renderer/painter_debug.cpp
@@ -21,10 +21,10 @@ void Painter::renderDebugText(DebugBucket& bucket, const mat4 &matrix) {
glDisable(GL_DEPTH_TEST);
useProgram(plainShader->program);
- plainShader->setMatrix(matrix);
+ plainShader->u_matrix = matrix;
// Draw white outline
- plainShader->setColor(1.0f, 1.0f, 1.0f, 1.0f);
+ plainShader->u_color = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
lineWidth(4.0f * map.getState().getPixelRatio());
bucket.drawLines(*plainShader);
@@ -35,7 +35,7 @@ void Painter::renderDebugText(DebugBucket& bucket, const mat4 &matrix) {
#endif
// Draw black text.
- plainShader->setColor(0.0f, 0.0f, 0.0f, 1.0f);
+ plainShader->u_color = {{ 0.0f, 0.0f, 0.0f, 1.0f }};
lineWidth(2.0f * map.getState().getPixelRatio());
bucket.drawLines(*plainShader);
@@ -51,11 +51,11 @@ void Painter::renderDebugFrame(const mat4 &matrix) {
glDisable(GL_DEPTH_TEST);
useProgram(plainShader->program);
- plainShader->setMatrix(matrix);
+ plainShader->u_matrix = matrix;
// draw tile outline
tileBorderArray.bind(*plainShader, tileBorderBuffer, BUFFER_OFFSET(0));
- plainShader->setColor(1.0f, 0.0f, 0.0f, 1.0f);
+ plainShader->u_color = {{ 1.0f, 0.0f, 0.0f, 1.0f }};
lineWidth(4.0f * map.getState().getPixelRatio());
glDrawArrays(GL_LINE_STRIP, 0, (GLsizei)tileBorderBuffer.index());
@@ -73,7 +73,7 @@ void Painter::renderDebugText(const std::vector<std::string> &strings) {
glStencilFunc(GL_ALWAYS, 0xFF, 0xFF);
useProgram(plainShader->program);
- plainShader->setMatrix(nativeMatrix);
+ plainShader->u_matrix = nativeMatrix;
DebugFontBuffer debugFontBuffer;
int line = 25;
@@ -86,14 +86,14 @@ void Painter::renderDebugText(const std::vector<std::string> &strings) {
// draw debug info
VertexArrayObject debugFontArray;
debugFontArray.bind(*plainShader, debugFontBuffer, BUFFER_OFFSET(0));
- plainShader->setColor(1.0f, 1.0f, 1.0f, 1.0f);
+ plainShader->u_color = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
lineWidth(4.0f * map.getState().getPixelRatio());
glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index());
#ifndef GL_ES_VERSION_2_0
glPointSize(2);
glDrawArrays(GL_POINTS, 0, (GLsizei)debugFontBuffer.index());
#endif
- plainShader->setColor(0.0f, 0.0f, 0.0f, 1.0f);
+ plainShader->u_color = {{ 0.0f, 0.0f, 0.0f, 1.0f }};
lineWidth(2.0f * map.getState().getPixelRatio());
glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index());
}
diff --git a/src/renderer/painter_fill.cpp b/src/renderer/painter_fill.cpp
index 45706cca1b..6d56b9077e 100644
--- a/src/renderer/painter_fill.cpp
+++ b/src/renderer/painter_fill.cpp
@@ -42,16 +42,16 @@ void Painter::renderFill(FillBucket& bucket, std::shared_ptr<StyleLayer> layer_d
// below, we have to draw the outline first (!)
if (outline && pass == RenderPass::Translucent) {
useProgram(outlineShader->program);
- outlineShader->setMatrix(vtxMatrix);
+ outlineShader->u_matrix = vtxMatrix;
lineWidth(2.0f); // This is always fixed and does not depend on the pixelRatio!
- outlineShader->setColor(stroke_color);
+ outlineShader->u_color = stroke_color;
// Draw the entire line
- outlineShader->setWorld({{
+ outlineShader->u_world = {{
static_cast<float>(map.getState().getFramebufferWidth()),
static_cast<float>(map.getState().getFramebufferHeight())
- }});
+ }};
depthRange(strata, 1.0f);
bucket.drawVertices(*outlineShader);
}
@@ -70,13 +70,13 @@ void Painter::renderFill(FillBucket& bucket, std::shared_ptr<StyleLayer> layer_d
matrix::scale(patternMatrix, patternMatrix, 1.0f / (pos.size[0] * factor), 1.0f / (pos.size[1] * factor));
useProgram(patternShader->program);
- patternShader->setMatrix(vtxMatrix);
- patternShader->setPatternTopLeft(pos.tl);
- patternShader->setPatternBottomRight(pos.br);
- patternShader->setOpacity(properties.opacity);
- patternShader->setImage(0);
- patternShader->setMix(mix);
- patternShader->setPatternMatrix(patternMatrix);
+ patternShader->u_matrix = vtxMatrix;
+ patternShader->u_pattern_tl = pos.tl;
+ patternShader->u_pattern_br = pos.br;
+ patternShader->u_opacity = properties.opacity;
+ patternShader->u_image = 0;
+ patternShader->u_mix = mix;
+ patternShader->u_patternmatrix = patternMatrix;
glActiveTexture(GL_TEXTURE0);
spriteAtlas.bind(true);
@@ -94,8 +94,8 @@ void Painter::renderFill(FillBucket& bucket, std::shared_ptr<StyleLayer> layer_d
// fragments
// Draw filling rectangle.
useProgram(plainShader->program);
- plainShader->setMatrix(vtxMatrix);
- plainShader->setColor(fill_color);
+ plainShader->u_matrix = vtxMatrix;
+ plainShader->u_color = fill_color;
// Draw the actual triangles into the color & stencil buffer.
depthRange(strata + strata_epsilon, 1.0f);
@@ -107,16 +107,16 @@ void Painter::renderFill(FillBucket& bucket, std::shared_ptr<StyleLayer> layer_d
// below, we have to draw the outline first (!)
if (fringeline && pass == RenderPass::Translucent) {
useProgram(outlineShader->program);
- outlineShader->setMatrix(vtxMatrix);
+ outlineShader->u_matrix = vtxMatrix;
lineWidth(2.0f); // This is always fixed and does not depend on the pixelRatio!
- outlineShader->setColor(fill_color);
+ outlineShader->u_color = fill_color;
// Draw the entire line
- outlineShader->setWorld({{
+ outlineShader->u_world = {{
static_cast<float>(map.getState().getFramebufferWidth()),
static_cast<float>(map.getState().getFramebufferHeight())
- }});
+ }};
depthRange(strata + strata_epsilon, 1.0f);
bucket.drawVertices(*outlineShader);
diff --git a/src/renderer/painter_line.cpp b/src/renderer/painter_line.cpp
index b68d46b010..161abcd6ff 100644
--- a/src/renderer/painter_line.cpp
+++ b/src/renderer/painter_line.cpp
@@ -42,22 +42,20 @@ void Painter::renderLine(LineBucket& bucket, std::shared_ptr<StyleLayer> layer_d
// We're only drawing end caps + round line joins if the line is > 2px. Otherwise, they aren't visible anyway.
if (bucket.hasPoints() && outset > 1.0f) {
useProgram(linejoinShader->program);
- linejoinShader->setMatrix(vtxMatrix);
- linejoinShader->setColor(color);
- linejoinShader->setWorld({{
- map.getState().getFramebufferWidth() * 0.5f,
- map.getState().getFramebufferHeight() * 0.5f
- }
- });
- linejoinShader->setLineWidth({{
- ((outset - 0.25f) * map.getState().getPixelRatio()),
- ((inset - 0.25f) * map.getState().getPixelRatio())
- }
- });
+ linejoinShader->u_matrix = vtxMatrix;
+ linejoinShader->u_color = color;
+ linejoinShader->u_world = {{
+ map.getState().getFramebufferWidth() * 0.5f,
+ map.getState().getFramebufferHeight() * 0.5f
+ }};
+ linejoinShader->u_linewidth = {{
+ ((outset - 0.25f) * map.getState().getPixelRatio()),
+ ((inset - 0.25f) * map.getState().getPixelRatio())
+ }};
float pointSize = std::ceil(map.getState().getPixelRatio() * outset * 2.0);
#if defined(GL_ES_VERSION_2_0)
- linejoinShader->setSize(pointSize);
+ linejoinShader->u_size = pointSize;
#else
glPointSize(pointSize);
#endif
@@ -73,16 +71,16 @@ void Painter::renderLine(LineBucket& bucket, std::shared_ptr<StyleLayer> layer_d
useProgram(linepatternShader->program);
- linepatternShader->setMatrix(vtxMatrix);
- linepatternShader->setExtrudeMatrix(extrudeMatrix);
- linepatternShader->setLineWidth({{ outset, inset }});
- linepatternShader->setRatio(ratio);
- linepatternShader->setBlur(blur);
+ linepatternShader->u_matrix = vtxMatrix;
+ linepatternShader->u_exmatrix = extrudeMatrix;
+ linepatternShader->u_linewidth = {{ outset, inset }};
+ linepatternShader->u_ratio = ratio;
+ linepatternShader->u_blur = blur;
- linepatternShader->setPatternSize({{imagePos.size[0] * factor, imagePos.size[1]}});
- linepatternShader->setPatternTopLeft(imagePos.tl);
- linepatternShader->setPatternBottomRight(imagePos.br);
- linepatternShader->setFade(fade);
+ linepatternShader->u_pattern_size = {{imagePos.size[0] * factor, imagePos.size[1]}};
+ linepatternShader->u_pattern_tl = imagePos.tl;
+ linepatternShader->u_pattern_br = imagePos.br;
+ linepatternShader->u_fade = fade;
map.getSpriteAtlas()->bind(true);
glDepthRange(strata + strata_epsilon, 1.0f); // may or may not matter
@@ -92,14 +90,14 @@ void Painter::renderLine(LineBucket& bucket, std::shared_ptr<StyleLayer> layer_d
} else {
useProgram(lineShader->program);
- lineShader->setMatrix(vtxMatrix);
- lineShader->setExtrudeMatrix(extrudeMatrix);
- lineShader->setLineWidth({{ outset, inset }});
- lineShader->setRatio(ratio);
- lineShader->setBlur(blur);
+ lineShader->u_matrix = vtxMatrix;
+ lineShader->u_exmatrix = extrudeMatrix;
+ lineShader->u_linewidth = {{ outset, inset }};
+ lineShader->u_ratio = ratio;
+ lineShader->u_blur = blur;
- lineShader->setColor(color);
- lineShader->setDashArray({{ dash_length, dash_gap }});
+ lineShader->u_color = color;
+ lineShader->u_dasharray = {{ dash_length, dash_gap }};
bucket.drawLines(*lineShader);
}
diff --git a/src/renderer/painter_prerender.cpp b/src/renderer/painter_prerender.cpp
index 14a15effe1..f38470530b 100644
--- a/src/renderer/painter_prerender.cpp
+++ b/src/renderer/painter_prerender.cpp
@@ -25,19 +25,20 @@ void Painter::renderPrerenderedTexture(RasterBucket &bucket, const mat4 &matrix,
// draw the texture on a quad
useProgram(rasterShader->program);
- rasterShader->setMatrix(matrix);
- rasterShader->setOpacity(1);
+ rasterShader->u_matrix = matrix;
+ rasterShader->u_opacity = 1;
depthRange(strata, 1.0f);
glActiveTexture(GL_TEXTURE0);
- rasterShader->setImage(0);
- rasterShader->setBuffer(buffer);
- rasterShader->setOpacity(properties.opacity);
- rasterShader->setBrightness(properties.brightness[0], properties.brightness[1]);
- rasterShader->setSaturation(properties.saturation);
- rasterShader->setContrast(properties.contrast);
- rasterShader->setSpin(spinWeights(properties.hue_rotate));
+ rasterShader->u_image = 0;
+ rasterShader->u_buffer = buffer;
+ rasterShader->u_opacity = properties.opacity;
+ rasterShader->u_brightness_low = properties.brightness[0];
+ rasterShader->u_brightness_high = properties.brightness[1];
+ rasterShader->u_saturation_factor = saturationFactor(properties.saturation);
+ rasterShader->u_contrast_factor = contrastFactor(properties.contrast);
+ rasterShader->u_spin_weights = spinWeights(properties.hue_rotate);
bucket.texture.bindTexture();
coveringRasterArray.bind(*rasterShader, tileStencilBuffer, BUFFER_OFFSET(0));
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)tileStencilBuffer.index());
diff --git a/src/renderer/painter_raster.cpp b/src/renderer/painter_raster.cpp
index 946f6216c7..7f7afc3e84 100644
--- a/src/renderer/painter_raster.cpp
+++ b/src/renderer/painter_raster.cpp
@@ -63,13 +63,14 @@ void Painter::renderRaster(RasterBucket& bucket, std::shared_ptr<StyleLayer> lay
depthMask(false);
useProgram(rasterShader->program);
- rasterShader->setMatrix(matrix);
- rasterShader->setBuffer(0);
- rasterShader->setOpacity(properties.opacity);
- rasterShader->setBrightness(properties.brightness[0], properties.brightness[1]);
- rasterShader->setSaturation(properties.saturation);
- rasterShader->setContrast(properties.contrast);
- rasterShader->setSpin(spinWeights(properties.hue_rotate));
+ rasterShader->u_matrix = matrix;
+ rasterShader->u_buffer = 0;
+ rasterShader->u_opacity = properties.opacity;
+ rasterShader->u_brightness_low = properties.brightness[0];
+ rasterShader->u_brightness_high = properties.brightness[1];
+ rasterShader->u_saturation_factor = saturationFactor(properties.saturation);
+ rasterShader->u_contrast_factor = contrastFactor(properties.contrast);
+ rasterShader->u_spin_weights = spinWeights(properties.hue_rotate);
depthRange(strata + strata_epsilon, 1.0f);
@@ -80,6 +81,22 @@ void Painter::renderRaster(RasterBucket& bucket, std::shared_ptr<StyleLayer> lay
}
+float Painter::saturationFactor(float saturation) {
+ if (saturation > 0) {
+ return 1 - 1 / (1.001 - saturation);
+ } else {
+ return -saturation;
+ }
+}
+
+float Painter::contrastFactor(float contrast) {
+ if (contrast > 0) {
+ return 1 / (1 - contrast);
+ } else {
+ return 1 + contrast;
+ }
+}
+
std::array<float, 3> Painter::spinWeights(float spin) {
spin *= M_PI / 180;
float s = std::sin(spin);
diff --git a/src/renderer/painter_symbol.cpp b/src/renderer/painter_symbol.cpp
index e412bc49d7..61170efb69 100644
--- a/src/renderer/painter_symbol.cpp
+++ b/src/renderer/painter_symbol.cpp
@@ -33,13 +33,15 @@ void Painter::renderSymbol(SymbolBucket &bucket, std::shared_ptr<StyleLayer> lay
matrix::scale(exMatrix, exMatrix, fontSize / 24.0f, fontSize / 24.0f, 1.0f);
useProgram(textShader->program);
- textShader->setMatrix(vtxMatrix);
- textShader->setExtrudeMatrix(exMatrix);
+ textShader->u_matrix = vtxMatrix;
+ textShader->u_exmatrix = exMatrix;
GlyphAtlas &glyphAtlas = *map.getGlyphAtlas();
glyphAtlas.bind();
- textShader->setTextureSize(
- {{static_cast<float>(glyphAtlas.width), static_cast<float>(glyphAtlas.height)}});
+ textShader->u_texsize = {{
+ static_cast<float>(glyphAtlas.width),
+ static_cast<float>(glyphAtlas.height)
+ }};
// Convert the -pi..pi to an int8 range.
float angle = std::round((map.getState().getAngle()) / M_PI * 128);
@@ -47,10 +49,9 @@ void Painter::renderSymbol(SymbolBucket &bucket, std::shared_ptr<StyleLayer> lay
// adjust min/max zooms for variable font sies
float zoomAdjust = log(fontSize / bucket.properties.text.max_size) / log(2);
- textShader->setAngle((int32_t)(angle + 256) % 256);
- textShader->setFlip(bucket.properties.placement == PlacementType::Line ? 1 : 0);
- textShader->setZoom((map.getState().getNormalizedZoom() - zoomAdjust) *
- 10); // current zoom level
+ textShader->u_angle = (int32_t)(angle + 256) % 256;
+ textShader->u_flip = (bucket.properties.placement == PlacementType::Line ? 1 : 0);
+ textShader->u_zoom = (map.getState().getNormalizedZoom() - zoomAdjust) * 10; // current zoom level
// Label fading
const timestamp duration = 300_milliseconds;
@@ -83,10 +84,10 @@ void Painter::renderSymbol(SymbolBucket &bucket, std::shared_ptr<StyleLayer> lay
// bump is how much farther it would have been if it had continued zooming at the same rate
float bump = (currentTime - lastFrame.t) / duration * fadedist;
- textShader->setFadeDist(fadedist * 10);
- textShader->setMinFadeZoom(std::floor(lowZ * 10));
- textShader->setMaxFadeZoom(std::floor(highZ * 10));
- textShader->setFadeZoom((map.getState().getNormalizedZoom() + bump) * 10);
+ textShader->u_fadedist = fadedist * 10;
+ textShader->u_minfadezoom = std::floor(lowZ * 10);
+ textShader->u_maxfadezoom = std::floor(highZ * 10);
+ textShader->u_fadezoom = (map.getState().getNormalizedZoom() + bump) * 10;
}
// This defines the gamma around the SDF cutoff value.
@@ -121,10 +122,9 @@ void Painter::renderSymbol(SymbolBucket &bucket, std::shared_ptr<StyleLayer> lay
// Note that this does *not* have to be adjusted for retina screens, because we want
// the
// same blur width when we explicitly specify one.
- textShader->setGamma((properties.text.halo_blur / (fontSize / sdfFontSize)) / 8.0f /
- 2.0f);
+ textShader->u_gamma = (properties.text.halo_blur / (fontSize / sdfFontSize)) / 8.0f / 2.0f;
} else {
- textShader->setGamma(sdfGamma);
+ textShader->u_gamma = sdfGamma;
}
if (properties.text.opacity < 1.0f) {
@@ -133,29 +133,29 @@ void Painter::renderSymbol(SymbolBucket &bucket, std::shared_ptr<StyleLayer> lay
color[1] *= properties.text.opacity;
color[2] *= properties.text.opacity;
color[3] *= properties.text.opacity;
- textShader->setColor(color);
+ textShader->u_color = color;
} else {
- textShader->setColor(properties.text.halo_color);
+ textShader->u_color = properties.text.halo_color;
}
- textShader->setBuffer(haloWidth);
+ textShader->u_buffer = haloWidth;
depthRange(strata, 1.0f);
bucket.drawGlyphs(*textShader);
}
if (properties.text.color[3] > 0.0f) {
// Then, we draw the text over the halo
- textShader->setGamma(gamma);
+ textShader->u_gamma = gamma;
if (properties.text.opacity < 1.0f) {
Color color = properties.text.color;
color[0] *= properties.text.opacity;
color[1] *= properties.text.opacity;
color[2] *= properties.text.opacity;
color[3] *= properties.text.opacity;
- textShader->setColor(color);
+ textShader->u_color = color;
} else {
- textShader->setColor(properties.text.color);
+ textShader->u_color = properties.text.color;
}
- textShader->setBuffer((256.0f - 64.0f) / 256.0f);
+ textShader->u_buffer = (256.0f - 64.0f) / 256.0f;
depthRange(strata + strata_epsilon, 1.0f);
bucket.drawGlyphs(*textShader);
}
@@ -182,13 +182,15 @@ void Painter::renderSymbol(SymbolBucket &bucket, std::shared_ptr<StyleLayer> lay
matrix::scale(exMatrix, exMatrix, fontScale, fontScale, 1.0f);
useProgram(iconShader->program);
- iconShader->setMatrix(vtxMatrix);
- iconShader->setExtrudeMatrix(exMatrix);
+ iconShader->u_matrix = vtxMatrix;
+ iconShader->u_exmatrix = exMatrix;
SpriteAtlas &spriteAtlas = *map.getSpriteAtlas();
spriteAtlas.bind(map.getState().isChanging() || bucket.properties.placement == PlacementType::Line || angleOffset != 0 || fontScale != 1);
- iconShader->setTextureSize(
- {{static_cast<float>(spriteAtlas.getWidth()), static_cast<float>(spriteAtlas.getHeight())}});
+ iconShader->u_texsize = {{
+ static_cast<float>(spriteAtlas.getWidth()),
+ static_cast<float>(spriteAtlas.getHeight())
+ }};
// Convert the -pi..pi to an int8 range.
const float angle = std::round((map.getState().getAngle()) / M_PI * 128);
@@ -196,16 +198,15 @@ void Painter::renderSymbol(SymbolBucket &bucket, std::shared_ptr<StyleLayer> lay
// adjust min/max zooms for variable font sies
float zoomAdjust = log(fontSize / bucket.properties.icon.max_size) / log(2);
- iconShader->setAngle((int32_t)(angle + 256) % 256);
- iconShader->setFlip(bucket.properties.placement == PlacementType::Line ? 1 : 0);
- iconShader->setZoom((map.getState().getNormalizedZoom() - zoomAdjust) *
- 10); // current zoom level
+ iconShader->u_angle = (int32_t)(angle + 256) % 256;
+ iconShader->u_flip = bucket.properties.placement == PlacementType::Line ? 1 : 0;
+ iconShader->u_zoom = (map.getState().getNormalizedZoom() - zoomAdjust) * 10; // current zoom level
- iconShader->setFadeDist(0 * 10);
- iconShader->setMinFadeZoom(map.getState().getNormalizedZoom() * 10);
- iconShader->setMaxFadeZoom(map.getState().getNormalizedZoom() * 10);
- iconShader->setFadeZoom(map.getState().getNormalizedZoom() * 10);
- iconShader->setOpacity(properties.icon.opacity);
+ iconShader->u_fadedist = 0 * 10;
+ iconShader->u_minfadezoom = map.getState().getNormalizedZoom() * 10;
+ iconShader->u_maxfadezoom = map.getState().getNormalizedZoom() * 10;
+ iconShader->u_fadezoom = map.getState().getNormalizedZoom() * 10;
+ iconShader->u_opacity = properties.icon.opacity;
depthRange(strata, 1.0f);
bucket.drawIcons(*iconShader);
diff --git a/src/renderer/prerendered_texture.cpp b/src/renderer/prerendered_texture.cpp
index 52f7edc50b..0a47816323 100644
--- a/src/renderer/prerendered_texture.cpp
+++ b/src/renderer/prerendered_texture.cpp
@@ -110,8 +110,8 @@ void PrerenderedTexture::blur(Painter& painter, uint16_t passes) {
painter.useProgram(painter.gaussianShader->program);
- painter.gaussianShader->setMatrix(painter.flipMatrix);
- painter.gaussianShader->setImage(0);
+ painter.gaussianShader->u_matrix = painter.flipMatrix;
+ painter.gaussianShader->u_image = 0;
glActiveTexture(GL_TEXTURE0);
for (int i = 0; i < passes; i++) {
@@ -123,7 +123,7 @@ void PrerenderedTexture::blur(Painter& painter, uint16_t passes) {
#endif
glClear(GL_COLOR_BUFFER_BIT);
- painter.gaussianShader->setOffset({{ 1.0f / float(properties.size), 0 }});
+ painter.gaussianShader->u_offset = {{ 1.0f / float(properties.size), 0 }};
glBindTexture(GL_TEXTURE_2D, original_texture);
painter.coveringGaussianArray.bind(*painter.gaussianShader, painter.tileStencilBuffer, BUFFER_OFFSET(0));
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)painter.tileStencilBuffer.index());
@@ -137,7 +137,7 @@ void PrerenderedTexture::blur(Painter& painter, uint16_t passes) {
#endif
glClear(GL_COLOR_BUFFER_BIT);
- painter.gaussianShader->setOffset({{ 0, 1.0f / float(properties.size) }});
+ painter.gaussianShader->u_offset = {{ 0, 1.0f / float(properties.size) }};
glBindTexture(GL_TEXTURE_2D, secondary_texture);
painter.coveringGaussianArray.bind(*painter.gaussianShader, painter.tileStencilBuffer, BUFFER_OFFSET(0));
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)painter.tileStencilBuffer.index());
diff --git a/src/renderer/raster_bucket.cpp b/src/renderer/raster_bucket.cpp
index 10dadc03fc..492eea980d 100644
--- a/src/renderer/raster_bucket.cpp
+++ b/src/renderer/raster_bucket.cpp
@@ -19,14 +19,14 @@ bool RasterBucket::setImage(const std::string &data) {
void RasterBucket::drawRaster(RasterShader& shader, StaticVertexBuffer &vertices, VertexArrayObject &array) {
raster.bind(true);
- shader.setImage(0);
+ shader.u_image = 0;
array.bind(shader, vertices, BUFFER_OFFSET(0));
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)vertices.index());
}
void RasterBucket::drawRaster(RasterShader& shader, StaticVertexBuffer &vertices, VertexArrayObject &array, GLuint texture) {
raster.bind(texture);
- shader.setImage(0);
+ shader.u_image = 0;
array.bind(shader, vertices, BUFFER_OFFSET(0));
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)vertices.index());
}