Files
MapLibreParticleLab/include/mln/gfx/drawable_atlases_tweaker.hpp
Bart Louwers 2a8ebc4906 core: rename mbgl directories to mln (#4511)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-22 20:50:14 +02:00

65 lines
1.8 KiB
C++

#pragma once
#include <mln/gfx/drawable_tweaker.hpp>
#include <mln/style/types.hpp>
#include <mln/renderer/layers/render_symbol_layer.hpp>
#include <memory>
#include <string>
namespace mln {
class TileAtlasTextures;
using TileAtlasTexturesPtr = std::shared_ptr<TileAtlasTextures>;
class PaintParameters;
namespace gfx {
class Drawable;
/**
Tweaker that applies the latest values from a retained `TileAtlasTexturesPtr`
*/
class DrawableAtlasesTweaker : public gfx::DrawableTweaker {
public:
DrawableAtlasesTweaker(TileAtlasTexturesPtr atlases_,
const std::optional<size_t> iconTextureId_,
const std::optional<size_t> glyphTextureId_,
bool isText_,
const bool sdfIcons_,
const style::AlignmentType rotationAlignment_,
const bool iconScaled_,
const bool textSizeIsZoomConstant_)
: atlases(std::move(atlases_)),
iconTextureId(iconTextureId_),
glyphTextureId(glyphTextureId_),
isText(isText_),
sdfIcons(sdfIcons_),
rotationAlignment(rotationAlignment_),
iconScaled(iconScaled_),
textSizeIsZoomConstant(textSizeIsZoomConstant_) {
assert(iconTextureId_ != glyphTextureId_);
}
~DrawableAtlasesTweaker() override = default;
void init(Drawable&) override;
void execute(Drawable&, PaintParameters&) override;
protected:
void setupTextures(Drawable&, const bool);
TileAtlasTexturesPtr atlases;
std::optional<size_t> iconTextureId;
std::optional<size_t> glyphTextureId;
bool isText;
const bool sdfIcons;
const style::AlignmentType rotationAlignment;
const bool iconScaled;
const bool textSizeIsZoomConstant;
};
} // namespace gfx
} // namespace mln