Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
60 lines
1.8 KiB
C++
60 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <exception>
|
|
#include <functional>
|
|
#include <string>
|
|
|
|
namespace mbgl {
|
|
|
|
namespace gfx {
|
|
class ShaderRegistry;
|
|
}
|
|
|
|
class RendererObserver {
|
|
public:
|
|
virtual ~RendererObserver() = default;
|
|
|
|
enum class RenderMode : uint32_t {
|
|
Partial,
|
|
Full
|
|
};
|
|
|
|
/// Signals that a repaint is required
|
|
virtual void onInvalidate() {}
|
|
|
|
/// Resource failed to download / parse
|
|
virtual void onResourceError(std::exception_ptr) {}
|
|
|
|
/// First frame
|
|
virtual void onWillStartRenderingMap() {}
|
|
|
|
/// Start of frame, initial is the first frame for this map
|
|
virtual void onWillStartRenderingFrame() {}
|
|
|
|
/// End of frame, booleans flags that a repaint is required and that placement changed.
|
|
virtual void onDidFinishRenderingFrame(RenderMode, bool /*repaint*/, bool /*placementChanged*/) {}
|
|
|
|
/// End of frame, booleans flags that a repaint is required and that placement changed.
|
|
virtual void onDidFinishRenderingFrame(RenderMode mode,
|
|
bool repaint,
|
|
bool placementChanged,
|
|
double /*frameEncodingTime*/,
|
|
double /*frameRenderingTime*/) {
|
|
onDidFinishRenderingFrame(mode, repaint, placementChanged);
|
|
}
|
|
|
|
/// Final frame
|
|
virtual void onDidFinishRenderingMap() {}
|
|
|
|
/// Style is missing an image
|
|
using StyleImageMissingCallback = std::function<void()>;
|
|
virtual void onStyleImageMissing(const std::string&, const StyleImageMissingCallback& done) { done(); }
|
|
virtual void onRemoveUnusedStyleImages(const std::vector<std::string>&) {}
|
|
|
|
// Entry point for custom shader registration
|
|
virtual void onRegisterShaders(gfx::ShaderRegistry&){};
|
|
};
|
|
|
|
} // namespace mbgl
|