Merge pull request #418 from mapbox/raster-styling

Raster styling
This commit is contained in:
Lauren Budorick
2014-08-13 11:00:04 -07:00
8 changed files with 120 additions and 6 deletions

View File

@@ -66,6 +66,10 @@ void Painter::renderRaster(RasterBucket& bucket, std::shared_ptr<StyleLayer> lay
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));
glDepthRange(strata + strata_epsilon, 1.0f);
@@ -75,3 +79,15 @@ void Painter::renderRaster(RasterBucket& bucket, std::shared_ptr<StyleLayer> lay
}
}
std::array<float, 3> Painter::spinWeights(float spin) {
spin *= M_PI / 180;
float s = std::sin(spin);
float c = std::cos(spin);
std::array<float, 3> spin_weights = {{
(2 * c + 1) / 3,
(-std::sqrt(3.0f) * s - c + 1) / 3,
(std::sqrt(3.0f) * s - c + 1) / 3
}};
return spin_weights;
}