17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-28 15:47:30 +01:00

pch migration to modules [wip]

This commit is contained in:
maj00r
2026-09-09 20:35:26 +02:00
parent c3007e3237
commit 3f7960aad5
350 changed files with 5958 additions and 3059 deletions

View File

@@ -0,0 +1,59 @@
module;
#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