diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-05-04 16:01:16 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-05-08 19:39:55 +0300 |
commit | 20810f988a735e0d43f9abff9260ea0784cd218c (patch) | |
tree | 57121706a03488bda12d40451671961bb8653a58 /src/mbgl/style/style.cpp | |
parent | 1c9af3226f0ad306cf2ec8be9ff1558938f69736 (diff) | |
download | qtlocation-mapboxgl-20810f988a735e0d43f9abff9260ea0784cd218c.tar.gz |
[core] render light
Diffstat (limited to 'src/mbgl/style/style.cpp')
-rw-r--r-- | src/mbgl/style/style.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index 63fb602616..080911b746 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -59,6 +59,7 @@ Style::Style(Scheduler& scheduler_, FileSource& fileSource_, float pixelRatio) spriteAtlas(std::make_unique<SpriteAtlas>(Size{ 1024, 1024 }, pixelRatio)), lineAtlas(std::make_unique<LineAtlas>(Size{ 256, 512 })), light(std::make_unique<Light>()), + renderLight(std::make_unique<RenderLight>(*light)), observer(&nullObserver) { glyphAtlas->setObserver(this); spriteAtlas->setObserver(this); @@ -147,7 +148,7 @@ void Style::setJSON(const std::string& json) { defaultZoom = parser.zoom; defaultBearing = parser.bearing; defaultPitch = parser.pitch; - light = std::make_unique<Light>(parser.light); + setLight(std::make_unique<Light>(parser.light)); glyphAtlas->setURL(parser.glyphURL); spriteAtlas->load(parser.spriteURL, scheduler, fileSource); @@ -310,6 +311,19 @@ void Style::removeRenderLayer(const std::string& id) { } } +void Style::setLight(std::unique_ptr<Light> light_) { + light = std::move(light_); + renderLight = std::make_unique<RenderLight>(*light); +} + +Light* Style::getLight() const { + return light.get(); +} + +RenderLight* Style::getRenderLight() const { + return renderLight.get(); +} + std::string Style::getName() const { return name; } @@ -364,11 +378,11 @@ void Style::update(const UpdateParameters& parameters) { const bool evaluate = cascade || zoomChanged || parameters.updateFlags & Update::RecalculateStyle; if (cascade) { - transitioningLight = TransitioningLight(*light, std::move(transitioningLight), cascadeParameters); + renderLight->transition(cascadeParameters); } - if (evaluate || transitioningLight.hasTransition()) { - evaluatedLight = EvaluatedLight(transitioningLight, evaluationParameters); + if (evaluate || renderLight->hasTransition()) { + renderLight->evaluate(evaluationParameters); } for (const auto& renderSource : renderSources) { @@ -443,7 +457,7 @@ RenderSource* Style::getRenderSource(const std::string& id) const { } bool Style::hasTransitions() const { - if (transitioningLight.hasTransition()) { + if (renderLight->hasTransition()) { return true; } |