17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 23:49:19 +02:00
Files
maszyna/launcher/deferred_image.cppm
maj00r b8f040e6fd propagate template headers transitively, import Console where used
AnimModel.cpp reaches cParser through the simulation core, not a direct
import, so the previous pass missed it; the propagation now follows the
whole import closure. Train.cpp, drivermode.cpp and Globals.cpp call
Console:: inside _WIN32 guards without importing eu07.console - invisible
on Linux, where those blocks are skipped.
2026-09-10 01:41:24 +02:00

72 lines
1.4 KiB
C++

module;
#include <array>
#include <chrono>
#include <deque>
#include <limits>
#include <mutex>
#include <ostream>
#include <sstream>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
#include <cstddef>
#include "glad/glad.h"
#include <string>
#include "global_include/interfaces/ITexture_macros.h"
export module eu07.launcher.deferred_image;
import eu07.glm;
import eu07.global_include.interfaces.itexture;
import eu07.model.texture;
import eu07.rendering.renderer;
export {
class deferred_image {
public:
deferred_image() = default;
deferred_image(const std::string &p) : path(p) { }
deferred_image(const deferred_image&) = delete;
deferred_image(deferred_image&&) = default;
deferred_image &operator=(deferred_image&&) = default;
operator bool() const
{
return image != null_handle || !path.empty();
}
GLuint get() const
{
if (!path.empty()) {
image = GfxRenderer->Fetch_Texture(path, true);
path.clear();
}
if (image != null_handle) {
auto &tex = GfxRenderer->Texture(image);
tex.create();
if (tex.get_is_ready())
return tex.get_id();
}
return -1;
}
glm::ivec2 size() const
{
if (image != null_handle) {
auto &tex = GfxRenderer->Texture(image);
return glm::ivec2(tex.get_width(), tex.get_height());
}
return glm::ivec2();
}
private:
mutable std::string path;
mutable texture_handle image = 0;
};
} // export