#pragma once #include #include #include #include #include #include #include namespace wowee { namespace pipeline { class AssetManager; } namespace rendering { class Shader; class Camera; class Minimap { public: Minimap(); ~Minimap(); bool initialize(int size = 200); void shutdown(); void setAssetManager(pipeline::AssetManager* am) { assetManager = am; } void setMapName(const std::string& name); void render(const Camera& playerCamera, const glm::vec3& centerWorldPos, int screenWidth, int screenHeight); void setEnabled(bool enabled) { this->enabled = enabled; } bool isEnabled() const { return enabled; } void toggle() { enabled = !enabled; } void setViewRadius(float radius) { viewRadius = radius; } void setRotateWithCamera(bool rotate) { rotateWithCamera = rotate; } bool isRotateWithCamera() const { return rotateWithCamera; } void setSquareShape(bool square) { squareShape = square; } bool isSquareShape() const { return squareShape; } void zoomIn() { viewRadius = std::max(100.0f, viewRadius - 50.0f); } void zoomOut() { viewRadius = std::min(800.0f, viewRadius + 50.0f); } // Public accessors for WorldMap GLuint getOrLoadTileTexture(int tileX, int tileY); void ensureTRSParsed() { if (!trsParsed) parseTRS(); } GLuint getTileQuadVAO() const { return tileQuadVAO; } const std::string& getMapName() const { return mapName; } private: void parseTRS(); void compositeTilesToFBO(const glm::vec3& centerWorldPos); void renderQuad(const Camera& playerCamera, const glm::vec3& centerWorldPos, int screenWidth, int screenHeight); pipeline::AssetManager* assetManager = nullptr; std::string mapName = "Azeroth"; // TRS lookup: "Azeroth\map32_49" → "e7f0dea73ee6baca78231aaf4b7e772a" std::unordered_map trsLookup; bool trsParsed = false; // Tile texture cache: hash → GL texture ID std::unordered_map tileTextureCache; GLuint noDataTexture = 0; // dark fallback for missing tiles // Composite FBO (3x3 tiles = 768x768) GLuint compositeFBO = 0; GLuint compositeTexture = 0; static constexpr int TILE_PX = 256; static constexpr int COMPOSITE_PX = TILE_PX * 3; // 768 // Tile compositing quad GLuint tileQuadVAO = 0; GLuint tileQuadVBO = 0; std::unique_ptr tileShader; // Screen quad GLuint quadVAO = 0; GLuint quadVBO = 0; std::unique_ptr quadShader; int mapSize = 200; float viewRadius = 400.0f; // world units visible in minimap radius bool enabled = true; bool rotateWithCamera = false; bool squareShape = false; // Throttling float updateIntervalSec = 0.25f; float updateDistance = 6.0f; std::chrono::steady_clock::time_point lastUpdateTime{}; glm::vec3 lastUpdatePos{0.0f}; bool hasCachedFrame = false; // Tile tracking int lastCenterTileX = -1; int lastCenterTileY = -1; }; } // namespace rendering } // namespace wowee