summaryrefslogtreecommitdiff
path: root/gfx/models/texture.h
blob: 09538b3d6feede57dab7498a4f86b985848641c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include <cache.h>
#include <filesystem>
#include <glArrays.h>
#include <glm/fwd.hpp>

// IWYU pragma: no_forward_declare Cache
class Image;

class Texture {
public:
	explicit Texture(const std::filesystem::path & fileName);
	explicit Texture(const Image & image);
	explicit Texture(GLsizei width, GLsizei height, const void * data);

	static Cache<Texture, std::filesystem::path> cachedTexture;

	void bind(GLenum unit = GL_TEXTURE0) const;

	static void save(const glTexture &, const glm::ivec2 & size, const char * path);

private:
	glTexture m_texture;
};