refactor: Remove OverworldEditorManager and GraphicsManager for Simplification
- Deleted OverworldEditorManager and OverworldGraphicsManager classes to streamline the codebase and reduce complexity in the overworld editor. - Updated CMake configuration to remove references to the deleted files, ensuring a clean build environment. - Adjusted OverworldEditor to handle graphics management directly, improving maintainability and reducing the number of dependencies. - Enhanced the initialization and update methods in OverworldEditor to accommodate the removal of the manager classes, ensuring continued functionality. - Cleaned up related header files to reflect the removal of obsolete classes and methods, enhancing clarity and organization.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "app/gfx/arena.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "util/sdl_deleter.h"
|
||||
|
||||
@@ -443,5 +444,66 @@ void Arena::ClearBatchQueue() {
|
||||
batch_update_queue_.clear();
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Progressive/Deferred Texture Management
|
||||
// ============================================================================
|
||||
|
||||
void Arena::QueueDeferredTexture(gfx::Bitmap* bitmap, int priority) {
|
||||
if (!bitmap) return;
|
||||
|
||||
std::lock_guard<std::mutex> lock(deferred_mutex_);
|
||||
deferred_textures_.emplace_back(bitmap, priority);
|
||||
}
|
||||
|
||||
std::vector<gfx::Bitmap*> Arena::GetNextDeferredTextureBatch(
|
||||
int high_priority_limit, int low_priority_limit) {
|
||||
std::lock_guard<std::mutex> lock(deferred_mutex_);
|
||||
|
||||
std::vector<gfx::Bitmap*> batch;
|
||||
|
||||
if (deferred_textures_.empty()) {
|
||||
return batch;
|
||||
}
|
||||
|
||||
// Sort by priority (lower number = higher priority)
|
||||
std::sort(deferred_textures_.begin(), deferred_textures_.end(),
|
||||
[](const DeferredTexture& a, const DeferredTexture& b) {
|
||||
return a.priority < b.priority;
|
||||
});
|
||||
|
||||
// Phase 1: Collect high-priority items (priority 0-10)
|
||||
auto it = deferred_textures_.begin();
|
||||
while (it != deferred_textures_.end() && batch.size() < static_cast<size_t>(high_priority_limit)) {
|
||||
if (it->bitmap && it->priority <= 10 && !it->bitmap->texture()) {
|
||||
batch.push_back(it->bitmap);
|
||||
it = deferred_textures_.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 2: Collect low-priority items (priority 11+) if we have capacity
|
||||
if (batch.size() < static_cast<size_t>(high_priority_limit)) {
|
||||
it = deferred_textures_.begin();
|
||||
int low_count = 0;
|
||||
while (it != deferred_textures_.end() && low_count < low_priority_limit) {
|
||||
if (it->bitmap && it->priority > 10 && !it->bitmap->texture()) {
|
||||
batch.push_back(it->bitmap);
|
||||
low_count++;
|
||||
it = deferred_textures_.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return batch;
|
||||
}
|
||||
|
||||
void Arena::ClearDeferredTextures() {
|
||||
std::lock_guard<std::mutex> lock(deferred_mutex_);
|
||||
deferred_textures_.clear();
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace yaze
|
||||
Reference in New Issue
Block a user