mirror of
https://github.com/mehah/otclient
synced 2026-08-15 16:29:06 -04:00
update
This commit is contained in:
parent
c5f7b3ed84
commit
aaf175e3d3
4 changed files with 29 additions and 2 deletions
|
|
@ -177,6 +177,8 @@ void MapView::drawFloor()
|
|||
}
|
||||
|
||||
tasks.wait();
|
||||
|
||||
g_drawPool.join();
|
||||
} else for (const auto& tile : map.tiles)
|
||||
drawTile(tile, _camera, alwaysTransparent);
|
||||
|
||||
|
|
|
|||
|
|
@ -63,8 +63,9 @@ void DrawPool::add(const Color& color, const TexturePtr& texture, DrawMethod&& m
|
|||
}
|
||||
}
|
||||
|
||||
if (textureAtlas && m_perThreadObjects.size() > 1) {
|
||||
m_perThreadObjects[CURRENT_THREAD_ID].emplace_back(color, method, textureAtlas);
|
||||
if (m_perThreadObjects.size() > 1) {
|
||||
if (textureAtlas)
|
||||
m_perThreadObjects[CURRENT_THREAD_ID].emplace_back(color, std::move(method), textureAtlas);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -94,6 +95,27 @@ void DrawPool::add(const Color& color, const TexturePtr& texture, DrawMethod&& m
|
|||
resetOnlyOnceParameters();
|
||||
}
|
||||
|
||||
void DrawPool::join() {
|
||||
for (auto& objs : m_perThreadObjects) {
|
||||
for (const auto& obj : objs) {
|
||||
if (!updateHash(obj.method, nullptr, obj.color, false))
|
||||
continue;
|
||||
|
||||
auto& list = m_objects[DrawOrder::THIRD];
|
||||
auto& state = getCurrentState();
|
||||
|
||||
if (!list.empty() && list.back().state == state) {
|
||||
auto& last = list.back();
|
||||
addCoords(*last.coords, obj.method);
|
||||
} else {
|
||||
auto& draw = list.emplace_back(getState(nullptr, obj.atlas, obj.color), getCoordsBuffer());
|
||||
addCoords(*draw.coords, obj.method);
|
||||
}
|
||||
}
|
||||
objs.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void DrawPool::addCoords(CoordsBuffer& buffer, const DrawMethod& method)
|
||||
{
|
||||
if (method.type == DrawMethodType::BOUNDING_RECT) {
|
||||
|
|
|
|||
|
|
@ -341,6 +341,8 @@ private:
|
|||
m_parameters.erase(it);
|
||||
}
|
||||
|
||||
void join();
|
||||
|
||||
void flush()
|
||||
{
|
||||
m_coords.clear();
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ public:
|
|||
bool containsParameter(const std::string_view name) { return getCurrentPool()->containsParameter(name); }
|
||||
|
||||
void flush() const { if (getCurrentPool()) getCurrentPool()->flush(); }
|
||||
void join() const { if (getCurrentPool()) getCurrentPool()->join(); }
|
||||
|
||||
DrawPoolType getCurrentType() const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue