mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 04:50:04 +00:00
61 lines
1.2 KiB
C++
61 lines
1.2 KiB
C++
#include <scwx/qt/map/draw_layer.hpp>
|
|
#include <scwx/qt/gl/shader_program.hpp>
|
|
#include <scwx/util/logger.hpp>
|
|
|
|
namespace scwx
|
|
{
|
|
namespace qt
|
|
{
|
|
namespace map
|
|
{
|
|
|
|
static const std::string logPrefix_ = "scwx::qt::map::draw_layer";
|
|
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|
|
|
class DrawLayerImpl
|
|
{
|
|
public:
|
|
explicit DrawLayerImpl(std::shared_ptr<MapContext> context) {}
|
|
~DrawLayerImpl() {}
|
|
|
|
std::vector<std::shared_ptr<gl::draw::DrawItem>> drawList_;
|
|
};
|
|
|
|
DrawLayer::DrawLayer(std::shared_ptr<MapContext> context) :
|
|
GenericLayer(context), p(std::make_unique<DrawLayerImpl>(context))
|
|
{
|
|
}
|
|
DrawLayer::~DrawLayer() = default;
|
|
|
|
void DrawLayer::Initialize()
|
|
{
|
|
for (auto& item : p->drawList_)
|
|
{
|
|
item->Initialize();
|
|
}
|
|
}
|
|
|
|
void DrawLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
|
|
{
|
|
for (auto& item : p->drawList_)
|
|
{
|
|
item->Render(params);
|
|
}
|
|
}
|
|
|
|
void DrawLayer::Deinitialize()
|
|
{
|
|
for (auto& item : p->drawList_)
|
|
{
|
|
item->Deinitialize();
|
|
}
|
|
}
|
|
|
|
void DrawLayer::AddDrawItem(std::shared_ptr<gl::draw::DrawItem> drawItem)
|
|
{
|
|
p->drawList_.push_back(drawItem);
|
|
}
|
|
|
|
} // namespace map
|
|
} // namespace qt
|
|
} // namespace scwx
|