53 lines
1.6 KiB
C++
53 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <mbgl/style/layer.hpp>
|
|
#include <mbgl/gfx/shader_registry.hpp>
|
|
#include <mbgl/map/transform_state.hpp>
|
|
#include <mbgl/renderer/update_parameters.hpp>
|
|
#include <mbgl/renderer/render_tree.hpp>
|
|
#include <mbgl/renderer/change_request.hpp>
|
|
|
|
#include <array>
|
|
#include <memory>
|
|
|
|
namespace mbgl {
|
|
namespace style {
|
|
|
|
class CustomDrawableLayerHost {
|
|
public:
|
|
virtual ~CustomDrawableLayerHost() = default;
|
|
|
|
virtual void initialize() = 0;
|
|
|
|
virtual void update(RenderLayer& proxyLayer,
|
|
gfx::ShaderRegistry& shaders,
|
|
gfx::Context& context,
|
|
const TransformState& state,
|
|
const std::shared_ptr<UpdateParameters>&,
|
|
const RenderTree& renderTree,
|
|
UniqueChangeRequestVec& changes) = 0;
|
|
|
|
virtual void deinitialize() = 0;
|
|
};
|
|
|
|
class CustomDrawableLayer final : public Layer {
|
|
public:
|
|
CustomDrawableLayer(const std::string& id, std::unique_ptr<CustomDrawableLayerHost> host);
|
|
|
|
CustomDrawableLayer(const CustomDrawableLayer&) = delete;
|
|
~CustomDrawableLayer() final;
|
|
class Impl;
|
|
const Impl& impl() const;
|
|
Mutable<Impl> mutableImpl() const;
|
|
|
|
private:
|
|
std::optional<conversion::Error> setPropertyInternal(const std::string& name,
|
|
const conversion::Convertible& value) final;
|
|
StyleProperty getProperty(const std::string&) const final;
|
|
std::unique_ptr<Layer> cloneRef(const std::string& id) const final;
|
|
Mutable<Layer::Impl> mutableBaseImpl() const final;
|
|
};
|
|
|
|
} // namespace style
|
|
} // namespace mbgl
|