AsssetManager um Loading-Queue erweitern #18

Closed
opened 2026-04-16 20:20:47 +00:00 by sebastian · 0 comments
Owner

Problem: AssetManager::loadTexture() und loadModel() sind synchron und blockieren den Render-Thread. Für einen Ladescreen muss Laden pro Frame in kleinen Schritten geschehen, damit der Ladebalken aktuell bleibt.
Lösung:

// Neue Methoden in AssetManager:
static void scheduleTexture(const std::string& name,
                            const std::string& path,
                            Loader& loader);

static void scheduleModel(const std::string& name,
                          const std::string& objPath,
                          const std::string& texPath,
                          Loader& loader);

// Pro Frame aufrufen (z.B. 1-3 Assets):
static LoadingProgress processQueue(int maxItemsPerFrame = 2);

struct LoadingProgress {
    int total;
    int loaded;
    float fraction() const { return total > 0 ? (float)loaded/total : 1.f; }
    bool isDone() const { return loaded >= total; }
};

Die bestehenden synchronen Methoden bleiben erhalten (für Assets die sofort gebraucht werden).
Acceptance Criteria:

  • scheduleTexture/scheduleModel fügen zur Queue hinzu ohne zu laden
  • processQueue() lädt maximal N Assets pro Aufruf und gibt Progress zurück
  • Bereits geladene Assets werden korrekt aus der Queue entfernt
  • Bestehender Code (loadTexture, loadModel) bleibt unverändert
Problem: AssetManager::loadTexture() und loadModel() sind synchron und blockieren den Render-Thread. Für einen Ladescreen muss Laden pro Frame in kleinen Schritten geschehen, damit der Ladebalken aktuell bleibt. Lösung: ``` // Neue Methoden in AssetManager: static void scheduleTexture(const std::string& name, const std::string& path, Loader& loader); static void scheduleModel(const std::string& name, const std::string& objPath, const std::string& texPath, Loader& loader); // Pro Frame aufrufen (z.B. 1-3 Assets): static LoadingProgress processQueue(int maxItemsPerFrame = 2); struct LoadingProgress { int total; int loaded; float fraction() const { return total > 0 ? (float)loaded/total : 1.f; } bool isDone() const { return loaded >= total; } }; ``` Die bestehenden synchronen Methoden bleiben erhalten (für Assets die sofort gebraucht werden). Acceptance Criteria: - scheduleTexture/scheduleModel fügen zur Queue hinzu ohne zu laden - processQueue() lädt maximal N Assets pro Aufruf und gibt Progress zurück - Bereits geladene Assets werden korrekt aus der Queue entfernt - Bestehender Code (loadTexture, loadModel) bleibt unverändert
sebastian added the
enhancement
engine
labels 2026-04-16 20:21:00 +00:00
sebastian changed title from Inkrementelles Asset-Loading to AsssetManager um Loading-Queue erweitern 2026-04-16 20:21:40 +00:00
sebastian added this to the Inkrementelles AssetLoading milestone 2026-04-16 20:21:45 +00:00
sebastian added this to the Dicewars project 2026-04-16 21:02:41 +00:00
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sebastian/Dicewars-Siedler#18
No description provided.